diff --git a/audio/audiofx/examples/hrtfrender.rs b/audio/audiofx/examples/hrtfrender.rs index 86a71b62..98acc158 100644 --- a/audio/audiofx/examples/hrtfrender.rs +++ b/audio/audiofx/examples/hrtfrender.rs @@ -37,9 +37,8 @@ fn run() -> Result<(), Error> { let hrir = &args[2]; let pipeline = gst::parse_launch(&format!( - "uridecodebin uri={} ! audioconvert ! audio/x-raw,channels=1 ! - hrtfrender hrir-file={} name=hrtf ! audioresample ! autoaudiosink", - uri, hrir + "uridecodebin uri={uri} ! audioconvert ! audio/x-raw,channels=1 ! + hrtfrender hrir-file={hrir} name=hrtf ! audioresample ! autoaudiosink" ))? .downcast::() .expect("type error"); @@ -142,6 +141,6 @@ fn run() -> Result<(), Error> { fn main() { match run() { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/audio/audiofx/src/ebur128level/imp.rs b/audio/audiofx/src/ebur128level/imp.rs index add9de30..bb39445b 100644 --- a/audio/audiofx/src/ebur128level/imp.rs +++ b/audio/audiofx/src/ebur128level/imp.rs @@ -779,8 +779,8 @@ fn non_interleaved_channel_data_into_slices<'a, T: FromByteSlice>( /// Split a vector of slices into a tuple of slices with each slice split at `split_at`. #[allow(clippy::type_complexity)] -fn split_vec<'a, 'b, T: Copy>( - vec: &'b SmallVec<[&'a [T]; 64]>, +fn split_vec<'a, T: Copy>( + vec: &SmallVec<[&'a [T]; 64]>, split_at: usize, ) -> (SmallVec<[&'a [T]; 64]>, SmallVec<[&'a [T]; 64]>) { let VecPair(first, second) = vec diff --git a/audio/audiofx/tests/audioloudnorm.rs b/audio/audiofx/tests/audioloudnorm.rs index 7e9d878e..4fd14b0f 100644 --- a/audio/audiofx/tests/audioloudnorm.rs +++ b/audio/audiofx/tests/audioloudnorm.rs @@ -33,9 +33,9 @@ fn run_test( init(); let format = if cfg!(target_endian = "little") { - format!("audio/x-raw,format=F64LE,rate=192000,channels={}", channels) + format!("audio/x-raw,format=F64LE,rate=192000,channels={channels}") } else { - format!("audio/x-raw,format=F64BE,rate=192000,channels={}", channels) + format!("audio/x-raw,format=F64BE,rate=192000,channels={channels}") }; let pipeline = if let Some(second_input) = second_input { @@ -51,10 +51,6 @@ fn run_test( } else { gst::parse_launch(&format!( "audiotestsrc {first_input} num-buffers={num_buffers} samplesperbuffer={samples_per_buffer} ! {format} ! audioloudnorm ! appsink name=sink", - first_input = first_input, - num_buffers = num_buffers, - samples_per_buffer = samples_per_buffer, - format = format, )) } .unwrap() @@ -129,17 +125,13 @@ fn run_test( Ordering::Greater => { assert!( ts - expected_ts <= gst::ClockTime::NSECOND, - "TS is {} instead of {}", - ts, - expected_ts + "TS is {ts} instead of {expected_ts}" ); } Ordering::Less => { assert!( expected_ts - ts <= gst::ClockTime::NSECOND, - "TS is {} instead of {}", - ts, - expected_ts + "TS is {ts} instead of {expected_ts}" ); } Ordering::Equal => (), @@ -164,27 +156,18 @@ fn run_test( if expected_loudness.classify() == std::num::FpCategory::Infinite && expected_loudness < 0.0 { assert!( loudness.classify() == std::num::FpCategory::Infinite && loudness < 0.0, - "Loudness is {} instead of {}", - loudness, - expected_loudness, + "Loudness is {loudness} instead of {expected_loudness}", ); } else { assert!( f64::abs(loudness - expected_loudness) < 1.0, - "Loudness is {} instead of {}", - loudness, - expected_loudness, + "Loudness is {loudness} instead of {expected_loudness}", ); } for c in 0..channels { let peak = 20.0 * f64::log10(r128.sample_peak(c).unwrap()); - assert!( - peak <= -2.0, - "Peak {} for channel {} is above -2.0", - c, - peak, - ); + assert!(peak <= -2.0, "Peak {c} for channel {peak} is above -2.0",); } } diff --git a/audio/claxon/src/claxondec/imp.rs b/audio/claxon/src/claxondec/imp.rs index 0e7521bd..58f422d9 100644 --- a/audio/claxon/src/claxondec/imp.rs +++ b/audio/claxon/src/claxondec/imp.rs @@ -392,7 +392,7 @@ fn gstaudioinfo(streaminfo: &claxon::metadata::StreamInfo) -> Result { - let details = format!("{:?}", err); + let details = format!("{err:?}"); gst::error!(CAT, imp: self, "failed to start: {}", details); gst::element_imp_error!(self, gst::ResourceError::Settings, [&details]); return Err(gst::FlowError::Error); @@ -383,7 +383,7 @@ impl URIHandlerImpl for SpotifyAudioSrc { gst::debug!(CAT, imp: self, "set URI: {}", uri); let url = url::Url::parse(uri) - .map_err(|e| glib::Error::new(gst::URIError::BadUri, &format!("{:?}", e)))?; + .map_err(|e| glib::Error::new(gst::URIError::BadUri, &format!("{e:?}")))?; // allow to configure auth and cache settings from the URI for (key, value) in url.query_pairs() { diff --git a/generic/file/src/file_location.rs b/generic/file/src/file_location.rs index 26684565..78835454 100644 --- a/generic/file/src/file_location.rs +++ b/generic/file/src/file_location.rs @@ -33,14 +33,14 @@ impl FileLocation { if url.scheme() != "file" { return Err(glib::Error::new( gst::URIError::UnsupportedProtocol, - format!("Unsupported URI {}", uri_str).as_str(), + format!("Unsupported URI {uri_str}").as_str(), )); } let path = url.to_file_path().map_err(|_| { glib::Error::new( gst::URIError::BadUri, - format!("Unsupported URI {}", uri_str).as_str(), + format!("Unsupported URI {uri_str}").as_str(), ) })?; @@ -48,7 +48,7 @@ impl FileLocation { } Err(err) => Err(glib::Error::new( gst::URIError::BadUri, - format!("Couldn't parse URI {}: {}", uri_str, err).as_str(), + format!("Couldn't parse URI {uri_str}: {err}").as_str(), )), } } @@ -57,14 +57,14 @@ impl FileLocation { let location_str = location.to_str().ok_or_else(|| { glib::Error::new( gst::URIError::BadReference, - format!("Invalid path {:?}", location).as_str(), + format!("Invalid path {location:?}").as_str(), ) })?; let file_name = location.file_name().ok_or_else(|| { glib::Error::new( gst::URIError::BadReference, - format!("Expected a path with a filename, got {}", location_str,).as_str(), + format!("Expected a path with a filename, got {location_str}",).as_str(), ) })?; @@ -83,7 +83,7 @@ impl FileLocation { let parent_canonical = parent_dir.canonicalize().map_err(|err| { glib::Error::new( gst::URIError::BadReference, - format!("Could not resolve path {}: {}", location_str, err,).as_str(), + format!("Could not resolve path {location_str}: {err}",).as_str(), ) })?; @@ -109,7 +109,7 @@ impl FileLocation { .map_err(|_| { glib::Error::new( gst::URIError::BadReference, - format!("Could not resolve path to URL {}", location_str).as_str(), + format!("Could not resolve path to URL {location_str}").as_str(), ) }) .map(|_| FileLocation(location_canonical)) diff --git a/generic/file/src/filesrc/imp.rs b/generic/file/src/filesrc/imp.rs index 1faa24b6..bc68ad79 100644 --- a/generic/file/src/filesrc/imp.rs +++ b/generic/file/src/filesrc/imp.rs @@ -80,14 +80,14 @@ impl FileSrc { if !location.exists() { return Err(glib::Error::new( gst::URIError::BadReference, - format!("{} doesn't exist", location).as_str(), + format!("{location} doesn't exist").as_str(), )); } if !location.is_file() { return Err(glib::Error::new( gst::URIError::BadReference, - format!("{} is not a file", location).as_str(), + format!("{location} is not a file").as_str(), )); } diff --git a/generic/threadshare/examples/benchmark.rs b/generic/threadshare/examples/benchmark.rs index 3903f7a1..9ecfce63 100644 --- a/generic/threadshare/examples/benchmark.rs +++ b/generic/threadshare/examples/benchmark.rs @@ -78,7 +78,7 @@ fn main() { let build_context = || format!("context-{}", (i as u32) % n_groups); let sink = gst::ElementFactory::make("fakesink") - .name(format!("sink-{}", i).as_str()) + .name(format!("sink-{i}").as_str()) .property("sync", false) .property("async", false) .property("signal-handoffs", true) @@ -96,7 +96,7 @@ fn main() { let (source, context) = match source.as_str() { "udpsrc" => { let source = gst::ElementFactory::make("udpsrc") - .name(format!("source-{}", i).as_str()) + .name(format!("source-{i}").as_str()) .property("port", 5004i32 + i as i32) .property("retrieve-sender-address", false) .build() @@ -107,7 +107,7 @@ fn main() { "ts-udpsrc" => { let context = build_context(); let source = gst::ElementFactory::make("ts-udpsrc") - .name(format!("source-{}", i).as_str()) + .name(format!("source-{i}").as_str()) .property("port", 5004i32 + i as i32) .property("context", &context) .property("context-wait", wait) @@ -122,7 +122,7 @@ fn main() { } "tcpclientsrc" => { let source = gst::ElementFactory::make("tcpclientsrc") - .name(format!("source-{}", i).as_str()) + .name(format!("source-{i}").as_str()) .property("host", "127.0.0.1") .property("port", 40000i32) .build() @@ -133,7 +133,7 @@ fn main() { "ts-tcpclientsrc" => { let context = build_context(); let source = gst::ElementFactory::make("ts-tcpclientsrc") - .name(format!("source-{}", i).as_str()) + .name(format!("source-{i}").as_str()) .property("host", "127.0.0.1") .property("port", 40000i32) .property("context", &context) @@ -145,7 +145,7 @@ fn main() { } "tonegeneratesrc" => { let source = gst::ElementFactory::make("tonegeneratesrc") - .name(format!("source-{}", i).as_str()) + .name(format!("source-{i}").as_str()) .property("samplesperbuffer", (wait as i32) * 8000 / 1000) .build() .unwrap(); @@ -157,7 +157,7 @@ fn main() { "ts-tonesrc" => { let context = build_context(); let source = gst::ElementFactory::make("ts-tonesrc") - .name(format!("source-{}", i).as_str()) + .name(format!("source-{i}").as_str()) .property("samples-per-buffer", wait * 8000 / 1000) .property("context", &context) .property("context-wait", wait) @@ -171,7 +171,7 @@ fn main() { if is_rtp { let jb = gst::ElementFactory::make("ts-jitterbuffer") - .name(format!("jb-{}", i).as_str()) + .name(format!("jb-{i}").as_str()) .property("context-wait", wait) .property("latency", wait) .build() diff --git a/generic/threadshare/examples/udpsrc_benchmark_sender.rs b/generic/threadshare/examples/udpsrc_benchmark_sender.rs index 2ba9e24f..497225d4 100644 --- a/generic/threadshare/examples/udpsrc_benchmark_sender.rs +++ b/generic/threadshare/examples/udpsrc_benchmark_sender.rs @@ -90,7 +90,7 @@ fn send_test_buffers(n_streams: u16, num_buffers: Option) { let pipeline = gst::Pipeline::default(); for i in 0..n_streams { let src = gst::ElementFactory::make("ts-audiotestsrc") - .name(format!("ts-audiotestsrc-{}", i).as_str()) + .name(format!("ts-audiotestsrc-{i}").as_str()) .property("context-wait", 20u32) .property("is-live", true) .property("do-timestamp", true) @@ -107,7 +107,7 @@ fn send_test_buffers(n_streams: u16, num_buffers: Option) { } let sink = gst::ElementFactory::make("ts-udpsink") - .name(format!("udpsink-{}", i).as_str()) + .name(format!("udpsink-{i}").as_str()) .property("clients", format!("127.0.0.1:{}", i + 5004)) .property("context-wait", 20u32) .build() @@ -125,7 +125,7 @@ fn send_rtp_buffers(n_streams: u16, num_buffers: Option) { let pipeline = gst::Pipeline::default(); for i in 0..n_streams { let src = gst::ElementFactory::make("ts-audiotestsrc") - .name(format!("ts-audiotestsrc-{}", i).as_str()) + .name(format!("ts-audiotestsrc-{i}").as_str()) .property("context-wait", 20u32) .property("is-live", true) .property("do-timestamp", true) @@ -142,16 +142,16 @@ fn send_rtp_buffers(n_streams: u16, num_buffers: Option) { } let enc = gst::ElementFactory::make("alawenc") - .name(format!("alawenc-{}", i).as_str()) + .name(format!("alawenc-{i}").as_str()) .build() .unwrap(); let pay = gst::ElementFactory::make("rtppcmapay") - .name(format!("rtppcmapay-{}", i).as_str()) + .name(format!("rtppcmapay-{i}").as_str()) .build() .unwrap(); let sink = gst::ElementFactory::make("ts-udpsink") - .name(format!("udpsink-{}", i).as_str()) + .name(format!("udpsink-{i}").as_str()) .property("context-wait", 20u32) .property("clients", format!("127.0.0.1:{}", i + 5004)) .build() diff --git a/generic/threadshare/src/runtime/executor/context.rs b/generic/threadshare/src/runtime/executor/context.rs index e12fdcbb..8f432151 100644 --- a/generic/threadshare/src/runtime/executor/context.rs +++ b/generic/threadshare/src/runtime/executor/context.rs @@ -469,7 +469,7 @@ mod tests { // The last sub task should be simply dropped at this point match receiver.try_next() { Ok(None) | Err(_) => (), - other => panic!("Unexpected {:?}", other), + other => panic!("Unexpected {other:?}"), } } diff --git a/generic/threadshare/src/runtime/executor/scheduler.rs b/generic/threadshare/src/runtime/executor/scheduler.rs index bf7c65c4..8552a520 100644 --- a/generic/threadshare/src/runtime/executor/scheduler.rs +++ b/generic/threadshare/src/runtime/executor/scheduler.rs @@ -201,7 +201,7 @@ impl Scheduler { let mut now; // This is to ensure reactor invocation on the first iteration. - let mut last_react = Instant::now() - self.max_throttling; + let mut last_react = Instant::now().checked_sub(self.max_throttling).unwrap(); let mut tasks_checked; 'main: loop { // Only check I/O and timers every `max_throttling`. diff --git a/generic/threadshare/src/runtime/task.rs b/generic/threadshare/src/runtime/task.rs index 2277df94..0ac00774 100644 --- a/generic/threadshare/src/runtime/task.rs +++ b/generic/threadshare/src/runtime/task.rs @@ -1306,7 +1306,7 @@ mod tests { origin: Unprepared, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; gst::debug!(RUNTIME_CAT, "nominal: starting (async prepare)"); @@ -1356,7 +1356,7 @@ mod tests { state: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } gst::debug!(RUNTIME_CAT, "nominal: pause cancelling try_next"); @@ -1559,7 +1559,7 @@ mod tests { state: Preparing, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } // Wait for state machine to reach Error @@ -1573,7 +1573,7 @@ mod tests { state: TaskState::Error, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } block_on(task.unprepare()).unwrap(); @@ -1636,7 +1636,8 @@ mod tests { let task = Task::default(); let (mut prepare_sender, prepare_receiver) = mpsc::channel(1); - let _ = task.prepare(TaskPrepareTest { prepare_receiver }, context); + let fut = task.prepare(TaskPrepareTest { prepare_receiver }, context); + drop(fut); let start_ctx = Context::acquire("prepare_start_ok_requester", Duration::ZERO).unwrap(); let (ready_sender, ready_receiver) = oneshot::channel(); @@ -1650,7 +1651,7 @@ mod tests { origin: Preparing, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } ready_sender.send(()).unwrap(); assert_eq!( @@ -1669,7 +1670,7 @@ mod tests { origin: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } assert_eq!( stop_status.await.unwrap(), @@ -1687,7 +1688,7 @@ mod tests { origin: Stopped, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; assert_eq!( unprepare_status.await.unwrap(), @@ -1755,7 +1756,7 @@ mod tests { (Prepare, Unprepared) => { self.prepare_error_sender.send(()).await.unwrap(); } - other => panic!("action error for {:?}", other), + other => panic!("action error for {other:?}"), } Trigger::Error } @@ -1794,14 +1795,15 @@ mod tests { origin: Unprepared, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; let start_ctx = Context::acquire("prepare_start_error_requester", Duration::ZERO).unwrap(); let (ready_sender, ready_receiver) = oneshot::channel(); let start_handle = start_ctx.spawn(async move { gst::debug!(RUNTIME_CAT, "prepare_start_error: starting (Err)"); - let _ = task.start(); + let fut = task.start(); + drop(fut); ready_sender.send(()).unwrap(); // FIXME we loose the origin Trigger (Start) // and only get the Trigger returned by handle_action_error @@ -1812,7 +1814,7 @@ mod tests { state: Preparing, .. }) => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } let unprepare_status = task.unprepare(); @@ -1822,7 +1824,7 @@ mod tests { origin: TaskState::Error, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; assert_eq!( unprepare_status.await.unwrap(), @@ -1921,7 +1923,7 @@ mod tests { state: TaskState::Error, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } assert_eq!( @@ -1978,13 +1980,14 @@ mod tests { let (flush_start_sender, mut flush_start_receiver) = mpsc::channel(1); let (flush_stop_sender, mut flush_stop_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskFlushTest { flush_start_sender, flush_stop_sender, }, context, ); + drop(fut); gst::debug!(RUNTIME_CAT, "flush_regular_sync: start"); block_on(task.start()).unwrap(); @@ -2013,7 +2016,8 @@ mod tests { block_on(flush_stop_receiver.next()).unwrap(); - let _ = task.pause(); + let fut = task.pause(); + drop(fut); stop_then_unprepare(task); } @@ -2070,13 +2074,14 @@ mod tests { let (flush_start_sender, mut flush_start_receiver) = mpsc::channel(1); let (flush_stop_sender, mut flush_stop_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskFlushTest { flush_start_sender, flush_stop_sender, }, context, ); + drop(fut); gst::debug!(RUNTIME_CAT, "flush_regular_different_context: start"); task.start().block_on().unwrap(); @@ -2096,7 +2101,7 @@ mod tests { origin: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; assert_eq!( flush_start_status.await.unwrap(), @@ -2115,7 +2120,7 @@ mod tests { origin: Flushing, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; assert_eq!( flush_stop_status.await_maybe_on_context().unwrap(), @@ -2182,13 +2187,14 @@ mod tests { let (flush_start_sender, mut flush_start_receiver) = mpsc::channel(1); let (flush_stop_sender, mut flush_stop_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskFlushTest { flush_start_sender, flush_stop_sender, }, context.clone(), ); + drop(fut); block_on(task.start()).unwrap(); @@ -2201,7 +2207,7 @@ mod tests { origin: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; assert_eq!( flush_start_status.await.unwrap(), @@ -2220,7 +2226,7 @@ mod tests { origin: Flushing, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; assert_eq!( flush_stop_status.await.unwrap(), @@ -2264,7 +2270,7 @@ mod tests { origin: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } Ok(()) } @@ -2286,15 +2292,17 @@ mod tests { let task = Task::default(); let (flush_start_sender, mut flush_start_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskFlushTest { task: task.clone(), flush_start_sender, }, context, ); + drop(fut); - let _ = task.start(); + let fut = task.start(); + drop(fut); gst::debug!( RUNTIME_CAT, @@ -2343,7 +2351,7 @@ mod tests { origin: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } Ok(()) @@ -2366,15 +2374,17 @@ mod tests { let task = Task::default(); let (pause_sender, mut pause_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskStartTest { task: task.clone(), pause_sender, }, context, ); + drop(fut); - let _ = task.start(); + let fut = task.start(); + drop(fut); gst::debug!(RUNTIME_CAT, "pause_from_loop: awaiting pause notification"); block_on(pause_receiver.next()).unwrap(); @@ -2415,7 +2425,7 @@ mod tests { origin: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } Ok(()) @@ -2438,16 +2448,18 @@ mod tests { let task = Task::default(); let (flush_stop_sender, mut flush_stop_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskFlushTest { task: task.clone(), flush_stop_sender, }, context, ); + drop(fut); task.start().block_on().unwrap(); - let _ = task.flush_start(); + let fut = task.flush_start(); + drop(fut); gst::debug!( RUNTIME_CAT, @@ -2514,7 +2526,7 @@ mod tests { let (started_sender, mut started_receiver) = mpsc::channel(1); let (flush_start_sender, mut flush_start_receiver) = mpsc::channel(1); let (flush_stop_sender, mut flush_stop_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskFlushTest { started_sender, flush_start_sender, @@ -2522,6 +2534,7 @@ mod tests { }, context, ); + drop(fut); // Pause, FlushStart, FlushStop, Start @@ -2629,7 +2642,7 @@ mod tests { let (started_sender, mut started_receiver) = mpsc::channel(1); let (flush_start_sender, mut flush_start_receiver) = mpsc::channel(1); let (flush_stop_sender, mut flush_stop_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskFlushTest { started_sender, flush_start_sender, @@ -2637,11 +2650,13 @@ mod tests { }, context, ); + drop(fut); // Pause, FlushStart, Start, FlushStop gst::debug!(RUNTIME_CAT, "pause_flushing_start: pausing"); - let _ = task.pause(); + let fut = task.pause(); + drop(fut); gst::debug!(RUNTIME_CAT, "pause_flushing_start: starting flush"); block_on(task.flush_start()).unwrap(); @@ -2723,13 +2738,14 @@ mod tests { let (flush_start_sender, mut flush_start_receiver) = mpsc::channel(1); let (flush_stop_sender, mut flush_stop_receiver) = mpsc::channel(1); - let _ = task.prepare( + let fut = task.prepare( TaskStartTest { flush_start_sender, flush_stop_sender, }, context, ); + drop(fut); let oob_context = Context::acquire("flush_concurrent_start_oob", Duration::from_millis(2)).unwrap(); @@ -2755,7 +2771,7 @@ mod tests { origin: Started, .. } => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), }; status.await.unwrap(); flush_start_receiver.next().await.unwrap(); @@ -2777,7 +2793,7 @@ mod tests { origin: PausedFlushing, target: Flushing, }) => (), - other => panic!("{:?}", other), + other => panic!("{other:?}"), } block_on(flush_start_handle).unwrap(); @@ -2848,16 +2864,18 @@ mod tests { let task = Task::default(); let (timer_elapsed_sender, timer_elapsed_receiver) = oneshot::channel(); - let _ = task.prepare( + let fut = task.prepare( TaskTimerTest { timer: None, timer_elapsed_sender: Some(timer_elapsed_sender), }, context, ); + drop(fut); gst::debug!(RUNTIME_CAT, "start_timer: start"); - let _ = task.start(); + let fut = task.start(); + drop(fut); block_on(timer_elapsed_receiver).unwrap(); gst::debug!(RUNTIME_CAT, "start_timer: timer elapsed received"); diff --git a/generic/threadshare/src/socket.rs b/generic/threadshare/src/socket.rs index 3ac650d9..a815c213 100644 --- a/generic/threadshare/src/socket.rs +++ b/generic/threadshare/src/socket.rs @@ -111,8 +111,8 @@ impl error::Error for SocketError {} impl fmt::Display for SocketError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - SocketError::Gst(err) => write!(f, "flow error: {}", err), - SocketError::Io(err) => write!(f, "IO error: {}", err), + SocketError::Gst(err) => write!(f, "flow error: {err}"), + SocketError::Io(err) => write!(f, "IO error: {err}"), } } } diff --git a/generic/threadshare/src/tcpclientsrc/imp.rs b/generic/threadshare/src/tcpclientsrc/imp.rs index 71e702b5..cbbf2505 100644 --- a/generic/threadshare/src/tcpclientsrc/imp.rs +++ b/generic/threadshare/src/tcpclientsrc/imp.rs @@ -434,13 +434,14 @@ impl TcpClientSrc { // Don't block on `prepare` as the socket connection takes time. // This will be performed in the background and we'll block on // `start` which will also ensure `prepare` completed successfully. - let _ = self + let fut = self .task .prepare( TcpClientSrcTask::new(self.obj().clone(), saddr, buffer_pool), context, ) .check()?; + drop(fut); gst::debug!(CAT, imp: self, "Preparing asynchronously"); diff --git a/generic/threadshare/tests/pad.rs b/generic/threadshare/tests/pad.rs index da0eb28d..dd17d29e 100644 --- a/generic/threadshare/tests/pad.rs +++ b/generic/threadshare/tests/pad.rs @@ -163,7 +163,7 @@ mod imp_src { Err(gst::FlowError::Flushing) => { gst::debug!(SRC_CAT, obj: self.element, "Flushing") } - Err(err) => panic!("Got error {}", err), + Err(err) => panic!("Got error {err}"), } res @@ -744,9 +744,9 @@ fn nominal_scenario( match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::StreamStart(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } elem_src_test @@ -758,9 +758,9 @@ fn nominal_scenario( match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Buffer @@ -773,7 +773,7 @@ fn nominal_scenario( let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // BufferList @@ -785,7 +785,7 @@ fn nominal_scenario( match futures::executor::block_on(receiver.next()).unwrap() { Item::BufferList(_) => (), - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Pause the Pad task @@ -807,7 +807,7 @@ fn nominal_scenario( let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![5, 6, 7].as_slice()); } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Flush @@ -817,9 +817,9 @@ fn nominal_scenario( match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::FlushStop(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } elem_src_test @@ -831,9 +831,9 @@ fn nominal_scenario( match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Buffer @@ -846,7 +846,7 @@ fn nominal_scenario( let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![8, 9].as_slice()); } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // EOS @@ -857,9 +857,9 @@ fn nominal_scenario( match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Eos(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } pipeline.set_state(gst::State::Ready).unwrap(); @@ -867,7 +867,7 @@ fn nominal_scenario( // Receiver was dropped when stopping => can't send anymore elem_src_test .try_push(Item::Event( - gst::event::StreamStart::builder(&format!("{}_past_stop", scenario_name)) + gst::event::StreamStart::builder(&format!("{scenario_name}_past_stop")) .group_id(gst::GroupId::next()) .build(), )) @@ -893,7 +893,7 @@ fn src_tsqueue_sink_nominal() { let ts_queue = gst::ElementFactory::make("ts-queue") .name("ts-queue") - .property("context", format!("{}_queue", name)) + .property("context", format!("{name}_queue")) .property("context-wait", THROTTLING_DURATION.as_millis() as u32) .build() .unwrap(); @@ -926,14 +926,14 @@ fn src_tsproxy_sink_nominal() { let ts_proxy_sink = gst::ElementFactory::make("ts-proxysink") .name("ts-proxysink") - .property("proxy-context", format!("{}_proxy_context", name)) + .property("proxy-context", format!("{name}_proxy_context")) .build() .unwrap(); let ts_proxy_src = gst::ElementFactory::make("ts-proxysrc") .name("ts-proxysrc") - .property("proxy-context", format!("{}_proxy_context", name)) - .property("context", format!("{}_context", name)) + .property("proxy-context", format!("{name}_proxy_context")) + .property("context", format!("{name}_context")) .property("context-wait", THROTTLING_DURATION.as_millis() as u32) .build() .unwrap(); @@ -968,9 +968,9 @@ fn start_pause_start() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::StreamStart(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } elem_src_test @@ -982,9 +982,9 @@ fn start_pause_start() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Buffer @@ -1005,7 +1005,7 @@ fn start_pause_start() { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } match futures::executor::block_on(receiver.next()).unwrap() { @@ -1013,7 +1013,7 @@ fn start_pause_start() { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![5, 6, 7].as_slice()); } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Nothing else forwarded @@ -1037,7 +1037,7 @@ fn start_stop_start() { // Initial events elem_src_test .try_push(Item::Event( - gst::event::StreamStart::builder(&format!("{}-after_stop", scenario_name)) + gst::event::StreamStart::builder(&format!("{scenario_name}-after_stop")) .group_id(gst::GroupId::next()) .build(), )) @@ -1046,9 +1046,9 @@ fn start_stop_start() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::StreamStart(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } elem_src_test @@ -1060,9 +1060,9 @@ fn start_stop_start() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Buffer @@ -1094,16 +1094,16 @@ fn start_stop_start() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::StreamStart(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } } Item::Event(event) => match event.view() { EventView::StreamStart(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } elem_src_test @@ -1115,9 +1115,9 @@ fn start_stop_start() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } elem_src_test @@ -1129,7 +1129,7 @@ fn start_stop_start() { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![5, 6, 7].as_slice()); } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } pipeline.set_state(gst::State::Null).unwrap(); @@ -1150,7 +1150,7 @@ fn start_flush() { // Initial events elem_src_test .try_push(Item::Event( - gst::event::StreamStart::builder(&format!("{}-after_stop", scenario_name)) + gst::event::StreamStart::builder(&format!("{scenario_name}-after_stop")) .group_id(gst::GroupId::next()) .build(), )) @@ -1159,9 +1159,9 @@ fn start_flush() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::StreamStart(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } elem_src_test @@ -1173,9 +1173,9 @@ fn start_flush() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Buffer @@ -1202,7 +1202,7 @@ fn start_flush() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, Item::Buffer(buffer) => { // In some cases, the first Buffer might be processed before FlushStart @@ -1212,12 +1212,12 @@ fn start_flush() { match futures::executor::block_on(receiver.next()).unwrap() { Item::Event(event) => match event.view() { EventView::Segment(_) => (), - other => panic!("Unexpected event {:?}", other), + other => panic!("Unexpected event {other:?}"), }, - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } // Post flush buffer @@ -1230,7 +1230,7 @@ fn start_flush() { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![8, 9].as_slice()); } - other => panic!("Unexpected item {:?}", other), + other => panic!("Unexpected item {other:?}"), } pipeline.set_state(gst::State::Null).unwrap(); diff --git a/generic/threadshare/tests/pipeline.rs b/generic/threadshare/tests/pipeline.rs index caa66ac6..6b9f5534 100644 --- a/generic/threadshare/tests/pipeline.rs +++ b/generic/threadshare/tests/pipeline.rs @@ -64,7 +64,7 @@ fn multiple_contexts_queue() { for i in 0..SRC_NB { let src = gst::ElementFactory::make("ts-udpsrc") - .name(format!("src-{}", i).as_str()) + .name(format!("src-{i}").as_str()) .property("context", format!("context-{}", (i as u32) % CONTEXT_NB)) .property("context-wait", CONTEXT_WAIT) .property("port", (FIRST_PORT + i) as i32) @@ -72,14 +72,14 @@ fn multiple_contexts_queue() { .unwrap(); let queue = gst::ElementFactory::make("ts-queue") - .name(format!("queue-{}", i).as_str()) + .name(format!("queue-{i}").as_str()) .property("context", format!("context-{}", (i as u32) % CONTEXT_NB)) .property("context-wait", CONTEXT_WAIT) .build() .unwrap(); let sink = gst_app::AppSink::builder() - .name(format!("sink-{}", i).as_str()) + .name(format!("sink-{i}").as_str()) .sync(false) .async_(false) .build(); @@ -200,7 +200,7 @@ fn multiple_contexts_proxy() { let pipeline_index = i + OFFSET; let src = gst::ElementFactory::make("ts-udpsrc") - .name(format!("src-{}", pipeline_index).as_str()) + .name(format!("src-{pipeline_index}").as_str()) .property("context", format!("context-{}", (i as u32) % CONTEXT_NB)) .property("context-wait", CONTEXT_WAIT) .property("port", (FIRST_PORT + i) as i32) @@ -208,23 +208,23 @@ fn multiple_contexts_proxy() { .unwrap(); let proxysink = gst::ElementFactory::make("ts-proxysink") - .name(format!("proxysink-{}", pipeline_index).as_str()) - .property("proxy-context", format!("proxy-{}", pipeline_index)) + .name(format!("proxysink-{pipeline_index}").as_str()) + .property("proxy-context", format!("proxy-{pipeline_index}")) .build() .unwrap(); let proxysrc = gst::ElementFactory::make("ts-proxysrc") - .name(format!("proxysrc-{}", pipeline_index).as_str()) + .name(format!("proxysrc-{pipeline_index}").as_str()) .property( "context", &format!("context-{}", (pipeline_index as u32) % CONTEXT_NB), ) - .property("proxy-context", format!("proxy-{}", pipeline_index)) + .property("proxy-context", format!("proxy-{pipeline_index}")) .build() .unwrap(); let sink = gst_app::AppSink::builder() - .name(format!("sink-{}", pipeline_index).as_str()) + .name(format!("sink-{pipeline_index}").as_str()) .sync(false) .async_(false) .build(); @@ -634,7 +634,7 @@ fn socket_play_null_play() { .unwrap(); let sink = gst::ElementFactory::make("ts-udpsink") - .name(format!("sink-{}", TEST).as_str()) + .name(format!("sink-{TEST}").as_str()) .property("socket", &socket) .property("context", TEST) .property("context-wait", 20u32) @@ -705,6 +705,6 @@ fn socket_play_null_play() { let _ = pipeline.set_state(gst::State::Null); if let Err(err) = receiver.recv().unwrap() { - panic!("{}: {}", TEST, err); + panic!("{TEST}: {err}"); } } diff --git a/generic/threadshare/tests/tcpclientsrc.rs b/generic/threadshare/tests/tcpclientsrc.rs index f8b8c2f2..27c9fe1e 100644 --- a/generic/threadshare/tests/tcpclientsrc.rs +++ b/generic/threadshare/tests/tcpclientsrc.rs @@ -100,7 +100,7 @@ fn test_push() { eos = true; break; } - MessageView::Error(err) => panic!("{:?}", err), + MessageView::Error(err) => panic!("{err:?}"), _ => (), } } diff --git a/mux/fmp4/examples/dash_vod.rs b/mux/fmp4/examples/dash_vod.rs index 5dbcea81..8900fcbf 100644 --- a/mux/fmp4/examples/dash_vod.rs +++ b/mux/fmp4/examples/dash_vod.rs @@ -222,8 +222,7 @@ fn main() -> Result<(), Error> { -"###, - duration = duration, segment_timeline = segment_timeline); +"###); std::fs::write(path, manifest).expect("failed to write manifest"); }) diff --git a/mux/mp4/tests/tests.rs b/mux/mp4/tests/tests.rs index d1560b76..b4d480f4 100644 --- a/mux/mp4/tests/tests.rs +++ b/mux/mp4/tests/tests.rs @@ -107,8 +107,7 @@ fn test_basic() { .field("mpegversion", 4i32) .build() ), - "Unexpected audio caps {:?}", - caps + "Unexpected audio caps {caps:?}" ); let video_streams = info.video_streams(); @@ -122,7 +121,6 @@ fn test_basic() { let caps = video_stream.caps().unwrap(); assert!( caps.can_intersect(&gst::Caps::builder("video/x-h264").any_features().build()), - "Unexpected video caps {:?}", - caps + "Unexpected video caps {caps:?}" ); } diff --git a/net/aws/src/aws_transcriber/imp.rs b/net/aws/src/aws_transcriber/imp.rs index 717104e8..3918c61c 100644 --- a/net/aws/src/aws_transcriber/imp.rs +++ b/net/aws/src/aws_transcriber/imp.rs @@ -896,12 +896,11 @@ impl Transcriber { ); if let Some(ref vocabulary) = settings.vocabulary { - query_params.push_str(format!("&vocabulary-name={}", vocabulary).as_str()); + query_params.push_str(format!("&vocabulary-name={vocabulary}").as_str()); } if let Some(ref vocabulary_filter) = settings.vocabulary_filter { - query_params - .push_str(format!("&vocabulary-filter-name={}", vocabulary_filter).as_str()); + query_params.push_str(format!("&vocabulary-filter-name={vocabulary_filter}").as_str()); query_params.push_str( format!( @@ -918,7 +917,7 @@ impl Transcriber { if let Some(ref session_id) = settings.session_id { gst::debug!(CAT, imp: self, "Using session ID: {}", session_id); - query_params.push_str(format!("&session-id={}", session_id).as_str()); + query_params.push_str(format!("&session-id={session_id}").as_str()); } query_params.push_str("&enable-partial-results-stabilization=true"); @@ -951,7 +950,7 @@ impl Transcriber { }; let transcribe_uri = Uri::builder() .scheme("https") - .authority(format!("transcribestreaming.{}.amazonaws.com:8443", region).as_str()) + .authority(format!("transcribestreaming.{region}.amazonaws.com:8443").as_str()) .path_and_query(query_params.clone()) .build() .map_err(|err| { diff --git a/net/aws/src/s3hlssink/imp.rs b/net/aws/src/s3hlssink/imp.rs index 24dea089..bcddd74f 100644 --- a/net/aws/src/s3hlssink/imp.rs +++ b/net/aws/src/s3hlssink/imp.rs @@ -153,7 +153,7 @@ impl S3Upload { let s3_bucket = settings.s3_bucket.as_ref().unwrap().to_string(); let s3_key_prefix = settings.s3_key_prefix.as_ref(); let s3_key = if let Some(key_prefix) = s3_key_prefix { - format!("{}/{}", key_prefix, s3_location) + format!("{key_prefix}/{s3_location}") } else { s3_location }; @@ -718,7 +718,7 @@ impl ObjectImpl for S3HlsSink { let s3_key_prefix = settings.s3_key_prefix.as_ref(); let s3_key = if let Some(key_prefix) = s3_key_prefix { - format!("{}/{}", key_prefix, s3_location) + format!("{key_prefix}/{s3_location}") } else { s3_location.to_string() }; diff --git a/net/aws/src/s3url.rs b/net/aws/src/s3url.rs index 3d601aed..a151ceed 100644 --- a/net/aws/src/s3url.rs +++ b/net/aws/src/s3url.rs @@ -42,14 +42,14 @@ impl ToString for GstS3Url { } pub fn parse_s3_url(url_str: &str) -> Result { - let url = Url::parse(url_str).map_err(|err| format!("Parse error: {}", err))?; + let url = Url::parse(url_str).map_err(|err| format!("Parse error: {err}"))?; if url.scheme() != "s3" { return Err(format!("Unsupported URI '{}'", url.scheme())); } if !url.has_host() { - return Err(format!("Invalid host in uri '{}'", url)); + return Err(format!("Invalid host in uri '{url}'")); } let host = url.host_str().unwrap(); @@ -64,9 +64,9 @@ pub fn parse_s3_url(url_str: &str) -> Result { base32::decode(base32::Alphabet::RFC4648 { padding: true }, endpoint).ok_or(())?; let name = String::from_utf8(name).map_err(|_| ())?; let endpoint = String::from_utf8(endpoint).map_err(|_| ())?; - Ok(format!("{}{}", name, endpoint)) + Ok(format!("{name}{endpoint}")) }) - .map_err(|_: ()| format!("Invalid region '{}'", host))?; + .map_err(|_: ()| format!("Invalid region '{host}'"))?; // Note that aws_sdk_s3::Region does not provide any error/validation // methods to check the region argument being passed to it. @@ -75,23 +75,23 @@ pub fn parse_s3_url(url_str: &str) -> Result { let mut path = url .path_segments() - .ok_or_else(|| format!("Invalid uri '{}'", url))?; + .ok_or_else(|| format!("Invalid uri '{url}'"))?; let bucket = path.next().unwrap().to_string(); let o = path .next() - .ok_or_else(|| format!("Invalid empty object/bucket '{}'", url))?; + .ok_or_else(|| format!("Invalid empty object/bucket '{url}'"))?; let mut object = percent_decode(o.as_bytes()) .decode_utf8() .unwrap() .to_string(); if o.is_empty() { - return Err(format!("Invalid empty object/bucket '{}'", url)); + return Err(format!("Invalid empty object/bucket '{url}'")); } - object = path.fold(object, |o, p| format!("{}/{}", o, p)); + object = path.fold(object, |o, p| format!("{o}/{p}")); let mut q = url.query_pairs(); let v = q.next(); diff --git a/net/aws/tests/s3.rs b/net/aws/tests/s3.rs index a7d0071d..c364a1a8 100644 --- a/net/aws/tests/s3.rs +++ b/net/aws/tests/s3.rs @@ -36,14 +36,14 @@ async fn test_s3() { let bucket = std::env::var("AWS_S3_BUCKET").unwrap_or_else(|_| "gst-plugins-rs-tests".to_string()); let key = format!("s3-test-{:?}.txt", chrono::Utc::now()); - let uri = format!("s3://{}/{}/{}", region, bucket, key); + let uri = format!("s3://{region}/{bucket}/{key}"); let content = "Hello, world!\n".as_bytes(); // Manually add the element so we can configure it before it goes to PLAYING let mut h1 = gst_check::Harness::new_empty(); // Need to add_parse() because the Harness API / Rust bindings aren't conducive to creating and // adding an element manually - h1.add_parse(format!("awss3sink uri={}", uri).as_str()); + h1.add_parse(format!("awss3sink uri={uri}").as_str()); h1.set_src_caps(gst::Caps::builder("text/plain").build()); h1.play(); diff --git a/net/hlssink3/src/imp.rs b/net/hlssink3/src/imp.rs index 96219a81..4864614a 100644 --- a/net/hlssink3/src/imp.rs +++ b/net/hlssink3/src/imp.rs @@ -342,7 +342,7 @@ impl HlsSink3 { let settings = self.settings.lock().unwrap(); if let Some(playlist_root) = &settings.playlist_root { - format!("{}/{}", playlist_root, segment_filename) + format!("{playlist_root}/{segment_filename}") } else { segment_filename } diff --git a/net/reqwest/src/reqwesthttpsrc/imp.rs b/net/reqwest/src/reqwesthttpsrc/imp.rs index 3b129ab2..52dabc32 100644 --- a/net/reqwest/src/reqwesthttpsrc/imp.rs +++ b/net/reqwest/src/reqwesthttpsrc/imp.rs @@ -93,7 +93,7 @@ fn proxy_from_str(s: Option) -> Result, glib::Error> { // If no protocol specified, prepend http for compatibility // https://gstreamer.freedesktop.org/documentation/soup/souphttpsrc.html let url_string = if !not_empty_str.contains("://") { - format!("http://{}", not_empty_str) + format!("http://{not_empty_str}") } else { not_empty_str }; @@ -104,7 +104,7 @@ fn proxy_from_str(s: Option) -> Result, glib::Error> { } Err(err) => Err(glib::Error::new( gst::URIError::BadUri, - format!("Failed to parse URI '{}': {:?}", url_string, err).as_str(), + format!("Failed to parse URI '{url_string}': {err:?}").as_str(), )), } } @@ -190,7 +190,7 @@ impl ReqwestHttpSrc { let uri = Url::parse(uri).map_err(|err| { glib::Error::new( gst::URIError::BadUri, - format!("Failed to parse URI '{}': {:?}", uri, err).as_str(), + format!("Failed to parse URI '{uri}': {err:?}").as_str(), ) })?; @@ -222,8 +222,7 @@ impl ReqwestHttpSrc { return Err(glib::Error::new( gst::URIError::BadState, &format!( - "Changing the `{}` property on a started `reqwesthttpsrc` is not supported", - property_name + "Changing the `{property_name}` property on a started `reqwesthttpsrc` is not supported" ), )); } diff --git a/net/reqwest/tests/reqwesthttpsrc.rs b/net/reqwest/tests/reqwesthttpsrc.rs index 4ea70746..1d0abec9 100644 --- a/net/reqwest/tests/reqwesthttpsrc.rs +++ b/net/reqwest/tests/reqwesthttpsrc.rs @@ -140,12 +140,12 @@ impl Harness { local_addr_sender.send(local_addr).unwrap(); if let Err(e) = server.await { - let _ = sender.send(Message::ServerError(format!("{:?}", e))); + let _ = sender.send(Message::ServerError(format!("{e:?}"))); } }); let local_addr = futures::executor::block_on(local_addr_receiver).unwrap(); - src.set_property("location", format!("http://{}/", local_addr)); + src.set_property("location", format!("http://{local_addr}/")); // Let the test setup anything needed on the HTTP source now setup_func(&src); @@ -162,7 +162,7 @@ impl Harness { loop { match self.receiver.as_mut().unwrap().recv().unwrap() { Message::ServerError(err) => { - panic!("Got server error: {}", err); + panic!("Got server error: {err}"); } Message::Event(ev) => { use gst::EventView; @@ -195,7 +195,7 @@ impl Harness { loop { match self.receiver.as_mut().unwrap().recv().unwrap() { Message::ServerError(err) => { - panic!("Got server error: {}", err); + panic!("Got server error: {err}"); } Message::Event(ev) => { use gst::EventView; @@ -239,7 +239,7 @@ impl Harness { loop { match self.receiver.as_mut().unwrap().recv().unwrap() { Message::ServerError(err) => { - panic!("Got server error: {}", err); + panic!("Got server error: {err}"); } Message::Event(ev) => { use gst::EventView; @@ -286,7 +286,7 @@ impl Harness { loop { match self.receiver.as_mut().unwrap().recv().unwrap() { Message::ServerError(err) => { - panic!("Got server error: {}", err); + panic!("Got server error: {err}"); } Message::Event(ev) => { use gst::EventView; @@ -1227,7 +1227,7 @@ fn test_proxy() { // Listen on socket before spawning thread (we won't error out with connection refused). let incoming = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); let proxy_addr = incoming.local_addr().unwrap(); - println!("listening on {}, starting proxy server", proxy_addr); + println!("listening on {proxy_addr}, starting proxy server"); let proxy_server = std::thread::spawn(move || { use std::io::*; println!("awaiting connection to proxy server"); @@ -1245,7 +1245,7 @@ fn test_proxy() { url.port_or_known_default().unwrap() ); - println!("connecting to target server {}", host); + println!("connecting to target server {host}"); let mut server_connection = std::net::TcpStream::connect(host).unwrap(); println!("connected to target server, sending modified request line"); diff --git a/net/rtp/src/av1/common/aggr_header.rs b/net/rtp/src/av1/common/aggr_header.rs index 74c3462d..65c4865a 100644 --- a/net/rtp/src/av1/common/aggr_header.rs +++ b/net/rtp/src/av1/common/aggr_header.rs @@ -89,7 +89,7 @@ mod tests { #[test] fn test_aggr_header() { for (idx, (byte, header)) in HEADERS.into_iter().enumerate() { - println!("running test {}...", idx); + println!("running test {idx}..."); assert_eq!(byte, header.into()); assert_eq!(header, byte.into()); diff --git a/net/rtp/src/av1/common/integers.rs b/net/rtp/src/av1/common/integers.rs index e084e9d1..aebee7a2 100644 --- a/net/rtp/src/av1/common/integers.rs +++ b/net/rtp/src/av1/common/integers.rs @@ -79,7 +79,7 @@ mod tests { ]; for (value, encoding) in TEST_CASES { - println!("testing: value={}", value); + println!("testing: value={value}"); let mut reader = BitReader::endian(Cursor::new(&encoding), BigEndian); assert_eq!(value, parse_leb128(&mut reader).unwrap()); diff --git a/net/rtp/src/av1/common/obu.rs b/net/rtp/src/av1/common/obu.rs index 53360a72..c223072d 100644 --- a/net/rtp/src/av1/common/obu.rs +++ b/net/rtp/src/av1/common/obu.rs @@ -319,7 +319,7 @@ mod tests { for (idx, (sized_obu, sized_bytes, expected_position, unsized_obu, unsized_bytes)) in (*OBUS).iter().enumerate() { - println!("running test {}...", idx); + println!("running test {idx}..."); { println!(" parsing sized..."); let mut reader = BitReader::endian(Cursor::new(&sized_bytes), BigEndian); @@ -345,7 +345,7 @@ mod tests { #[test] fn test_conversion() { for (idx, (sized_obu, _, _, unsized_obu, _)) in (*OBUS).iter().enumerate() { - println!("running test {}...", idx); + println!("running test {idx}..."); assert_eq!( unsized_obu.as_sized(sized_obu.size, sized_obu.leb_size), SizedObu { @@ -404,7 +404,7 @@ mod tests { ]; for (idx, (sized_obu, rtp_bytes)) in obus.into_iter().enumerate() { - println!("running test {}...", idx); + println!("running test {idx}..."); let mut reader = BitReader::endian(Cursor::new(&rtp_bytes), BigEndian); diff --git a/net/rtp/src/av1/depay/imp.rs b/net/rtp/src/av1/depay/imp.rs index 2312026e..0270d2dd 100644 --- a/net/rtp/src/av1/depay/imp.rs +++ b/net/rtp/src/av1/depay/imp.rs @@ -509,7 +509,7 @@ mod tests { let element = ::Type::new(); for (idx, (obu, rtp_bytes, out_bytes)) in test_data.into_iter().enumerate() { - println!("running test {}...", idx); + println!("running test {idx}..."); let mut reader = Cursor::new(rtp_bytes.as_slice()); let actual = element.imp().translate_obu(&mut reader, &obu); @@ -560,7 +560,7 @@ mod tests { rtp_bytes, aggr_header, )) in test_data.into_iter().enumerate() { - println!("running test {}...", idx); + println!("running test {idx}..."); let buffer = gst::Buffer::new_rtp_with_sizes(payload_size, 0, 0).unwrap(); let rtp = gst_rtp::RTPBuffer::from_buffer_readable(&buffer).unwrap(); let mut reader = Cursor::new(rtp_bytes.as_slice()); diff --git a/net/rtp/src/av1/pay/imp.rs b/net/rtp/src/av1/pay/imp.rs index 0ec6b79b..bd6aa8d1 100644 --- a/net/rtp/src/av1/pay/imp.rs +++ b/net/rtp/src/av1/pay/imp.rs @@ -860,7 +860,7 @@ mod tests { let element = ::Type::new(); let pay = element.imp(); for idx in 0..input_data.len() { - println!("running test {}...", idx); + println!("running test {idx}..."); let mut state = pay.state.lock().unwrap(); *state = input_data[idx].1.clone(); diff --git a/net/rtp/src/gcc/imp.rs b/net/rtp/src/gcc/imp.rs index 4f8f24c9..bbf5b776 100644 --- a/net/rtp/src/gcc/imp.rs +++ b/net/rtp/src/gcc/imp.rs @@ -865,9 +865,7 @@ impl State { assert!( rate >= self.target_bitrate_on_delay as f64, - "Increase: {} - {}", - rate, - eta + "Increase: {rate} - {eta}" ); // Maximum increase to 1.5 * received rate diff --git a/net/rtp/tests/rtpav1.rs b/net/rtp/tests/rtpav1.rs index d8623c52..306e9d7e 100644 --- a/net/rtp/tests/rtpav1.rs +++ b/net/rtp/tests/rtpav1.rs @@ -99,7 +99,7 @@ fn test_depayloader() { h.push_event(Eos::new()); for (idx, ex) in expected.iter().enumerate() { - println!("checking buffer {}...", idx); + println!("checking buffer {idx}..."); let buffer = h.pull().unwrap(); let actual = buffer.into_mapped_buffer_readable().unwrap(); @@ -209,7 +209,7 @@ fn test_payloader() { let mut base_ts = None; for (idx, (marker, ts_offset, payload)) in expected.iter().enumerate() { - println!("checking packet {}...", idx); + println!("checking packet {idx}..."); let buffer = h.pull().unwrap(); let packet = RTPBuffer::from_buffer_readable(&buffer).unwrap(); diff --git a/net/webrtc/signalling/src/handlers/mod.rs b/net/webrtc/signalling/src/handlers/mod.rs index 0c86a5c0..0e39f77e 100644 --- a/net/webrtc/signalling/src/handlers/mod.rs +++ b/net/webrtc/signalling/src/handlers/mod.rs @@ -96,7 +96,7 @@ impl Handler { let session = self .sessions .get(session_id) - .context(format!("Session {} doesn't exist", session_id))? + .context(format!("Session {session_id} doesn't exist"))? .clone(); if matches!( @@ -526,7 +526,7 @@ mod tests { assert_eq!(peer_id, "producer"); session_id.to_string() } - _ => panic!("SessionStarted message missing {:?}", sent_message), + _ => panic!("SessionStarted message missing {sent_message:?}"), }; let (peer_id, sent_message) = handler.next().await.unwrap(); @@ -1212,7 +1212,7 @@ mod tests { assert_eq!(peer_id, "producer"); session_id.to_string() } - _ => panic!("SessionStarted message missing {:?}", sent_message), + _ => panic!("SessionStarted message missing {sent_message:?}"), }; let (peer_id, sent_message) = handler.next().await.unwrap(); diff --git a/net/webrtc/signalling/src/server/mod.rs b/net/webrtc/signalling/src/server/mod.rs index 85fbf5e4..e6ff1162 100644 --- a/net/webrtc/signalling/src/server/mod.rs +++ b/net/webrtc/signalling/src/server/mod.rs @@ -69,7 +69,7 @@ impl Server { })); let state_clone = state.clone(); - let _ = task::spawn(async move { + task::spawn(async move { while let Some((peer_id, msg)) = handler.next().await { match serde_json::to_string(&msg) { Ok(msg) => { diff --git a/net/webrtc/src/webrtcsink/homegrown_cc.rs b/net/webrtc/src/webrtcsink/homegrown_cc.rs index fc8dbea3..bbe9d124 100644 --- a/net/webrtc/src/webrtcsink/homegrown_cc.rs +++ b/net/webrtc/src/webrtcsink/homegrown_cc.rs @@ -139,11 +139,11 @@ impl CongestionController { if delay_factor > 0.1 { let (factor, reason) = if delay_factor < 0.64 { - (0.96, format!("low delay factor {}", delay_factor)) + (0.96, format!("low delay factor {delay_factor}")) } else { ( delay_factor.sqrt().sqrt().clamp(0.8, 0.96), - format!("High delay factor {}", delay_factor), + format!("High delay factor {delay_factor}"), ) }; @@ -151,7 +151,7 @@ impl CongestionController { } else if delta_of_delta > 1_000_000 { CongestionControlOp::Decrease { factor: 0.97, - reason: format!("High delta: {}", delta_of_delta), + reason: format!("High delta: {delta_of_delta}"), } } else { CongestionControlOp::Increase(if let Some(ema) = self.bitrate_ema { @@ -303,7 +303,7 @@ impl CongestionController { if loss_percentage > 10. { CongestionControlOp::Decrease { factor: ((100. - (0.5 * loss_percentage)) / 100.).clamp(0.7, 0.98), - reason: format!("High loss: {}", loss_percentage), + reason: format!("High loss: {loss_percentage}"), } } else if loss_percentage > 2. { CongestionControlOp::Hold diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index e235bc20..4552b86e 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -241,7 +241,7 @@ pub fn make_element(element: &str, name: Option<&str>) -> Result("transceiver"); @@ -1402,10 +1402,10 @@ impl WebRTCSink { ); let pipeline = gst::Pipeline::builder() - .name(format!("session-pipeline-{}", session_id)) + .name(format!("session-pipeline-{session_id}")) .build(); - let webrtcbin = make_element("webrtcbin", Some(&format!("webrtcbin-{}", session_id))) + let webrtcbin = make_element("webrtcbin", Some(&format!("webrtcbin-{session_id}"))) .map_err(|err| WebRTCSinkError::SessionPipelineError { session_id: session_id.clone(), peer_id: peer_id.clone(), @@ -1922,7 +1922,7 @@ impl WebRTCSink { session.pipeline.debug_to_dot_file_with_ts( gst::DebugGraphDetails::all(), - format!("webrtcsink-peer-{}-remote-description-set", session_id,), + format!("webrtcsink-peer-{session_id}-remote-description-set",), ); let element_clone = element.downgrade(); @@ -2092,7 +2092,7 @@ impl WebRTCSink { let elements_slice = &elements.iter().collect::>(); pipe.0.add_many(elements_slice).unwrap(); gst::Element::link_many(elements_slice) - .with_context(|| format!("Running discovery pipeline for caps {}", caps))?; + .with_context(|| format!("Running discovery pipeline for caps {caps}"))?; let (_, _, pay) = setup_encoding(&pipe.0, &capsfilter, caps, codec, None, true)?; @@ -2101,7 +2101,7 @@ impl WebRTCSink { pipe.0.add(&sink).unwrap(); pay.link(&sink) - .with_context(|| format!("Running discovery pipeline for caps {}", caps))?; + .with_context(|| format!("Running discovery pipeline for caps {caps}"))?; capsfilter.set_property("caps", caps); @@ -2111,7 +2111,7 @@ impl WebRTCSink { pipe.0 .set_state(gst::State::Playing) - .with_context(|| format!("Running discovery pipeline for caps {}", caps))?; + .with_context(|| format!("Running discovery pipeline for caps {caps}"))?; let in_caps = caps; diff --git a/tutorial/src/progressbin/imp.rs b/tutorial/src/progressbin/imp.rs index ad3a920d..215c97ed 100644 --- a/tutorial/src/progressbin/imp.rs +++ b/tutorial/src/progressbin/imp.rs @@ -233,7 +233,7 @@ impl BinImpl for ProgressBin { if let Ok(percent) = s.get::("percent-double") { let output_type = *self.output_type.lock().unwrap(); match output_type { - ProgressBinOutput::Println => println!("progress: {:5.1}%", percent), + ProgressBinOutput::Println => println!("progress: {percent:5.1}%"), ProgressBinOutput::DebugCategory => { gst::info!(CAT, imp: self, "progress: {:5.1}%", percent); } diff --git a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs index 0f295725..c824b6a1 100644 --- a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs +++ b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs @@ -116,7 +116,7 @@ fn create_ui(app: >k::Application) { let position = video_sink .query_position::() .unwrap_or(gst::ClockTime::ZERO); - position_label.set_text(&format!("Position: {:.1}", position)); + position_label.set_text(&format!("Position: {position:.1}")); glib::Continue(true) }); diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index 6b7e1590..5db9ba0e 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -1336,7 +1336,7 @@ impl ElementImpl for FallbackSwitch { let pad = gst::PadBuilder::::from_template( templ, - Some(format!("sink_{}", pad_serial).as_str()), + Some(format!("sink_{pad_serial}").as_str()), ) .chain_function(|pad, parent, buffer| { FallbackSwitch::catch_panic_pad_function( diff --git a/utils/togglerecord/examples/gtk_recording.rs b/utils/togglerecord/examples/gtk_recording.rs index ab5d441a..ff3af6ae 100644 --- a/utils/togglerecord/examples/gtk_recording.rs +++ b/utils/togglerecord/examples/gtk_recording.rs @@ -232,14 +232,14 @@ fn create_ui(app: >k::Application) { let position = video_sink .query_position::() .unwrap_or(gst::ClockTime::ZERO); - position_label.set_text(&format!("Position: {:.1}", position)); + position_label.set_text(&format!("Position: {position:.1}")); let recording_duration = togglerecord .static_pad("src") .unwrap() .query_position::() .unwrap_or(gst::ClockTime::ZERO); - recorded_duration_label.set_text(&format!("Recorded: {:.1}", recording_duration)); + recorded_duration_label.set_text(&format!("Recorded: {recording_duration:.1}")); glib::Continue(true) }); diff --git a/utils/togglerecord/src/togglerecord/imp.rs b/utils/togglerecord/src/togglerecord/imp.rs index 55052134..beffa206 100644 --- a/utils/togglerecord/src/togglerecord/imp.rs +++ b/utils/togglerecord/src/togglerecord/imp.rs @@ -2002,40 +2002,39 @@ impl ElementImpl for ToggleRecord { *pad_count += 1; let templ = self.obj().pad_template("sink_%u").unwrap(); - let sinkpad = - gst::Pad::builder_with_template(&templ, Some(format!("sink_{}", id).as_str())) - .chain_function(|pad, parent, buffer| { - ToggleRecord::catch_panic_pad_function( - parent, - || Err(gst::FlowError::Error), - |togglerecord| togglerecord.sink_chain(pad, buffer), - ) - }) - .event_function(|pad, parent, event| { - ToggleRecord::catch_panic_pad_function( - parent, - || false, - |togglerecord| togglerecord.sink_event(pad, event), - ) - }) - .query_function(|pad, parent, query| { - ToggleRecord::catch_panic_pad_function( - parent, - || false, - |togglerecord| togglerecord.sink_query(pad, query), - ) - }) - .iterate_internal_links_function(|pad, parent| { - ToggleRecord::catch_panic_pad_function( - parent, - || gst::Iterator::from_vec(vec![]), - |togglerecord| togglerecord.iterate_internal_links(pad), - ) - }) - .build(); + let sinkpad = gst::Pad::builder_with_template(&templ, Some(format!("sink_{id}").as_str())) + .chain_function(|pad, parent, buffer| { + ToggleRecord::catch_panic_pad_function( + parent, + || Err(gst::FlowError::Error), + |togglerecord| togglerecord.sink_chain(pad, buffer), + ) + }) + .event_function(|pad, parent, event| { + ToggleRecord::catch_panic_pad_function( + parent, + || false, + |togglerecord| togglerecord.sink_event(pad, event), + ) + }) + .query_function(|pad, parent, query| { + ToggleRecord::catch_panic_pad_function( + parent, + || false, + |togglerecord| togglerecord.sink_query(pad, query), + ) + }) + .iterate_internal_links_function(|pad, parent| { + ToggleRecord::catch_panic_pad_function( + parent, + || gst::Iterator::from_vec(vec![]), + |togglerecord| togglerecord.iterate_internal_links(pad), + ) + }) + .build(); let templ = self.obj().pad_template("src_%u").unwrap(); - let srcpad = gst::Pad::builder_with_template(&templ, Some(format!("src_{}", id).as_str())) + let srcpad = gst::Pad::builder_with_template(&templ, Some(format!("src_{id}").as_str())) .event_function(|pad, parent, event| { ToggleRecord::catch_panic_pad_function( parent, diff --git a/utils/tracers/src/buffer_lateness/imp.rs b/utils/tracers/src/buffer_lateness/imp.rs index 117ad71e..48228750 100644 --- a/utils/tracers/src/buffer_lateness/imp.rs +++ b/utils/tracers/src/buffer_lateness/imp.rs @@ -85,7 +85,7 @@ impl Default for Settings { impl Settings { fn update_from_params(&mut self, imp: &BufferLateness, params: String) { - let s = match gst::Structure::from_str(&format!("buffer-lateness,{}", params)) { + let s = match gst::Structure::from_str(&format!("buffer-lateness,{params}")) { Ok(s) => s, Err(err) => { gst::warning!(CAT, imp: imp, "failed to parse tracer parameters: {}", err); diff --git a/utils/tracers/src/pipeline_snapshot/imp.rs b/utils/tracers/src/pipeline_snapshot/imp.rs index 7c041f04..d4ab6b8e 100644 --- a/utils/tracers/src/pipeline_snapshot/imp.rs +++ b/utils/tracers/src/pipeline_snapshot/imp.rs @@ -90,7 +90,7 @@ impl Default for Settings { impl Settings { fn update_from_params(&mut self, imp: &PipelineSnapshot, params: String) { - let s = match gst::Structure::from_str(&format!("pipeline-snapshot,{}", params)) { + let s = match gst::Structure::from_str(&format!("pipeline-snapshot,{params}")) { Ok(s) => s, Err(err) => { gst::warning!(CAT, imp: imp, "failed to parse tracer parameters: {}", err); diff --git a/utils/tracers/src/queue_levels/imp.rs b/utils/tracers/src/queue_levels/imp.rs index 959ee195..8abc07ea 100644 --- a/utils/tracers/src/queue_levels/imp.rs +++ b/utils/tracers/src/queue_levels/imp.rs @@ -116,7 +116,7 @@ impl Default for Settings { impl Settings { fn update_from_params(&mut self, imp: &QueueLevels, params: String) { - let s = match gst::Structure::from_str(&format!("queue-levels,{}", params)) { + let s = match gst::Structure::from_str(&format!("queue-levels,{params}")) { Ok(s) => s, Err(err) => { gst::warning!(CAT, imp: imp, "failed to parse tracer parameters: {}", err); diff --git a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs index d05abf83..3b6ae3ec 100644 --- a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs +++ b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs @@ -36,7 +36,7 @@ impl std::fmt::Display for PlaylistError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { PlaylistError::PluginMissing { error } => { - write!(f, "{}", error) + write!(f, "{error}") } PlaylistError::ItemFailed { error, item } => { write!(f, "{} (URI: {})", error, item.uri()) diff --git a/version-helper/src/git.rs b/version-helper/src/git.rs index 68bb2066..0da474ae 100644 --- a/version-helper/src/git.rs +++ b/version-helper/src/git.rs @@ -24,7 +24,7 @@ pub fn repo_hash>(path: P) -> Option<(String, String)> { let date = s.next()?; let hash = if dirty(path) { - format!("{}+", hash) + format!("{hash}+") } else { hash.into() }; diff --git a/version-helper/src/lib.rs b/version-helper/src/lib.rs index cc7455d7..899514a8 100644 --- a/version-helper/src/lib.rs +++ b/version-helper/src/lib.rs @@ -74,8 +74,8 @@ pub fn info() { ("RELEASE".into(), date.format("%Y-%m-%d").to_string()) }); - println!("cargo:rustc-env=COMMIT_ID={}", commit_id); - println!("cargo:rustc-env=BUILD_REL_DATE={}", commit_date); + println!("cargo:rustc-env=COMMIT_ID={commit_id}"); + println!("cargo:rustc-env=BUILD_REL_DATE={commit_date}"); } fn cargo_mtime_date(crate_dir: path::PathBuf) -> Option> { diff --git a/video/closedcaption/src/cea608tott/imp.rs b/video/closedcaption/src/cea608tott/imp.rs index 92bd01f8..c265dc7a 100644 --- a/video/closedcaption/src/cea608tott/imp.rs +++ b/video/closedcaption/src/cea608tott/imp.rs @@ -201,11 +201,10 @@ impl Cea608ToTt { writeln!( &mut data, - "{:02}:{:02}:{:02}.{:03} --> {:02}:{:02}:{:02}.{:03}\r", - h1, m1, s1, ms1, h2, m2, s2, ms2 + "{h1:02}:{m1:02}:{s1:02}.{ms1:03} --> {h2:02}:{m2:02}:{s2:02}.{ms2:03}\r" ) .unwrap(); - writeln!(&mut data, "{}\r", text).unwrap(); + writeln!(&mut data, "{text}\r").unwrap(); writeln!(&mut data, "\r").unwrap(); let mut buffer = gst::Buffer::from_mut_slice(data.into_bytes()); @@ -231,14 +230,13 @@ impl Cea608ToTt { let (h1, m1, s1, ms1) = Self::split_time(timestamp); let (h2, m2, s2, ms2) = Self::split_time(timestamp + duration); - writeln!(&mut data, "{}\r", index).unwrap(); + writeln!(&mut data, "{index}\r").unwrap(); writeln!( &mut data, - "{:02}:{:02}:{:02},{:03} --> {:02}:{:02}:{:02},{:03}\r", - h1, m1, s1, ms1, h2, m2, s2, ms2 + "{h1:02}:{m1:02}:{s1:02},{ms1:03} --> {h2:02}:{m2:02}:{s2:02},{ms2:03}\r" ) .unwrap(); - writeln!(&mut data, "{}\r", text).unwrap(); + writeln!(&mut data, "{text}\r").unwrap(); writeln!(&mut data, "\r").unwrap(); let mut buffer = gst::Buffer::from_mut_slice(data.into_bytes()); diff --git a/video/closedcaption/src/jsontovtt/imp.rs b/video/closedcaption/src/jsontovtt/imp.rs index 5e0fb44e..42e02940 100644 --- a/video/closedcaption/src/jsontovtt/imp.rs +++ b/video/closedcaption/src/jsontovtt/imp.rs @@ -155,11 +155,10 @@ impl State { writeln!( &mut data, - "{:02}:{:02}:{:02}.{:03} --> {:02}:{:02}:{:02}.{:03}", - h1, m1, s1, ms1, h2, m2, s2, ms2 + "{h1:02}:{m1:02}:{s1:02}.{ms1:03} --> {h2:02}:{m2:02}:{s2:02}.{ms2:03}" ) .unwrap(); - writeln!(&mut data, "{}", text).unwrap(); + writeln!(&mut data, "{text}").unwrap(); let mut buffer = gst::Buffer::from_mut_slice(data.into_bytes()); { diff --git a/video/closedcaption/src/mcc_enc/imp.rs b/video/closedcaption/src/mcc_enc/imp.rs index 4524b1f0..32656e88 100644 --- a/video/closedcaption/src/mcc_enc/imp.rs +++ b/video/closedcaption/src/mcc_enc/imp.rs @@ -77,7 +77,7 @@ impl MccEnc { Err(structure::GetError::FieldNotFound { .. }) => { return Err(gst::FlowError::NotNegotiated); } - err => panic!("MccEnc::generate_headers caps: {:?}", err), + err => panic!("MccEnc::generate_headers caps: {err:?}"), }; if framerate == gst::Fraction::new(60000, 1001) { @@ -87,7 +87,7 @@ impl MccEnc { } if let Some(ref uuid) = settings.uuid { - let _ = write!(buffer, "UUID={}\r\n", uuid); + let _ = write!(buffer, "UUID={uuid}\r\n"); } else { let _ = write!(buffer, "UUID={:X}\r\n", Uuid::new_v4().as_hyphenated()); } @@ -291,10 +291,10 @@ impl MccEnc { match state.format { Some(Format::Cea608) => { - let _ = write!(outbuf, "6102{:02X}", len); + let _ = write!(outbuf, "6102{len:02X}"); } Some(Format::Cea708Cdp) => { - let _ = write!(outbuf, "T{:02X}", len); + let _ = write!(outbuf, "T{len:02X}"); } _ => return Err(gst::FlowError::NotNegotiated), }; @@ -305,7 +305,7 @@ impl MccEnc { if checksum == 0 { outbuf.push(b'Z'); } else { - let _ = write!(outbuf, "{:02X}", checksum); + let _ = write!(outbuf, "{checksum:02X}"); } outbuf.extend_from_slice(b"\r\n".as_ref()); @@ -354,7 +354,7 @@ impl MccEnc { gst::error!(CAT, obj: pad, "Caps without framerate"); return false; } - err => panic!("MccEnc::sink_event caps: {:?}", err), + err => panic!("MccEnc::sink_event caps: {err:?}"), }; let mut state = self.state.lock().unwrap(); diff --git a/video/closedcaption/src/mcc_parse/parser.rs b/video/closedcaption/src/mcc_parse/parser.rs index 0d818e1e..6c847b21 100644 --- a/video/closedcaption/src/mcc_parse/parser.rs +++ b/video/closedcaption/src/mcc_parse/parser.rs @@ -682,7 +682,7 @@ mod tests { while let Some(line) = reader.line() { let res = match parser.parse_line(line, true) { Ok(res) => res, - Err(err) => panic!("Couldn't parse line {}: {:?}", line_cnt, err), + Err(err) => panic!("Couldn't parse line {line_cnt}: {err:?}"), }; match line_cnt { @@ -714,7 +714,7 @@ mod tests { 42 => assert_eq!(res, MccLine::TimeCodeRate(30, true)), _ => match res { MccLine::Caption(_, _) => (), - res => panic!("Expected caption at line {}, got {:?}", line_cnt, res), + res => panic!("Expected caption at line {line_cnt}, got {res:?}"), }, } diff --git a/video/closedcaption/src/scc_enc/imp.rs b/video/closedcaption/src/scc_enc/imp.rs index 58c2b497..c2d24af5 100644 --- a/video/closedcaption/src/scc_enc/imp.rs +++ b/video/closedcaption/src/scc_enc/imp.rs @@ -197,7 +197,7 @@ impl State { .expect("Buffer without timecode") .tc(); - let _ = write!(outbuf, "{}\t", timecode); + let _ = write!(outbuf, "{timecode}\t"); line_start = false; } else { outbuf.push(b' '); @@ -280,7 +280,7 @@ impl SccEnc { gst::error!(CAT, obj: pad, "Caps without framerate"); return false; } - err => panic!("SccEnc::sink_event caps: {:?}", err), + err => panic!("SccEnc::sink_event caps: {err:?}"), }; let mut state = self.state.lock().unwrap(); diff --git a/video/closedcaption/src/scc_parse/parser.rs b/video/closedcaption/src/scc_parse/parser.rs index 603112d7..8f299847 100644 --- a/video/closedcaption/src/scc_parse/parser.rs +++ b/video/closedcaption/src/scc_parse/parser.rs @@ -340,7 +340,7 @@ mod tests { while let Some(line) = reader.line() { let res = match parser.parse_line(line) { Ok(res) => res, - Err(err) => panic!("Couldn't parse line {}: {:?}", line_cnt, err), + Err(err) => panic!("Couldn't parse line {line_cnt}: {err:?}"), }; match line_cnt { @@ -348,7 +348,7 @@ mod tests { x if x % 2 != 0 => assert_eq!(res, SccLine::Empty), _ => match res { SccLine::Caption(_, _) => (), - res => panic!("Expected caption at line {}, got {:?}", line_cnt, res), + res => panic!("Expected caption at line {line_cnt}, got {res:?}"), }, } diff --git a/video/closedcaption/tests/mcc_parse.rs b/video/closedcaption/tests/mcc_parse.rs index 8c67fae8..fc438d72 100644 --- a/video/closedcaption/tests/mcc_parse.rs +++ b/video/closedcaption/tests/mcc_parse.rs @@ -37,7 +37,7 @@ fn test_parse() { ) } else { let seed = rand::random::(); - println!("seed {}", seed); + println!("seed {seed}"); rand::rngs::SmallRng::seed_from_u64(seed) }; @@ -132,7 +132,7 @@ fn test_pull() { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); path.push("tests/captions-test_708.mcc"); - let mut h = gst_check::Harness::new_parse(&format!("filesrc location={:?} ! mccparse", path)); + let mut h = gst_check::Harness::new_parse(&format!("filesrc location={path:?} ! mccparse")); h.play(); diff --git a/video/closedcaption/tests/scc_parse.rs b/video/closedcaption/tests/scc_parse.rs index 542ed711..8b20ab5e 100644 --- a/video/closedcaption/tests/scc_parse.rs +++ b/video/closedcaption/tests/scc_parse.rs @@ -40,7 +40,7 @@ fn test_parse() { ) } else { let seed = rand::random::(); - println!("seed {}", seed); + println!("seed {seed}"); rand::rngs::SmallRng::seed_from_u64(seed) }; @@ -199,7 +199,7 @@ fn test_pull() { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); path.push("tests/dn2018-1217.scc"); - let mut h = gst_check::Harness::new_parse(&format!("filesrc location={:?} ! sccparse", path)); + let mut h = gst_check::Harness::new_parse(&format!("filesrc location={path:?} ! sccparse")); h.play(); diff --git a/video/ffv1/tests/ffv1dec.rs b/video/ffv1/tests/ffv1dec.rs index dd5b9c30..d1ae38ad 100644 --- a/video/ffv1/tests/ffv1dec.rs +++ b/video/ffv1/tests/ffv1dec.rs @@ -33,12 +33,11 @@ fn test_decode_yuv420p() { fn test_decode(name: &str) { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - path.push(format!("tests/ffv1_v3_{}.mkv", name)); + path.push(format!("tests/ffv1_v3_{name}.mkv")); let bin = gst::parse_bin_from_description( &format!( - "filesrc location={:?} ! matroskademux name=m m.video_0 ! ffv1dec name=ffv1dec", - path + "filesrc location={path:?} ! matroskademux name=m m.video_0 ! ffv1dec name=ffv1dec" ), false, ) @@ -55,7 +54,7 @@ fn test_decode(name: &str) { let frame = buf.into_mapped_buffer_readable().unwrap(); let mut refpath = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - refpath.push(format!("tests/ffv1_v3_{}.ref", name)); + refpath.push(format!("tests/ffv1_v3_{name}.ref")); let ref_frame = fs::read(refpath).unwrap(); diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index b8648de1..2f2e7bee 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -370,7 +370,7 @@ impl BaseSinkImpl for PaintableSink { if let Err(err) = buffer_pool.set_config(config) { return Err(gst::loggable_error!( CAT, - format!("Failed to set config in the GL BufferPool.: {}", err) + format!("Failed to set config in the GL BufferPool.: {err}") )); } diff --git a/video/videofx/tests/videocompare.rs b/video/videofx/tests/videocompare.rs index 2af33cae..f07089d9 100644 --- a/video/videofx/tests/videocompare.rs +++ b/video/videofx/tests/videocompare.rs @@ -134,7 +134,7 @@ fn test_do_not_send_message_when_image_not_found() { pipeline.set_state(gst::State::Null).unwrap(); if let Some(detection) = detection { - panic!("Got unexpected detection message {:?}", detection); + panic!("Got unexpected detection message {detection:?}"); } }