From f24b38470be9cadf8465a7e217b5ab4e62a293e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 25 Jan 2023 10:09:45 +0200 Subject: [PATCH] Fix various new clippy warnings Part-of: --- examples/src/bin/appsink.rs | 6 +- examples/src/bin/appsrc.rs | 6 +- examples/src/bin/custom_events.rs | 5 +- examples/src/bin/custom_meta.rs | 4 +- examples/src/bin/debug_ringbuffer.rs | 4 +- examples/src/bin/decodebin.rs | 4 +- examples/src/bin/discoverer.rs | 8 +-- examples/src/bin/encodebin.rs | 4 +- examples/src/bin/fd_allocator.rs | 2 +- examples/src/bin/ges.rs | 4 +- examples/src/bin/glfilter.rs | 2 +- examples/src/bin/glwindow.rs | 2 +- examples/src/bin/gtkvideooverlay.rs | 2 +- examples/src/bin/launch.rs | 2 +- examples/src/bin/overlay-composition.rs | 4 +- examples/src/bin/pad_probes.rs | 2 +- examples/src/bin/pango-cairo.rs | 4 +- examples/src/bin/play.rs | 2 +- examples/src/bin/playbin.rs | 2 +- examples/src/bin/player.rs | 2 +- examples/src/bin/rtpfecclient.rs | 10 ++-- examples/src/bin/rtpfecserver.rs | 8 +-- examples/src/bin/rtsp-server-record.rs | 4 +- examples/src/bin/rtsp-server-subclass.rs | 10 ++-- examples/src/bin/rtsp-server.rs | 4 +- examples/src/bin/subclass.rs | 4 +- examples/src/bin/tagsetter.rs | 6 +- examples/src/bin/thumbnail.rs | 9 ++- examples/src/bin/toc.rs | 10 ++-- examples/src/bin/transmux.rs | 4 +- examples/src/glupload.rs | 8 +-- gstreamer-allocators/tests/check_gir.rs | 2 +- gstreamer-app/tests/check_gir.rs | 2 +- gstreamer-audio/src/audio_format_info.rs | 8 +-- gstreamer-audio/src/caps.rs | 2 +- gstreamer-audio/tests/check_gir.rs | 2 +- gstreamer-base/tests/check_gir.rs | 2 +- gstreamer-check/tests/check_gir.rs | 2 +- gstreamer-controller/tests/check_gir.rs | 2 +- gstreamer-editing-services/tests/check_gir.rs | 2 +- gstreamer-gl/egl/tests/check_gir.rs | 2 +- gstreamer-gl/src/gl_video_frame.rs | 12 ++-- gstreamer-gl/tests/check_gir.rs | 2 +- gstreamer-gl/wayland/tests/check_gir.rs | 2 +- gstreamer-gl/x11/tests/check_gir.rs | 2 +- gstreamer-mpegts/tests/check_gir.rs | 2 +- gstreamer-net/tests/check_gir.rs | 2 +- gstreamer-pbutils/tests/check_gir.rs | 2 +- gstreamer-play/tests/check_gir.rs | 2 +- gstreamer-player/tests/check_gir.rs | 2 +- gstreamer-rtp/tests/check_gir.rs | 2 +- gstreamer-rtsp-server/tests/check_gir.rs | 2 +- gstreamer-rtsp/tests/check_gir.rs | 2 +- gstreamer-sdp/src/sdp_media.rs | 2 +- gstreamer-sdp/src/sdp_message.rs | 2 +- gstreamer-sdp/tests/check_gir.rs | 2 +- gstreamer-tag/tests/check_gir.rs | 2 +- gstreamer-utils/src/streamproducer.rs | 4 +- gstreamer-video/src/video_format_info.rs | 12 ++-- gstreamer-video/src/video_meta.rs | 2 +- gstreamer-video/tests/check_gir.rs | 2 +- gstreamer-webrtc/tests/check_gir.rs | 2 +- gstreamer/src/caps.rs | 12 ++-- gstreamer/src/date_time_serde.rs | 3 +- gstreamer/src/error.rs | 7 +-- gstreamer/src/format/clock_time.rs | 56 +++++++++---------- gstreamer/src/format/mod.rs | 2 +- gstreamer/src/log.rs | 6 +- gstreamer/src/object.rs | 8 +-- gstreamer/src/pad.rs | 5 +- gstreamer/src/stream_collection.rs | 2 +- gstreamer/src/structure.rs | 2 +- gstreamer/src/subclass/error.rs | 2 +- gstreamer/src/tags.rs | 4 +- gstreamer/src/tags_serde.rs | 5 +- gstreamer/tests/check_gir.rs | 2 +- tutorials/src/bin/basic-tutorial-1.rs | 2 +- tutorials/src/bin/basic-tutorial-12.rs | 8 +-- tutorials/src/bin/basic-tutorial-13.rs | 8 +-- tutorials/src/bin/basic-tutorial-3.rs | 9 +-- tutorials/src/bin/basic-tutorial-4.rs | 7 +-- tutorials/src/bin/basic-tutorial-5.rs | 14 ++--- tutorials/src/bin/basic-tutorial-6.rs | 13 ++--- tutorials/src/bin/basic-tutorial-7.rs | 2 +- tutorials/src/bin/basic-tutorial-8.rs | 2 +- tutorials/src/bin/basic-tutorial-9.rs | 18 +++--- tutorials/src/bin/playback-tutorial-1.rs | 18 +++--- tutorials/src/bin/playback-tutorial-2.rs | 18 +++--- tutorials/src/bin/playback-tutorial-3.rs | 2 +- tutorials/src/bin/playback-tutorial-4.rs | 2 +- tutorials/src/bin/playback-tutorial-5.rs | 2 +- tutorials/src/bin/playback-tutorial-6.rs | 6 +- tutorials/src/bin/playback-tutorial-7.rs | 2 +- 93 files changed, 228 insertions(+), 259 deletions(-) diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index 7e111c7ca..d0cbbc8d7 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -21,7 +21,7 @@ use gst::{element_error, prelude::*}; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -107,7 +107,7 @@ fn create_pipeline() -> Result { }) .sum(); let rms = (sum / (samples.len() as f64)).sqrt(); - println!("rms: {}", rms); + println!("rms: {rms}"); Ok(gst::FlowSuccess::Ok) }) @@ -153,7 +153,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { fn example_main() { match create_pipeline().and_then(main_loop) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index 92ddba4ad..413a05902 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -18,7 +18,7 @@ use gst::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -75,7 +75,7 @@ fn create_pipeline() -> Result { return; } - println!("Producing frame {}", i); + println!("Producing frame {i}"); let r = if i % 2 == 0 { 0 } else { 255 }; let g = if i % 3 == 0 { 0 } else { 255 }; @@ -169,7 +169,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { fn example_main() { match create_pipeline().and_then(main_loop) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/custom_events.rs b/examples/src/bin/custom_events.rs index 704ca3c01..4e0a358b1 100644 --- a/examples/src/bin/custom_events.rs +++ b/examples/src/bin/custom_events.rs @@ -117,10 +117,7 @@ fn example_main() { Some(pipeline) => pipeline, None => return glib::Continue(false), }; - println!( - "Sending custom event to the pipeline with send_eos={}", - send_eos - ); + println!("Sending custom event to the pipeline with send_eos={send_eos}"); let ev = ExampleCustomEvent::new(*send_eos); if !pipeline.send_event(ev) { println!("Warning: Failed to send custom event"); diff --git a/examples/src/bin/custom_meta.rs b/examples/src/bin/custom_meta.rs index 19dcd3e0a..e4104951c 100644 --- a/examples/src/bin/custom_meta.rs +++ b/examples/src/bin/custom_meta.rs @@ -200,13 +200,13 @@ fn example_main() { return; } - println!("Producing buffer {}", i); + println!("Producing buffer {i}"); // Add a custom meta with a label to this buffer. let mut buffer = gst::Buffer::new(); { let buffer = buffer.get_mut().unwrap(); - custom_meta::CustomMeta::add(buffer, format!("This is buffer {}", i)); + custom_meta::CustomMeta::add(buffer, format!("This is buffer {i}")); } i += 1; diff --git a/examples/src/bin/debug_ringbuffer.rs b/examples/src/bin/debug_ringbuffer.rs index 44f1276b6..29522fb8c 100644 --- a/examples/src/bin/debug_ringbuffer.rs +++ b/examples/src/bin/debug_ringbuffer.rs @@ -33,7 +33,7 @@ fn example_main() { if let Some(gst::ParseError::NoSuchElement) = err.kind::() { println!("Missing element(s): {:?}", context.missing_elements()); } else { - println!("Failed to parse pipeline: {}", err); + println!("Failed to parse pipeline: {err}"); } process::exit(-1) @@ -74,7 +74,7 @@ fn example_main() { println!("Dumping debug logs\n"); for s in gst::debug_ring_buffer_logger_get_logs().iter() { - println!("{}\n------------------", s); + println!("{s}\n------------------"); } } diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index d38c3aef3..6cb091719 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -42,7 +42,7 @@ use gst::{element_error, element_warning, prelude::*}; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -264,6 +264,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/discoverer.rs b/examples/src/bin/discoverer.rs index 23f38e680..26dde8530 100644 --- a/examples/src/bin/discoverer.rs +++ b/examples/src/bin/discoverer.rs @@ -18,7 +18,7 @@ use gst_pbutils::{prelude::*, DiscovererInfo, DiscovererStreamInfo}; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Discoverer error {}", _0)] +#[display(fmt = "Discoverer error {_0}")] struct DiscovererError(#[error(not(source))] &'static str); fn print_tags(info: &DiscovererInfo) { @@ -27,7 +27,7 @@ fn print_tags(info: &DiscovererInfo) { let tags = info.tags(); match tags { Some(taglist) => { - println!(" {}", taglist); // FIXME use an iterator + println!(" {taglist}"); // FIXME use an iterator } None => { println!(" no tags"); @@ -42,7 +42,7 @@ fn print_stream_info(stream: &DiscovererStreamInfo) { Some(caps) => caps.to_string(), None => String::from("--"), }; - println!(" Format: {}", caps_str); + println!(" Format: {caps_str}"); } fn print_discoverer_info(info: &DiscovererInfo) -> Result<(), Error> { @@ -85,7 +85,7 @@ fn run_discoverer() -> Result<(), Error> { fn example_main() { match run_discoverer() { Ok(_) => (), - Err(e) => eprintln!("Error: {}", e), + Err(e) => eprintln!("Error: {e}"), } } diff --git a/examples/src/bin/encodebin.rs b/examples/src/bin/encodebin.rs index e43c3581d..f5cd7fb54 100644 --- a/examples/src/bin/encodebin.rs +++ b/examples/src/bin/encodebin.rs @@ -26,7 +26,7 @@ use gst_pbutils::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -281,6 +281,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/fd_allocator.rs b/examples/src/bin/fd_allocator.rs index 0b89a5f03..df10b6cde 100644 --- a/examples/src/bin/fd_allocator.rs +++ b/examples/src/bin/fd_allocator.rs @@ -341,7 +341,7 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/ges.rs b/examples/src/bin/ges.rs index 90bc10e1a..ed40dab50 100644 --- a/examples/src/bin/ges.rs +++ b/examples/src/bin/ges.rs @@ -63,7 +63,7 @@ fn configure_pipeline(pipeline: &ges::Pipeline, output_name: &str) { .build(); // Apply the EncodingProfile to the pipeline, and set it to render mode - let output_uri = format!("{}.webm", output_name); + let output_uri = format!("{output_name}.webm"); pipeline .set_render_settings(&output_uri, &container_profile) .expect("Failed to set render settings"); @@ -168,7 +168,7 @@ fn example_main() { match main_loop(input_uri, output) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/glfilter.rs b/examples/src/bin/glfilter.rs index f6b5b5000..d9ba595c7 100644 --- a/examples/src/bin/glfilter.rs +++ b/examples/src/bin/glfilter.rs @@ -166,7 +166,7 @@ fn example_main() { let glfilter = mirror::GLMirrorFilter::new(Some("foo")); App::new(Some(glfilter.as_ref())) .and_then(main_loop) - .unwrap_or_else(|e| eprintln!("Error! {}", e)) + .unwrap_or_else(|e| eprintln!("Error! {e}")) } fn main() { diff --git a/examples/src/bin/glwindow.rs b/examples/src/bin/glwindow.rs index 93c71bf32..8ccaae4b2 100644 --- a/examples/src/bin/glwindow.rs +++ b/examples/src/bin/glwindow.rs @@ -10,7 +10,7 @@ pub mod examples_common; fn example_main() { App::new(None) .and_then(main_loop) - .unwrap_or_else(|e| eprintln!("Error! {}", e)) + .unwrap_or_else(|e| eprintln!("Error! {e}")) } fn main() { diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index 6d460f449..5662c0991 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -53,7 +53,7 @@ fn set_window_handle(video_overlay: &gst_video::VideoOverlay, gdk_window: &gdk:: video_overlay.set_window_handle(xid as usize); } } else { - println!("Add support for display type '{}'", display_type_name); + println!("Add support for display type '{display_type_name}'"); process::exit(-1); } } diff --git a/examples/src/bin/launch.rs b/examples/src/bin/launch.rs index ecff96f08..05c28458f 100644 --- a/examples/src/bin/launch.rs +++ b/examples/src/bin/launch.rs @@ -33,7 +33,7 @@ fn example_main() { if let Some(gst::ParseError::NoSuchElement) = err.kind::() { println!("Missing element(s): {:?}", context.missing_elements()); } else { - println!("Failed to parse pipeline: {}", err); + println!("Failed to parse pipeline: {err}"); } process::exit(-1) diff --git a/examples/src/bin/overlay-composition.rs b/examples/src/bin/overlay-composition.rs index 36c2e6339..156a387a2 100644 --- a/examples/src/bin/overlay-composition.rs +++ b/examples/src/bin/overlay-composition.rs @@ -22,7 +22,7 @@ use pango::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -293,7 +293,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { fn example_main() { match create_pipeline().and_then(main_loop) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/pad_probes.rs b/examples/src/bin/pad_probes.rs index 4cc1095a9..8dbaa58b7 100644 --- a/examples/src/bin/pad_probes.rs +++ b/examples/src/bin/pad_probes.rs @@ -66,7 +66,7 @@ fn example_main() { }) .sum(); let rms = (sum / (samples.len() as f64)).sqrt(); - println!("rms: {}", rms); + println!("rms: {rms}"); } gst::PadProbeReturn::Ok diff --git a/examples/src/bin/pango-cairo.rs b/examples/src/bin/pango-cairo.rs index a9b391fa2..968dca947 100644 --- a/examples/src/bin/pango-cairo.rs +++ b/examples/src/bin/pango-cairo.rs @@ -25,7 +25,7 @@ use pango::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -237,7 +237,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { fn example_main() { match create_pipeline().and_then(main_loop) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/play.rs b/examples/src/bin/play.rs index bbf3b73d2..d18a663f0 100644 --- a/examples/src/bin/play.rs +++ b/examples/src/bin/play.rs @@ -51,7 +51,7 @@ fn example_main() { match main_loop(uri) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 92d2452bd..70885009e 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -65,7 +65,7 @@ fn example_main() { .get::() .expect("playbin \"audio-tags-changed\" signal values[1]"); - println!("audio tags of audio stream {} changed:", idx); + println!("audio tags of audio stream {idx} changed:"); // HELP: is this correct? // We were only notified about the change of metadata. If we want to do diff --git a/examples/src/bin/player.rs b/examples/src/bin/player.rs index 09f23f727..cde991715 100644 --- a/examples/src/bin/player.rs +++ b/examples/src/bin/player.rs @@ -76,7 +76,7 @@ fn example_main() { match main_loop(uri) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/rtpfecclient.rs b/examples/src/bin/rtpfecclient.rs index 365934b38..4f6a29b59 100644 --- a/examples/src/bin/rtpfecclient.rs +++ b/examples/src/bin/rtpfecclient.rs @@ -9,19 +9,19 @@ use anyhow::Error; use derive_more::{Display, Error}; #[derive(Debug, Display, Error)] -#[display(fmt = "No such pad {} in {}", _0, _1)] +#[display(fmt = "No such pad {_0} in {_1}")] struct NoSuchPad(#[error(not(source))] &'static str, String); #[derive(Debug, Display, Error)] -#[display(fmt = "Unknown payload type {}", _0)] +#[display(fmt = "Unknown payload type {_0}")] struct UnknownPT(#[error(not(source))] u32); #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {} (play | record) DROP_PROBABILITY", _0)] +#[display(fmt = "Usage: {_0} (play | record) DROP_PROBABILITY")] struct UsageError(#[error(not(source))] String); #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -275,6 +275,6 @@ fn example_main() -> Result<(), Error> { fn main() { match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/rtpfecserver.rs b/examples/src/bin/rtpfecserver.rs index 3f9fe4df2..ee511df27 100644 --- a/examples/src/bin/rtpfecserver.rs +++ b/examples/src/bin/rtpfecserver.rs @@ -9,15 +9,15 @@ use anyhow::Error; use derive_more::{Display, Error}; #[derive(Debug, Display, Error)] -#[display(fmt = "No such pad {} in {}", _0, _1)] +#[display(fmt = "No such pad {_0} in {_1}")] struct NoSuchPad(&'static str, String); #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {} URI FEC_PERCENTAGE", _0)] +#[display(fmt = "Usage: {_0} URI FEC_PERCENTAGE")] struct UsageError(#[error(not(source))] String); #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -201,6 +201,6 @@ fn example_main() -> Result<(), Error> { fn main() { match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/rtsp-server-record.rs b/examples/src/bin/rtsp-server-record.rs index 669d2eeb8..4de6f4609 100644 --- a/examples/src/bin/rtsp-server-record.rs +++ b/examples/src/bin/rtsp-server-record.rs @@ -19,7 +19,7 @@ mod examples_common; struct NoMountPoints; #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {} LAUNCH_LINE", _0)] +#[display(fmt = "Usage: {_0} LAUNCH_LINE")] struct UsageError(#[error(not(source))] String); fn main_loop() -> Result<(), Error> { @@ -152,6 +152,6 @@ fn example_main() -> Result<(), Error> { fn main() { match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/rtsp-server-subclass.rs b/examples/src/bin/rtsp-server-subclass.rs index 7726391ef..f54c72aa6 100644 --- a/examples/src/bin/rtsp-server-subclass.rs +++ b/examples/src/bin/rtsp-server-subclass.rs @@ -20,7 +20,7 @@ mod examples_common; struct NoMountPoints; #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {} LAUNCH_LINE", _0)] +#[display(fmt = "Usage: {_0} LAUNCH_LINE")] struct UsageError(#[error(not(source))] String); fn main_loop() -> Result<(), Error> { @@ -252,7 +252,7 @@ mod server { fn client_connected(&self, client: &gst_rtsp_server::RTSPClient) { self.parent_client_connected(client); - println!("Client {:?} connected", client); + println!("Client {client:?} connected"); } } } @@ -301,7 +301,7 @@ mod client { fn closed(&self) { let client = self.obj(); self.parent_closed(); - println!("Client {:?} closed", client); + println!("Client {client:?} closed"); } } } @@ -346,7 +346,7 @@ mod mount_points { // Implementation of gst_rtsp_server::RTSPClient virtual methods impl RTSPMountPointsImpl for MountPoints { fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option { - println!("Make path called for {:?} ", url); + println!("Make path called for {url:?} "); self.parent_make_path(url) } } @@ -372,6 +372,6 @@ fn example_main() -> Result<(), Error> { fn main() { match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/rtsp-server.rs b/examples/src/bin/rtsp-server.rs index e7483eece..404f66294 100644 --- a/examples/src/bin/rtsp-server.rs +++ b/examples/src/bin/rtsp-server.rs @@ -17,7 +17,7 @@ mod examples_common; struct NoMountPoints; #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {} LAUNCH_LINE", _0)] +#[display(fmt = "Usage: {_0} LAUNCH_LINE")] struct UsageError(#[error(not(source))] String); fn main_loop() -> Result<(), Error> { @@ -89,6 +89,6 @@ fn example_main() -> Result<(), Error> { fn main() { match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/subclass.rs b/examples/src/bin/subclass.rs index 45f14712d..77bfd925d 100644 --- a/examples/src/bin/subclass.rs +++ b/examples/src/bin/subclass.rs @@ -229,7 +229,7 @@ mod fir_filter { } #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -321,7 +321,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { fn example_main() { match create_pipeline().and_then(main_loop) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/tagsetter.rs b/examples/src/bin/tagsetter.rs index 48f521151..9e31f03fe 100644 --- a/examples/src/bin/tagsetter.rs +++ b/examples/src/bin/tagsetter.rs @@ -26,11 +26,11 @@ use gst::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Missing element {}", _0)] +#[display(fmt = "Missing element {_0}")] struct MissingElement(#[error(not(source))] String); #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -112,6 +112,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/thumbnail.rs b/examples/src/bin/thumbnail.rs index caff63361..29f204e38 100644 --- a/examples/src/bin/thumbnail.rs +++ b/examples/src/bin/thumbnail.rs @@ -15,7 +15,7 @@ use gst::{element_error, prelude::*}; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -27,8 +27,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result() .expect("Expected a gst::Pipeline"); @@ -174,7 +173,7 @@ fn main_loop(pipeline: gst::Pipeline, position: u64) -> Result<(), Error> { MessageView::AsyncDone(..) => { if !seeked { // AsyncDone means that the pipeline has started now and that we can seek - println!("Got AsyncDone message, seeking to {}s", position); + println!("Got AsyncDone message, seeking to {position}s"); if pipeline .seek_simple(gst::SeekFlags::FLUSH, position * gst::ClockTime::SECOND) @@ -240,7 +239,7 @@ fn example_main() { match create_pipeline(uri, out_path).and_then(|pipeline| main_loop(pipeline, position)) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/bin/toc.rs b/examples/src/bin/toc.rs index bef7dff50..ef81f38c8 100644 --- a/examples/src/bin/toc.rs +++ b/examples/src/bin/toc.rs @@ -109,7 +109,7 @@ fn example_main() { println!("\nReceived toc: {:?} - updated: {}", toc.scope(), updated); // Get a list of tags that are ToC specific. if let Some(tags) = toc.tags() { - println!("- tags: {}", tags); + println!("- tags: {tags}"); } // ToCs do not have a fixed structure. Depending on the format that // they were parsed from, they might have different tree-like structures, @@ -124,11 +124,11 @@ fn example_main() { println!("\t{:?} - {}", toc_entry.entry_type(), toc_entry.uid()); // Every ToC entry can have a set of timestamps (start, stop). if let Some((start, stop)) = toc_entry.start_stop_times() { - println!("\t- start: {}, stop: {}", start, stop); + println!("\t- start: {start}, stop: {stop}"); } // Every ToC entry can have tags to it. if let Some(tags) = toc_entry.tags() { - println!("\t- tags: {}", tags); + println!("\t- tags: {tags}"); } // Every ToC entry can have a set of child entries. // With this structure, you can create trees of arbitrary depth. @@ -139,10 +139,10 @@ fn example_main() { toc_sub_entry.uid() ); if let Some((start, stop)) = toc_sub_entry.start_stop_times() { - println!("\t\t- start: {}, stop: {}", start, stop); + println!("\t\t- start: {start}, stop: {stop}"); } if let Some(tags) = toc_sub_entry.tags() { - println!("\t\t- tags: {}", tags); + println!("\t\t- tags: {tags}"); } } } diff --git a/examples/src/bin/transmux.rs b/examples/src/bin/transmux.rs index a1127842d..a8248099b 100644 --- a/examples/src/bin/transmux.rs +++ b/examples/src/bin/transmux.rs @@ -27,7 +27,7 @@ use gst::{element_error, prelude::*}; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -212,6 +212,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match examples_common::run(example_main) { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/examples/src/glupload.rs b/examples/src/glupload.rs index a5158fecb..fde98e778 100644 --- a/examples/src/glupload.rs +++ b/examples/src/glupload.rs @@ -12,7 +12,7 @@ use gst::element_error; use gst_gl::prelude::*; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, @@ -189,7 +189,7 @@ fn load(gl_context: &glutin::WindowedContext) -> Gl { String::from_utf8(data).unwrap() }; - println!("OpenGL version {}", version); + println!("OpenGL version {version}"); let (program, attr_position, attr_texture, vao, vertex_buffer, vbo_indices) = unsafe { let vs = gl.CreateShader(gl::VERTEX_SHADER); @@ -390,7 +390,7 @@ impl App { ) } #[allow(unreachable_patterns)] - handler => panic!("Unsupported platform: {:?}.", handler), + handler => panic!("Unsupported platform: {handler:?}."), }; shared_context = @@ -438,7 +438,7 @@ impl App { } if let Err(e) = event_proxy.lock().unwrap().send_event(Message::BusEvent) { - eprintln!("Failed to send BusEvent to event proxy: {}", e) + eprintln!("Failed to send BusEvent to event proxy: {e}") } gst::BusSyncReply::Pass diff --git a/gstreamer-allocators/tests/check_gir.rs b/gstreamer-allocators/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-allocators/tests/check_gir.rs +++ b/gstreamer-allocators/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-app/tests/check_gir.rs b/gstreamer-app/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-app/tests/check_gir.rs +++ b/gstreamer-app/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index abad9f986..5af638e25 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -108,12 +108,12 @@ impl AudioFormatInfo { let unpack_width = unpack_format.width() as usize; if unpack_width == 0 || self.0.unpack_func.is_none() { - panic!("No unpack format for {:?}", self); + panic!("No unpack format for {self:?}"); } let self_width = self.width() as usize; if self_width == 0 { - panic!("No width for {:?}", self); + panic!("No width for {self:?}"); } if src.len() % (self_width / 8) != 0 { @@ -142,12 +142,12 @@ impl AudioFormatInfo { let unpack_width = unpack_format.width() as usize; if unpack_width == 0 || self.0.pack_func.is_none() { - panic!("No unpack format for {:?}", self); + panic!("No unpack format for {self:?}"); } let self_width = self.width() as usize; if self_width == 0 { - panic!("No width for {:?}", self); + panic!("No width for {self:?}"); } if src.len() % (unpack_width / 8) != 0 { diff --git a/gstreamer-audio/src/caps.rs b/gstreamer-audio/src/caps.rs index 0ecea2225..072005fd2 100644 --- a/gstreamer-audio/src/caps.rs +++ b/gstreamer-audio/src/caps.rs @@ -141,7 +141,7 @@ impl AudioCapsBuilder { gst::Bitmask::new(crate::AudioChannelPosition::fallback_mask(channels as u32)), ), }, - Err(e) => panic!("{:?}", e), + Err(e) => panic!("{e:?}"), } } diff --git a/gstreamer-audio/tests/check_gir.rs b/gstreamer-audio/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-audio/tests/check_gir.rs +++ b/gstreamer-audio/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-base/tests/check_gir.rs b/gstreamer-base/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-base/tests/check_gir.rs +++ b/gstreamer-base/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-check/tests/check_gir.rs b/gstreamer-check/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-check/tests/check_gir.rs +++ b/gstreamer-check/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-controller/tests/check_gir.rs b/gstreamer-controller/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-controller/tests/check_gir.rs +++ b/gstreamer-controller/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-editing-services/tests/check_gir.rs b/gstreamer-editing-services/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-editing-services/tests/check_gir.rs +++ b/gstreamer-editing-services/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-gl/egl/tests/check_gir.rs b/gstreamer-gl/egl/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-gl/egl/tests/check_gir.rs +++ b/gstreamer-gl/egl/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-gl/src/gl_video_frame.rs b/gstreamer-gl/src/gl_video_frame.rs index 68b8313db..71f2d5676 100644 --- a/gstreamer-gl/src/gl_video_frame.rs +++ b/gstreamer-gl/src/gl_video_frame.rs @@ -11,9 +11,9 @@ pub trait VideoFrameGLExt { info: &gst_video::VideoInfo, ) -> Result, gst::Buffer>; - fn from_buffer_ref_readable_gl<'a, 'b>( + fn from_buffer_ref_readable_gl<'a>( buffer: &'a gst::BufferRef, - info: &'b gst_video::VideoInfo, + info: &gst_video::VideoInfo, ) -> Result, glib::error::BoolError>; #[doc(alias = "get_texture_id")] @@ -29,9 +29,9 @@ impl VideoFrameGLExt for gst_video::VideoFrame { gst_video::VideoFrameRef::<&gst::BufferRef>::from_buffer_readable_gl(buffer, info) } - fn from_buffer_ref_readable_gl<'a, 'b>( + fn from_buffer_ref_readable_gl<'a>( buffer: &'a gst::BufferRef, - info: &'b gst_video::VideoInfo, + info: &gst_video::VideoInfo, ) -> Result, glib::error::BoolError> { skip_assert_initialized!(); gst_video::VideoFrameRef::<&gst::BufferRef>::from_buffer_ref_readable_gl(buffer, info) @@ -87,9 +87,9 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> { } } - fn from_buffer_ref_readable_gl<'b, 'c>( + fn from_buffer_ref_readable_gl<'b>( buffer: &'b gst::BufferRef, - info: &'c gst_video::VideoInfo, + info: &gst_video::VideoInfo, ) -> Result, glib::error::BoolError> { skip_assert_initialized!(); diff --git a/gstreamer-gl/tests/check_gir.rs b/gstreamer-gl/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-gl/tests/check_gir.rs +++ b/gstreamer-gl/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-gl/wayland/tests/check_gir.rs b/gstreamer-gl/wayland/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-gl/wayland/tests/check_gir.rs +++ b/gstreamer-gl/wayland/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-gl/x11/tests/check_gir.rs b/gstreamer-gl/x11/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-gl/x11/tests/check_gir.rs +++ b/gstreamer-gl/x11/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-mpegts/tests/check_gir.rs b/gstreamer-mpegts/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-mpegts/tests/check_gir.rs +++ b/gstreamer-mpegts/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-net/tests/check_gir.rs b/gstreamer-net/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-net/tests/check_gir.rs +++ b/gstreamer-net/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-pbutils/tests/check_gir.rs b/gstreamer-pbutils/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-pbutils/tests/check_gir.rs +++ b/gstreamer-pbutils/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-play/tests/check_gir.rs b/gstreamer-play/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-play/tests/check_gir.rs +++ b/gstreamer-play/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-player/tests/check_gir.rs b/gstreamer-player/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-player/tests/check_gir.rs +++ b/gstreamer-player/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-rtp/tests/check_gir.rs b/gstreamer-rtp/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-rtp/tests/check_gir.rs +++ b/gstreamer-rtp/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-rtsp-server/tests/check_gir.rs b/gstreamer-rtsp-server/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-rtsp-server/tests/check_gir.rs +++ b/gstreamer-rtsp-server/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-rtsp/tests/check_gir.rs b/gstreamer-rtsp/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-rtsp/tests/check_gir.rs +++ b/gstreamer-rtsp/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-sdp/src/sdp_media.rs b/gstreamer-sdp/src/sdp_media.rs index fc5ef43f0..8717aada4 100644 --- a/gstreamer-sdp/src/sdp_media.rs +++ b/gstreamer-sdp/src/sdp_media.rs @@ -782,6 +782,6 @@ mod tests { init(); let sdp = SDPMedia::new(); - assert!(!format!("{:?}", sdp).is_empty()); + assert!(!format!("{sdp:?}").is_empty()); } } diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index 31e988dec..ca81df353 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -1284,6 +1284,6 @@ mod tests { init(); let sdp = SDPMessage::new(); - assert!(!format!("{:?}", sdp).is_empty()); + assert!(!format!("{sdp:?}").is_empty()); } } diff --git a/gstreamer-sdp/tests/check_gir.rs b/gstreamer-sdp/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-sdp/tests/check_gir.rs +++ b/gstreamer-sdp/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-tag/tests/check_gir.rs b/gstreamer-tag/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-tag/tests/check_gir.rs +++ b/gstreamer-tag/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-utils/src/streamproducer.rs b/gstreamer-utils/src/streamproducer.rs index abb8a9f93..705063ebc 100644 --- a/gstreamer-utils/src/streamproducer.rs +++ b/gstreamer-utils/src/streamproducer.rs @@ -583,7 +583,7 @@ mod tests { impl Consumer { fn new(id: &str) -> Self { - let pipeline = gst::parse_launch(&format!("appsrc name={} ! appsink name=sink", id)) + let pipeline = gst::parse_launch(&format!("appsrc name={id} ! appsink name=sink")) .unwrap() .downcast::() .unwrap(); @@ -676,7 +676,7 @@ mod tests { assert!(producer.last_sample().is_none()); for i in 0..10 { - let caps = gst::Caps::from_str(&format!("test,n={}", i)).unwrap(); + let caps = gst::Caps::from_str(&format!("test,n={i}")).unwrap(); producer_src.set_caps(Some(&caps)); producer_src.push_buffer(gst::Buffer::new()).unwrap(); diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index b69f9f2b9..ed9a74009 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -194,7 +194,7 @@ impl VideoFormatInfo { let unpack_format = Self::from_format(self.unpack_format()); if unpack_format.pixel_stride()[0] == 0 || self.0.unpack_func.is_none() { - panic!("No unpack format for {:?}", self); + panic!("No unpack format for {self:?}"); } if src.len() != self.n_planes() as usize { @@ -222,7 +222,7 @@ impl VideoFormatInfo { < self.scale_width(plane as u8, width as u32) as i32 * self.pixel_stride()[plane as usize] { - panic!("Too small source stride for plane {}", plane); + panic!("Too small source stride for plane {plane}"); } let plane_size = y * stride[plane as usize] @@ -230,7 +230,7 @@ impl VideoFormatInfo { * self.pixel_stride()[plane as usize]; if src[plane as usize].len() < plane_size as usize { - panic!("Too small source plane size for plane {}", plane); + panic!("Too small source plane size for plane {plane}"); } } @@ -270,7 +270,7 @@ impl VideoFormatInfo { let unpack_format = Self::from_format(self.unpack_format()); if unpack_format.pixel_stride()[0] == 0 || self.0.unpack_func.is_none() { - panic!("No unpack format for {:?}", self); + panic!("No unpack format for {self:?}"); } if dest.len() != self.n_planes() as usize { @@ -298,7 +298,7 @@ impl VideoFormatInfo { < self.scale_width(plane as u8, width as u32) as i32 * self.pixel_stride()[plane as usize] { - panic!("Too small destination stride for plane {}", plane); + panic!("Too small destination stride for plane {plane}"); } let plane_size = y * dest_stride[plane as usize] @@ -306,7 +306,7 @@ impl VideoFormatInfo { * self.pixel_stride()[plane as usize]; if dest[plane as usize].len() < plane_size as usize { - panic!("Too small destination plane size for plane {}", plane); + panic!("Too small destination plane size for plane {plane}"); } } diff --git a/gstreamer-video/src/video_meta.rs b/gstreamer-video/src/video_meta.rs index 7fce12c35..e1634f223 100644 --- a/gstreamer-video/src/video_meta.rs +++ b/gstreamer-video/src/video_meta.rs @@ -383,7 +383,7 @@ impl VideoRegionOfInterestMeta { #[doc(alias = "get_param")] #[inline] - pub fn param<'b>(&self, name: &'b str) -> Option<&gst::StructureRef> { + pub fn param<'b>(&'b self, name: &str) -> Option<&'b gst::StructureRef> { self.params().find(|s| s.name() == name) } diff --git a/gstreamer-video/tests/check_gir.rs b/gstreamer-video/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-video/tests/check_gir.rs +++ b/gstreamer-video/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer-webrtc/tests/check_gir.rs b/gstreamer-webrtc/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer-webrtc/tests/check_gir.rs +++ b/gstreamer-webrtc/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index f1b180d78..028c39d12 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -1243,7 +1243,7 @@ mod tests { crate::init().unwrap(); let caps = Caps::builder("foo/bar").build(); - format!("{}", caps); + format!("{caps}"); } #[test] @@ -1344,15 +1344,15 @@ mod tests { crate::init().unwrap(); let caps = Caps::new_any(); - assert_eq!(format!("{:?}", caps), "Caps(\"ANY\")"); + assert_eq!(format!("{caps:?}"), "Caps(\"ANY\")"); let caps = Caps::new_empty(); - assert_eq!(format!("{:?}", caps), "Caps(\"EMPTY\")"); + assert_eq!(format!("{caps:?}"), "Caps(\"EMPTY\")"); let caps = Caps::builder_full_with_any_features() .structure(Structure::builder("audio/x-raw").build()) .build(); - assert_eq!(format!("{:?}", caps), "Caps(audio/x-raw(ANY))"); + assert_eq!(format!("{caps:?}"), "Caps(audio/x-raw(ANY))"); let caps = Caps::builder_full_with_features(CapsFeatures::new(["foo:bla"])) .structure( @@ -1370,7 +1370,7 @@ mod tests { ) .build(); - assert_eq!(format!("{:?}", caps), "Caps(audio/x-raw(foo:bla) { struct: Structure(nested { badger: (gboolean) TRUE }) }, video/x-raw(foo:bla) { width: (guint) 800 })"); + assert_eq!(format!("{caps:?}"), "Caps(audio/x-raw(foo:bla) { struct: Structure(nested { badger: (gboolean) TRUE }) }, video/x-raw(foo:bla) { width: (guint) 800 })"); let caps = Caps::builder_full() .structure( @@ -1381,6 +1381,6 @@ mod tests { ) .build(); - assert_eq!(format!("{:?}", caps), "Caps(video/x-raw(memory:SystemMemory) { array: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), list: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })"); + assert_eq!(format!("{caps:?}"), "Caps(video/x-raw(memory:SystemMemory) { array: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), list: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })"); } } diff --git a/gstreamer/src/date_time_serde.rs b/gstreamer/src/date_time_serde.rs index 5268a96cc..9e4af2f78 100644 --- a/gstreamer/src/date_time_serde.rs +++ b/gstreamer/src/date_time_serde.rs @@ -111,8 +111,7 @@ impl Serialize for DateTime { DateTimeVariants::Y(self.year()) } else { return Err(ser::Error::custom(format!( - "no parts could be found in `DateTime` {}", - self, + "no parts could be found in `DateTime` {self}", ))); }; diff --git a/gstreamer/src/error.rs b/gstreamer/src/error.rs index 0a8d58139..92e2d2a2c 100644 --- a/gstreamer/src/error.rs +++ b/gstreamer/src/error.rs @@ -192,7 +192,7 @@ mod tests { 7, ); assert_eq!( - format!("{}", e), + format!("{e}"), "Error Some(\"message\") (Some(\"debug\")) at filename:7" ); } @@ -202,9 +202,6 @@ mod tests { crate::init().unwrap(); let e: LoggableError = glib::BoolError::new("msg", "filename", "function", 7).into(); - assert_eq!( - format!("{}", e), - "Error \"GST_RUST\": \"msg\" at filename:7" - ); + assert_eq!(format!("{e}"), "Error \"GST_RUST\": \"msg\" at filename:7"); } } diff --git a/gstreamer/src/format/clock_time.rs b/gstreamer/src/format/clock_time.rs index b018ca62d..4504272b6 100644 --- a/gstreamer/src/format/clock_time.rs +++ b/gstreamer/src/format/clock_time.rs @@ -518,17 +518,17 @@ fn write_clocktime( let (h, m) = num_integer::div_rem(m, 60); // Write HH:MM:SS - write!(writer, "{}:{:02}:{:02}", h, m, s)?; + write!(writer, "{h}:{m:02}:{s:02}")?; if precision > 0 { // Format the nanoseconds into a stack-allocated string // The value is zero-padded so always 9 digits long let mut buf = [0u8; 9]; - write!(&mut buf[..], "{:09}", ns).unwrap(); + write!(&mut buf[..], "{ns:09}").unwrap(); let buf_str = std::str::from_utf8(&buf[..]).unwrap(); // Write decimal point and a prefix of the nanoseconds for more precision - write!(writer, ".{:.p$}", buf_str, p = precision)?; + write!(writer, ".{buf_str:.precision$}")?; } } else { // Undefined time @@ -1152,9 +1152,9 @@ mod tests { "12:43:54.908569837" ); - assert_eq!(format!("{:.0}", lots), "5124095:34:33"); - assert_eq!(format!("{:.3}", lots), "5124095:34:33.709"); - assert_eq!(format!("{}", lots), "5124095:34:33.709551614"); + assert_eq!(format!("{lots:.0}"), "5124095:34:33"); + assert_eq!(format!("{lots:.3}"), "5124095:34:33.709"); + assert_eq!(format!("{lots}"), "5124095:34:33.709551614"); // Precision caps at 9 assert_eq!( @@ -1165,7 +1165,7 @@ mod tests { format!("{:.10}", DisplayableOptClockTime(some)), "12:43:54.908569837" ); - assert_eq!(format!("{:.10}", lots), "5124095:34:33.709551614"); + assert_eq!(format!("{lots:.10}"), "5124095:34:33.709551614"); // Short width @@ -1189,9 +1189,9 @@ mod tests { "12:43:54.908569837" ); - assert_eq!(format!("{:4.0}", lots), "5124095:34:33"); - assert_eq!(format!("{:4.3}", lots), "5124095:34:33.709"); - assert_eq!(format!("{:4}", lots), "5124095:34:33.709551614"); + assert_eq!(format!("{lots:4.0}"), "5124095:34:33"); + assert_eq!(format!("{lots:4.3}"), "5124095:34:33.709"); + assert_eq!(format!("{lots:4}"), "5124095:34:33.709551614"); // Simple padding @@ -1269,15 +1269,15 @@ mod tests { " 12:43:54.908569837 " ); - assert_eq!(format!("{:>14.0}", lots), " 5124095:34:33"); - assert_eq!(format!("{:<14.0}", lots), "5124095:34:33 "); - assert_eq!(format!("{:^15.0}", lots), " 5124095:34:33 "); - assert_eq!(format!("{:>18.3}", lots), " 5124095:34:33.709"); - assert_eq!(format!("{:<18.3}", lots), "5124095:34:33.709 "); - assert_eq!(format!("{:^19.3}", lots), " 5124095:34:33.709 "); - assert_eq!(format!("{:>24}", lots), " 5124095:34:33.709551614"); - assert_eq!(format!("{:<24}", lots), "5124095:34:33.709551614 "); - assert_eq!(format!("{:^25}", lots), " 5124095:34:33.709551614 "); + assert_eq!(format!("{lots:>14.0}"), " 5124095:34:33"); + assert_eq!(format!("{lots:<14.0}"), "5124095:34:33 "); + assert_eq!(format!("{lots:^15.0}"), " 5124095:34:33 "); + assert_eq!(format!("{lots:>18.3}"), " 5124095:34:33.709"); + assert_eq!(format!("{lots:<18.3}"), "5124095:34:33.709 "); + assert_eq!(format!("{lots:^19.3}"), " 5124095:34:33.709 "); + assert_eq!(format!("{lots:>24}"), " 5124095:34:33.709551614"); + assert_eq!(format!("{lots:<24}"), "5124095:34:33.709551614 "); + assert_eq!(format!("{lots:^25}"), " 5124095:34:33.709551614 "); // Padding with sign or zero-extension @@ -1355,15 +1355,15 @@ mod tests { "+0012:43:54.908569837" ); - assert_eq!(format!("{:+16.0}", lots), " +5124095:34:33"); - assert_eq!(format!("{:016.0}", lots), "0005124095:34:33"); - assert_eq!(format!("{:+016.0}", lots), "+005124095:34:33"); - assert_eq!(format!("{:+20.3}", lots), " +5124095:34:33.709"); - assert_eq!(format!("{:020.3}", lots), "0005124095:34:33.709"); - assert_eq!(format!("{:+020.3}", lots), "+005124095:34:33.709"); - assert_eq!(format!("{:+26}", lots), " +5124095:34:33.709551614"); - assert_eq!(format!("{:026}", lots), "0005124095:34:33.709551614"); - assert_eq!(format!("{:+026}", lots), "+005124095:34:33.709551614"); + assert_eq!(format!("{lots:+16.0}"), " +5124095:34:33"); + assert_eq!(format!("{lots:016.0}"), "0005124095:34:33"); + assert_eq!(format!("{lots:+016.0}"), "+005124095:34:33"); + assert_eq!(format!("{lots:+20.3}"), " +5124095:34:33.709"); + assert_eq!(format!("{lots:020.3}"), "0005124095:34:33.709"); + assert_eq!(format!("{lots:+020.3}"), "+005124095:34:33.709"); + assert_eq!(format!("{lots:+26}"), " +5124095:34:33.709551614"); + assert_eq!(format!("{lots:026}"), "0005124095:34:33.709551614"); + assert_eq!(format!("{lots:+026}"), "+005124095:34:33.709551614"); } #[test] diff --git a/gstreamer/src/format/mod.rs b/gstreamer/src/format/mod.rs index b8446478a..87cf07903 100644 --- a/gstreamer/src/format/mod.rs +++ b/gstreamer/src/format/mod.rs @@ -619,7 +619,7 @@ impl fmt::Display for Format { Self::Time => f.write_str("time"), Self::Buffers => f.write_str("buffers"), Self::Percent => f.write_str("%"), - Self::__Unknown(format) => write!(f, "(format: {})", format), + Self::__Unknown(format) => write!(f, "(format: {format})"), } } } diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index a338647c5..15ce8cba0 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -1121,7 +1121,7 @@ impl fmt::Display for LoggedObject { } }; - write!(f, "{}:{}", parent_name, name) + write!(f, "{parent_name}:{name}") } else if glib::gobject_ffi::g_type_is_a(type_, ffi::gst_object_get_type()) != glib::ffi::GFALSE { @@ -1133,7 +1133,7 @@ impl fmt::Display for LoggedObject { .to_str() .unwrap_or("") }; - write!(f, "{}", name) + write!(f, "{name}") } else { let type_name = CStr::from_ptr(glib::gobject_ffi::g_type_name(type_)); write!( @@ -1144,7 +1144,7 @@ impl fmt::Display for LoggedObject { ) } } else { - write!(f, "{:?}", ptr) + write!(f, "{ptr:?}") } } } diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index a827b6742..e308a3028 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -39,7 +39,7 @@ impl> GstObjectExtManual for O { f: F, ) -> SignalHandlerId { let signal_name = if let Some(name) = name { - format!("deep-notify::{}", name) + format!("deep-notify::{name}") } else { "deep-notify".into() }; @@ -54,14 +54,12 @@ impl> GstObjectExtManual for O { let obj: O = unsafe { values[0] .get::() - .unwrap_or_else(|err| { - panic!("Object signal \"deep-notify\": values[0]: {}", err) - }) + .unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[0]: {err}")) .unsafe_cast() }; let prop_obj: crate::Object = values[1] .get() - .unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[1]: {}", err)); + .unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[1]: {err}")); let pspec = unsafe { let pspec = glib::gobject_ffi::g_value_get_param(values[2].to_glib_none().0); diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index d87967d36..96f2b0964 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -1097,10 +1097,7 @@ unsafe fn update_probe_info( { // Buffer or Event consumed by probe } - other => panic!( - "Bad data for {:?} pad probe returning Handled: {:?}", - data_type, other - ), + other => panic!("Bad data for {data_type:?} pad probe returning Handled: {other:?}"), } } else { match probe_info.data { diff --git a/gstreamer/src/stream_collection.rs b/gstreamer/src/stream_collection.rs index b4ed74eb5..0cbae6fbe 100644 --- a/gstreamer/src/stream_collection.rs +++ b/gstreamer/src/stream_collection.rs @@ -169,7 +169,7 @@ impl StreamCollection { } unsafe { let f: Box_ = Box_::new(f); - let detailed_signal_name = detail.map(|name| format!("stream-notify::{}\0", name)); + let detailed_signal_name = detail.map(|name| format!("stream-notify::{name}\0")); let signal_name: &[u8] = detailed_signal_name .as_ref() .map_or(&b"stream-notify\0"[..], |n| n.as_bytes()); diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index e54d44ffe..d2dd7674b 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -1260,6 +1260,6 @@ mod tests { .field("f6", crate::List::new(["d", "e", "f"])) .build(); - assert_eq!(format!("{:?}", s), "Structure(test { f1: (gchararray) \"abc\", f2: (gchararray) \"bcd\", f3: (gint) 123, f4: Structure(nested { badger: (gboolean) TRUE }), f5: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), f6: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })"); + assert_eq!(format!("{s:?}"), "Structure(test { f1: (gchararray) \"abc\", f2: (gchararray) \"bcd\", f3: (gint) 123, f4: Structure(nested { badger: (gboolean) TRUE }), f5: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), f6: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })"); } } diff --git a/gstreamer/src/subclass/error.rs b/gstreamer/src/subclass/error.rs index e72b94a8a..143baf3d1 100644 --- a/gstreamer/src/subclass/error.rs +++ b/gstreamer/src/subclass/error.rs @@ -18,7 +18,7 @@ pub fn post_panic_error_message( }); let msg = if let Some(cause) = cause { - crate::message::Error::builder(crate::LibraryError::Failed, &format!("Panicked: {}", cause)) + crate::message::Error::builder(crate::LibraryError::Failed, &format!("Panicked: {cause}")) .src(src) .build() } else { diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index 541a7be53..625e15ca5 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -1356,14 +1356,14 @@ mod tests { crate::init().unwrap(); let mut tags = TagList::new(); - assert_eq!(format!("{:?}", tags), "TagList"); + assert_eq!(format!("{tags:?}"), "TagList"); { let tags = tags.get_mut().unwrap(); tags.add::(&"some title", TagMergeMode::Append); tags.add::<Duration>(&(ClockTime::SECOND * 120), TagMergeMode::Append); } assert_eq!( - format!("{:?}", tags), + format!("{tags:?}"), "TagList { title: (gchararray) \"some title\", duration: (guint64) 120000000000 }" ); } diff --git a/gstreamer/src/tags_serde.rs b/gstreamer/src/tags_serde.rs index 8f2ddbe29..7fd38b05c 100644 --- a/gstreamer/src/tags_serde.rs +++ b/gstreamer/src/tags_serde.rs @@ -82,8 +82,7 @@ impl<'a> Serialize for TagValuesSer<'a> { ser_opt_tag!(value, seq, Sample) } else { Err(ser::Error::custom(format!( - "unimplemented `Tag` serialization for type {}", - type_id, + "unimplemented `Tag` serialization for type {type_id}", ))) } } @@ -240,7 +239,7 @@ impl<'de, 'a> Visitor<'de> for TagValuesTupleVisitor<'a> { fn visit_seq<A: SeqAccess<'de>>(self, mut seq: A) -> Result<(), A::Error> { let name = seq .next_element::<String>() - .map_err(|err| de::Error::custom(format!("Error reading Tag name. {:?}", err)))? + .map_err(|err| de::Error::custom(format!("Error reading Tag name. {err:?}")))? .ok_or_else(|| de::Error::custom("Expected a name for the `Tag` name"))?; seq.next_element_seed(TagValues(name.as_str(), self.0))? .ok_or_else(|| de::Error::custom("Expected a seq of values for the `Tag`")) diff --git a/gstreamer/tests/check_gir.rs b/gstreamer/tests/check_gir.rs index b095c0444..2ccf5ff05 100644 --- a/gstreamer/tests/check_gir.rs +++ b/gstreamer/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/tutorials/src/bin/basic-tutorial-1.rs b/tutorials/src/bin/basic-tutorial-1.rs index a3df4a251..70f1d957e 100644 --- a/tutorials/src/bin/basic-tutorial-1.rs +++ b/tutorials/src/bin/basic-tutorial-1.rs @@ -10,7 +10,7 @@ fn tutorial_main() { // Build the pipeline let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; - let pipeline = gst::parse_launch(&format!("playbin uri={}", uri)).unwrap(); + let pipeline = gst::parse_launch(&format!("playbin uri={uri}")).unwrap(); // Start playing pipeline diff --git a/tutorials/src/bin/basic-tutorial-12.rs b/tutorials/src/bin/basic-tutorial-12.rs index 6186b8f25..9893c61b4 100644 --- a/tutorials/src/bin/basic-tutorial-12.rs +++ b/tutorials/src/bin/basic-tutorial-12.rs @@ -13,7 +13,7 @@ fn tutorial_main() -> Result<(), Error> { // Build the pipeline let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; - let pipeline = gst::parse_launch(&format!("playbin uri={}", uri))?; + let pipeline = gst::parse_launch(&format!("playbin uri={uri}"))?; // Start playing let res = pipeline.set_state(gst::State::Playing)?; @@ -52,10 +52,10 @@ fn tutorial_main() -> Result<(), Error> { } let percent = buffering.percent(); - print!("Buffering ({}%)\r", percent); + print!("Buffering ({percent}%)\r"); match std::io::stdout().flush() { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; // Wait until buffering is complete before start/resume playing @@ -87,6 +87,6 @@ fn tutorial_main() -> Result<(), Error> { fn main() { match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), } } diff --git a/tutorials/src/bin/basic-tutorial-13.rs b/tutorials/src/bin/basic-tutorial-13.rs index c01230bed..5741f127c 100644 --- a/tutorials/src/bin/basic-tutorial-13.rs +++ b/tutorials/src/bin/basic-tutorial-13.rs @@ -55,7 +55,7 @@ fn send_seek_event(pipeline: &Element, rate: f64) -> bool { // If we have not done so, obtain the sink through which we will send the seek events if let Some(video_sink) = pipeline.property::<Option<Element>>("video-sink") { - println!("Current rate: {}\r", rate); + println!("Current rate: {rate}\r"); // Send the event video_sink.send_event(seek_event) } else { @@ -123,7 +123,7 @@ USAGE: Choose one of the following options, then press enter: // Build the pipeline. let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; - let pipeline = gst::parse_launch(&format!("playbin uri={}", uri))?; + let pipeline = gst::parse_launch(&format!("playbin uri={uri}"))?; // Start playing. let _ = pipeline.set_state(State::Playing)?; @@ -151,7 +151,7 @@ USAGE: Choose one of the following options, then press enter: "PLAYING" }; playing = !playing; - println!("Setting state to {}\r", status); + println!("Setting state to {status}\r"); } Command::DataRateUp => { if send_seek_event(&pipeline, rate * 2.) { @@ -193,6 +193,6 @@ USAGE: Choose one of the following options, then press enter: fn main() { match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), } } diff --git a/tutorials/src/bin/basic-tutorial-3.rs b/tutorials/src/bin/basic-tutorial-3.rs index c073be8e1..4ead17752 100644 --- a/tutorials/src/bin/basic-tutorial-3.rs +++ b/tutorials/src/bin/basic-tutorial-3.rs @@ -62,18 +62,15 @@ fn tutorial_main() { let is_audio = new_pad_type.starts_with("audio/x-raw"); if !is_audio { - println!( - "It has type {} which is not raw audio. Ignoring.", - new_pad_type - ); + println!("It has type {new_pad_type} which is not raw audio. Ignoring."); return; } let res = src_pad.link(&sink_pad); if res.is_err() { - println!("Type is {} but link failed.", new_pad_type); + println!("Type is {new_pad_type} but link failed."); } else { - println!("Link succeeded (type {}).", new_pad_type); + println!("Link succeeded (type {new_pad_type})."); } }); diff --git a/tutorials/src/bin/basic-tutorial-4.rs b/tutorials/src/bin/basic-tutorial-4.rs index dd1f56c64..e48f7d309 100644 --- a/tutorials/src/bin/basic-tutorial-4.rs +++ b/tutorials/src/bin/basic-tutorial-4.rs @@ -134,10 +134,7 @@ fn handle_message(custom_data: &mut CustomData, msg: &gst::Message) { let new_state = state_changed.current(); let old_state = state_changed.old(); - println!( - "Pipeline state changed from {:?} to {:?}", - old_state, new_state - ); + println!("Pipeline state changed from {old_state:?} to {new_state:?}"); custom_data.playing = new_state == gst::State::Playing; if custom_data.playing { @@ -146,7 +143,7 @@ fn handle_message(custom_data: &mut CustomData, msg: &gst::Message) { let (seekable, start, end) = seeking.result(); custom_data.seek_enabled = seekable; if seekable { - println!("Seeking is ENABLED from {} to {}", start, end) + println!("Seeking is ENABLED from {start} to {end}") } else { println!("Seeking is DISABLED for this stream.") } diff --git a/tutorials/src/bin/basic-tutorial-5.rs b/tutorials/src/bin/basic-tutorial-5.rs index 008829bbe..0e574ff51 100644 --- a/tutorials/src/bin/basic-tutorial-5.rs +++ b/tutorials/src/bin/basic-tutorial-5.rs @@ -33,15 +33,15 @@ mod tutorial5 { // Extract tags from streams of @stype and add the info in the UI. fn add_streams_info(playbin: &gst::Element, textbuf: >k::TextBuffer, stype: &str) { - let propname: &str = &format!("n-{}", stype); - let signame: &str = &format!("get-{}-tags", stype); + let propname: &str = &format!("n-{stype}"); + let signame: &str = &format!("get-{stype}-tags"); let x = playbin.property::<i32>(propname); for i in 0..x { let tags = playbin.emit_by_name::<Option<gst::TagList>>(signame, &[&i]); if let Some(tags) = tags { - textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i)); + textbuf.insert_at_cursor(&format!("{stype} stream {i}:\n ")); if let Some(codec) = tags.get::<gst::tags::VideoCodec>() { textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get())); @@ -123,7 +123,7 @@ mod tutorial5 { ) .is_err() { - eprintln!("Seeking to {} failed", value); + eprintln!("Seeking to {value} failed"); } }); @@ -187,7 +187,7 @@ mod tutorial5 { video_overlay.set_window_handle(xid as usize); } } else { - println!("Add support for display type '{}'", display_type_name); + println!("Add support for display type '{display_type_name}'"); process::exit(-1); } } @@ -285,13 +285,13 @@ mod tutorial5 { // Initialize GTK if let Err(err) = gtk::init() { - eprintln!("Failed to initialize GTK: {}", err); + eprintln!("Failed to initialize GTK: {err}"); return; } // Initialize GStreamer if let Err(err) = gst::init() { - eprintln!("Failed to initialize Gst: {}", err); + eprintln!("Failed to initialize Gst: {err}"); return; } diff --git a/tutorials/src/bin/basic-tutorial-6.rs b/tutorials/src/bin/basic-tutorial-6.rs index 3ffffb4b6..600b3b46c 100644 --- a/tutorials/src/bin/basic-tutorial-6.rs +++ b/tutorials/src/bin/basic-tutorial-6.rs @@ -5,12 +5,12 @@ mod tutorials_common; fn print_caps(caps: &gst::CapsRef, prefix: &str) { if caps.is_any() { - println!("{}ANY", prefix); + println!("{prefix}ANY"); return; } if caps.is_empty() { - println!("{}EMPTY", prefix); + println!("{prefix}EMPTY"); return; } @@ -32,7 +32,7 @@ fn print_pad_template_information(factory: &gst::ElementFactory) { let long_name = factory .metadata("long-name") .expect("Failed to get long-name of element factory."); - println!("Pad Template for {}:", long_name); + println!("Pad Template for {long_name}:"); if factory.num_pad_templates() == 0u32 { println!(" None"); @@ -69,7 +69,7 @@ fn print_pad_capabilities(element: &gst::Element, pad_name: &str) { .static_pad(pad_name) .expect("Could not retrieve pad"); - println!("Caps for the {} pad:", pad_name); + println!("Caps for the {pad_name} pad:"); let caps = pad.current_caps().unwrap_or_else(|| pad.query_caps(None)); print_caps(&caps, " "); } @@ -145,10 +145,7 @@ fn tutorial_main() { let new_state = state_changed.current(); let old_state = state_changed.old(); - println!( - "Pipeline state changed from {:?} to {:?}", - old_state, new_state - ); + println!("Pipeline state changed from {old_state:?} to {new_state:?}"); print_pad_capabilities(&sink, "sink"); } } diff --git a/tutorials/src/bin/basic-tutorial-7.rs b/tutorials/src/bin/basic-tutorial-7.rs index 65fcec204..55ce94482 100644 --- a/tutorials/src/bin/basic-tutorial-7.rs +++ b/tutorials/src/bin/basic-tutorial-7.rs @@ -6,7 +6,7 @@ mod tutorials_common; fn tutorial_main() { // Initialize GStreamer if let Err(err) = gst::init() { - eprintln!("Failed to initialize Gst: {}", err); + eprintln!("Failed to initialize Gst: {err}"); return; } diff --git a/tutorials/src/bin/basic-tutorial-8.rs b/tutorials/src/bin/basic-tutorial-8.rs index a6b9d483a..082e23591 100644 --- a/tutorials/src/bin/basic-tutorial-8.rs +++ b/tutorials/src/bin/basic-tutorial-8.rs @@ -42,7 +42,7 @@ impl CustomData { fn main() { // Initialize GStreamer if let Err(err) = gst::init() { - eprintln!("Failed to initialize Gst: {}", err); + eprintln!("Failed to initialize Gst: {err}"); return; } diff --git a/tutorials/src/bin/basic-tutorial-9.rs b/tutorials/src/bin/basic-tutorial-9.rs index c8d645255..032bd6a45 100644 --- a/tutorials/src/bin/basic-tutorial-9.rs +++ b/tutorials/src/bin/basic-tutorial-9.rs @@ -57,7 +57,7 @@ fn print_stream_info(info: &DiscovererStreamInfo, depth: usize) { } } - println!("{}", tags_str); + println!("{tags_str}"); } }; } @@ -82,11 +82,11 @@ fn on_discovered( ) { let uri = discoverer_info.uri(); match discoverer_info.result() { - DiscovererResult::Ok => println!("Discovered {}", uri), - DiscovererResult::UriInvalid => println!("Invalid uri {}", uri), + DiscovererResult::Ok => println!("Discovered {uri}"), + DiscovererResult::UriInvalid => println!("Invalid uri {uri}"), DiscovererResult::Error => { if let Some(msg) = error { - println!("{}", msg); + println!("{msg}"); } else { println!("Unknown error") } @@ -95,7 +95,7 @@ fn on_discovered( DiscovererResult::Busy => println!("Busy"), DiscovererResult::MissingPlugins => { if let Some(s) = discoverer_info.misc() { - println!("{}", s); + println!("{s}"); } } _ => println!("Unknown result"), @@ -110,10 +110,10 @@ fn on_discovered( if let Some(tags) = discoverer_info.tags() { println!("Tags:"); for (tag, values) in tags.iter_generic() { - print!(" {}: ", tag); + print!(" {tag}: "); values.for_each(|v| { if let Some(s) = send_value_as_str(v) { - println!("{}", s) + println!("{s}") } }) } @@ -145,7 +145,7 @@ fn run_discoverer() -> Result<(), Error> { "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm" }; - println!("Discovering {}", uri); + println!("Discovering {uri}"); let loop_ = glib::MainLoop::new(None, false); let timeout = 5 * gst::ClockTime::SECOND; @@ -169,7 +169,7 @@ fn run_discoverer() -> Result<(), Error> { fn tutorial_main() { match run_discoverer() { Ok(_) => {} - Err(err) => eprintln!("Failed to run discovery: {}", err), + Err(err) => eprintln!("Failed to run discovery: {err}"), } } diff --git a/tutorials/src/bin/playback-tutorial-1.rs b/tutorials/src/bin/playback-tutorial-1.rs index f728fac64..27f12af4e 100644 --- a/tutorials/src/bin/playback-tutorial-1.rs +++ b/tutorials/src/bin/playback-tutorial-1.rs @@ -12,16 +12,13 @@ fn analyze_streams(playbin: &gst::Element) { let n_video = playbin.property::<i32>("n-video"); let n_audio = playbin.property::<i32>("n-audio"); let n_text = playbin.property::<i32>("n-text"); - println!( - "{} video stream(s), {} audio stream(s), {} text stream(s)", - n_video, n_audio, n_text - ); + println!("{n_video} video stream(s), {n_audio} audio stream(s), {n_text} text stream(s)"); for i in 0..n_video { let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-video-tags", &[&i]); if let Some(tags) = tags { - println!("video stream {}:", i); + println!("video stream {i}:"); if let Some(codec) = tags.get::<gst::tags::VideoCodec>() { println!(" codec: {}", codec.get()); } @@ -32,7 +29,7 @@ fn analyze_streams(playbin: &gst::Element) { let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-audio-tags", &[&i]); if let Some(tags) = tags { - println!("audio stream {}:", i); + println!("audio stream {i}:"); if let Some(codec) = tags.get::<gst::tags::AudioCodec>() { println!(" codec: {}", codec.get()); } @@ -49,7 +46,7 @@ fn analyze_streams(playbin: &gst::Element) { let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-text-tags", &[&i]); if let Some(tags) = tags { - println!("subtitle stream {}:", i); + println!("subtitle stream {i}:"); if let Some(codec) = tags.get::<gst::tags::LanguageCode>() { println!(" language: {}", codec.get()); } @@ -60,8 +57,7 @@ fn analyze_streams(playbin: &gst::Element) { let current_audio = playbin.property::<i32>("current-audio"); let current_text = playbin.property::<i32>("current-text"); println!( - "Currently playing video stream {}, audio stream {}, text stream {}", - current_video, current_audio, current_text + "Currently playing video stream {current_video}, audio stream {current_audio}, text stream {current_text}" ); println!("Type any number and hit ENTER to select a different audio stream"); } @@ -79,7 +75,7 @@ fn handle_keyboard(playbin: &gst::Element, main_loop: &glib::MainLoop) { let n_audio = playbin.property::<i32>("n-audio"); if index < n_audio { - println!("Setting current audio stream to {}", index); + println!("Setting current audio stream to {index}"); playbin.set_property("current-audio", index); } else { eprintln!("Index out of bounds"); @@ -189,6 +185,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; } diff --git a/tutorials/src/bin/playback-tutorial-2.rs b/tutorials/src/bin/playback-tutorial-2.rs index 99030a8b9..741252cf4 100644 --- a/tutorials/src/bin/playback-tutorial-2.rs +++ b/tutorials/src/bin/playback-tutorial-2.rs @@ -12,16 +12,13 @@ fn analyze_streams(playbin: &gst::Element) { let n_video = playbin.property::<i32>("n-video"); let n_audio = playbin.property::<i32>("n-audio"); let n_text = playbin.property::<i32>("n-text"); - println!( - "{} video stream(s), {} audio stream(s), {} subtitle stream(s)", - n_video, n_audio, n_text - ); + println!("{n_video} video stream(s), {n_audio} audio stream(s), {n_text} subtitle stream(s)"); for i in 0..n_video { let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-video-tags", &[&i]); if let Some(tags) = tags { - println!("video stream {}:", i); + println!("video stream {i}:"); if let Some(codec) = tags.get::<gst::tags::VideoCodec>() { println!(" codec: {}", codec.get()); } @@ -32,7 +29,7 @@ fn analyze_streams(playbin: &gst::Element) { let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-audio-tags", &[&i]); if let Some(tags) = tags { - println!("audio stream {}:", i); + println!("audio stream {i}:"); if let Some(codec) = tags.get::<gst::tags::AudioCodec>() { println!(" codec: {}", codec.get()); } @@ -49,7 +46,7 @@ fn analyze_streams(playbin: &gst::Element) { let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-text-tags", &[&i]); if let Some(tags) = tags { - println!("subtitle stream {}:", i); + println!("subtitle stream {i}:"); if let Some(codec) = tags.get::<gst::tags::LanguageCode>() { println!(" language: {}", codec.get()); } @@ -62,8 +59,7 @@ fn analyze_streams(playbin: &gst::Element) { let current_audio = playbin.property::<i32>("current-audio"); let current_text = playbin.property::<i32>("current-text"); println!( - "Currently playing video stream {}, audio stream {}, subtitle stream {}", - current_video, current_audio, current_text + "Currently playing video stream {current_video}, audio stream {current_audio}, subtitle stream {current_text}" ); println!("Type any number and hit ENTER to select a different subtitle stream"); } @@ -81,7 +77,7 @@ fn handle_keyboard(playbin: &gst::Element, main_loop: &glib::MainLoop) { let n_audio = playbin.property::<i32>("n-text"); if index < n_audio { - println!("Setting current subtitle stream to {}", index); + println!("Setting current subtitle stream to {index}"); playbin.set_property("current-text", index); } else { eprintln!("Index out of bounds"); @@ -194,6 +190,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; } diff --git a/tutorials/src/bin/playback-tutorial-3.rs b/tutorials/src/bin/playback-tutorial-3.rs index ccd017c8c..308574965 100644 --- a/tutorials/src/bin/playback-tutorial-3.rs +++ b/tutorials/src/bin/playback-tutorial-3.rs @@ -184,6 +184,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; } diff --git a/tutorials/src/bin/playback-tutorial-4.rs b/tutorials/src/bin/playback-tutorial-4.rs index 9b3b22858..39282e8b5 100644 --- a/tutorials/src/bin/playback-tutorial-4.rs +++ b/tutorials/src/bin/playback-tutorial-4.rs @@ -188,6 +188,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; } diff --git a/tutorials/src/bin/playback-tutorial-5.rs b/tutorials/src/bin/playback-tutorial-5.rs index cf697dd80..2e113b6bd 100644 --- a/tutorials/src/bin/playback-tutorial-5.rs +++ b/tutorials/src/bin/playback-tutorial-5.rs @@ -192,6 +192,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; } diff --git a/tutorials/src/bin/playback-tutorial-6.rs b/tutorials/src/bin/playback-tutorial-6.rs index a7101476b..e4c1629ff 100644 --- a/tutorials/src/bin/playback-tutorial-6.rs +++ b/tutorials/src/bin/playback-tutorial-6.rs @@ -29,7 +29,7 @@ fn tutorial_main() -> Result<(), Error> { for feature in list { let factory = feature.downcast::<gst::ElementFactory>().unwrap(); let name = factory.longname(); - println!(" {}", name); + println!(" {name}"); if selected_factory.is_none() && name.starts_with("GOOM") { selected_factory = Some(factory); @@ -41,7 +41,7 @@ fn tutorial_main() -> Result<(), Error> { // We have now selected a factory for the visualization element let name = vis_factory.longname(); - println!("Selected {}", name); + println!("Selected {name}"); let vis_plugin = vis_factory.create().build().unwrap(); // Build the pipeline @@ -82,6 +82,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; } diff --git a/tutorials/src/bin/playback-tutorial-7.rs b/tutorials/src/bin/playback-tutorial-7.rs index b452e80d3..8ed4c3cdc 100644 --- a/tutorials/src/bin/playback-tutorial-7.rs +++ b/tutorials/src/bin/playback-tutorial-7.rs @@ -65,6 +65,6 @@ fn main() { // (but not necessary in normal Cocoa applications where this is set up automatically) match tutorials_common::run(tutorial_main) { Ok(_) => {} - Err(err) => eprintln!("Failed: {}", err), + Err(err) => eprintln!("Failed: {err}"), }; }