Commit b6d13272 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

Fix some clippy warnings in examples/tutorials

parent 2508f432
......@@ -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(),
......
......@@ -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(),
......
......@@ -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(),
......
......@@ -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();
......
......@@ -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")]
......
......@@ -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);
......
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment