From 5d5b1e69081cd2a4a93ce5d5448f62f7e9e97cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 10 Sep 2017 15:10:04 +0300 Subject: [PATCH] Fix various clippy warnings in examples --- examples/src/bin/appsink.rs | 2 +- examples/src/bin/decodebin.rs | 2 +- examples/src/bin/launch.rs | 2 +- examples/src/bin/pad_probes.rs | 2 +- examples/src/bin/playbin.rs | 2 +- examples/src/bin/player.rs | 2 +- examples/src/bin/toc.rs | 5 ++--- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index eb9bf40f8..fba83a252 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -67,7 +67,7 @@ fn create_pipeline() -> Result { let sum: f64 = samples .iter() .map(|sample| { - let f = (*sample as f64) / (i16::MAX as f64); + let f = f64::from(*sample) / f64::from(i16::MAX); f * f }) .sum(); diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index d4f65e927..efd838924 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -13,7 +13,7 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: decodebin file_path"); + panic!("Usage: decodebin file_path") }; let pipeline = gst::Pipeline::new(None); diff --git a/examples/src/bin/launch.rs b/examples/src/bin/launch.rs index 20febb1ea..f7a273b8d 100644 --- a/examples/src/bin/launch.rs +++ b/examples/src/bin/launch.rs @@ -21,7 +21,7 @@ fn main() { println!("Failed to parse pipeline: {}", err); } - process::exit(-1); + process::exit(-1) } }; let bus = pipeline.get_bus().unwrap(); diff --git a/examples/src/bin/pad_probes.rs b/examples/src/bin/pad_probes.rs index 573a93b47..43d5cf35e 100644 --- a/examples/src/bin/pad_probes.rs +++ b/examples/src/bin/pad_probes.rs @@ -37,7 +37,7 @@ fn main() { let sum: f64 = samples .iter() .map(|sample| { - let f = (*sample as f64) / (i16::MAX as f64); + let f = f64::from(*sample) / f64::from(i16::MAX); f * f }) .sum(); diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 4f009e30b..b9dc502c9 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -13,7 +13,7 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: playbin uri"); + panic!("Usage: playbin uri") }; let playbin = gst::ElementFactory::make("playbin", None).unwrap(); diff --git a/examples/src/bin/player.rs b/examples/src/bin/player.rs index 6540dffb0..3f3376279 100644 --- a/examples/src/bin/player.rs +++ b/examples/src/bin/player.rs @@ -73,7 +73,7 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: player uri"); + panic!("Usage: player uri") }; match main_loop(uri) { diff --git a/examples/src/bin/toc.rs b/examples/src/bin/toc.rs index ff05648a3..fed9e0be2 100644 --- a/examples/src/bin/toc.rs +++ b/examples/src/bin/toc.rs @@ -13,7 +13,7 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: toc file_path"); + panic!("Usage: toc file_path") }; let pipeline = gst::Pipeline::new(None); @@ -61,7 +61,7 @@ fn main() { }; match msg.view() { - MessageView::Eos(..) => break, + MessageView::Eos(_) | MessageView::AsyncDone(_) => break, MessageView::Error(err) => { println!( "Error from {}: {} ({:?})", @@ -71,7 +71,6 @@ fn main() { ); break; } - MessageView::AsyncDone(_) => break, MessageView::Toc(msg_toc) => { let (toc, updated) = msg_toc.get_toc(); println!(