Fix some clippy warnings in examples/tutorials

This commit is contained in:
Sebastian Dröge 2017-11-27 13:01:03 +02:00
parent 2508f432f4
commit b6d13272df
7 changed files with 13 additions and 13 deletions

View file

@ -142,7 +142,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
Err(ErrorMessage {
src: msg.get_src()
.map(|s| s.get_path_string())
.unwrap_or(String::from("None")),
.unwrap_or_else(|| String::from("None")),
error: err.get_error().description().into(),
debug: err.get_debug(),
cause: err.get_error(),

View file

@ -113,7 +113,7 @@ fn main_loop(pipeline: gst::Pipeline, appsrc: gst_app::AppSrc) -> Result<(), Err
Err(ErrorMessage {
src: msg.get_src()
.map(|s| s.get_path_string())
.unwrap_or(String::from("None")),
.unwrap_or_else(|| String::from("None")),
error: err.get_error().description().into(),
debug: err.get_debug(),
cause: err.get_error(),

View file

@ -39,7 +39,7 @@ fn example_main() -> Result<(), Error> {
args[1].as_ref()
} else {
println!("Usage: decodebin file_path");
std::process::exit(-1);
std::process::exit(-1)
};
let pipeline = gst::Pipeline::new(None);
@ -177,7 +177,7 @@ fn example_main() -> Result<(), Error> {
ErrorMessage {
src: msg.get_src()
.map(|s| s.get_path_string())
.unwrap_or(String::from("None")),
.unwrap_or_else(|| String::from("None")),
error: err.get_error().description().into(),
debug: err.get_debug(),
cause: err.get_error(),
@ -190,7 +190,7 @@ fn example_main() -> Result<(), Error> {
Err(ErrorMessage {
src: msg.get_src()
.map(|s| s.get_path_string())
.unwrap_or(String::from("None")),
.unwrap_or_else(|| String::from("None")),
error: err.get_error().description().into(),
debug: err.get_debug(),
cause: err.get_error(),

View file

@ -16,7 +16,7 @@ fn example_main() {
args[1].as_ref()
} else {
println!("Usage: playbin uri");
std::process::exit(-1);
std::process::exit(-1)
};
let playbin = gst::ElementFactory::make("playbin", None).unwrap();

View file

@ -75,13 +75,13 @@ fn example_main() {
args[1].as_ref()
} else {
println!("Usage: player uri");
std::process::exit(-1);
std::process::exit(-1)
};
#[cfg(not(feature = "gst-player"))]
{
eprintln!("Feature gst-player is required. Please rebuild with --features gst-player");
std::process::exit(-1);
std::process::exit(-1)
}
#[cfg(feature = "gst-player")]

View file

@ -16,7 +16,7 @@ fn example_main() {
args[1].as_ref()
} else {
println!("Usage: toc file_path");
std::process::exit(-1);
std::process::exit(-1)
};
let pipeline = gst::Pipeline::new(None);

View file

@ -144,7 +144,7 @@ fn main() {
let data: Arc<Mutex<CustomData>> = Arc::new(Mutex::new(CustomData::new(&appsrc, &appsink)));
let data_clone = data.clone();
let data_clone = Arc::clone(&data);
appsrc.connect_need_data(move |_, _size| {
let data = &data_clone;
let mut d = data.lock().unwrap();
@ -152,7 +152,7 @@ fn main() {
if d.source_id.is_none() {
println!("start feeding");
let data_clone = data.clone();
let data_clone = Arc::clone(data);
d.source_id = Some(glib::source::idle_add(move || {
let data = &data_clone;
@ -202,7 +202,7 @@ fn main() {
}
});
let data_clone = data.clone();
let data_clone = Arc::clone(&data);
appsrc.connect_enough_data(move |_| {
let data = &data_clone;
@ -217,7 +217,7 @@ fn main() {
appsink.set_emit_signals(true);
appsink.set_caps(&audio_caps);
let data_clone = data.clone();
let data_clone = Arc::clone(&data);
appsink.connect_new_sample(move |_| {
let appsink = {
let data = &data_clone.lock().unwrap();