diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-01-25 11:23:46 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-01-25 11:31:19 +0300 |
commit | 3b4c48d9f55ae5bfb6eb4fe485edf54f8916d955 (patch) | |
tree | 69f065a49d4035b924d0c1f7025186d597a55590 /generic | |
parent | ad3f1cf534b475d47d4ef4d0e8916d507c6e56e5 (diff) |
Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1062>
Diffstat (limited to 'generic')
-rw-r--r-- | generic/file/src/file_location.rs | 14 | ||||
-rw-r--r-- | generic/file/src/filesrc/imp.rs | 4 | ||||
-rw-r--r-- | generic/threadshare/examples/benchmark.rs | 16 | ||||
-rw-r--r-- | generic/threadshare/examples/udpsrc_benchmark_sender.rs | 12 | ||||
-rw-r--r-- | generic/threadshare/src/runtime/executor/context.rs | 2 | ||||
-rw-r--r-- | generic/threadshare/src/runtime/executor/scheduler.rs | 2 | ||||
-rw-r--r-- | generic/threadshare/src/runtime/task.rs | 96 | ||||
-rw-r--r-- | generic/threadshare/src/socket.rs | 4 | ||||
-rw-r--r-- | generic/threadshare/src/tcpclientsrc/imp.rs | 3 | ||||
-rw-r--r-- | generic/threadshare/tests/pad.rs | 96 | ||||
-rw-r--r-- | generic/threadshare/tests/pipeline.rs | 22 | ||||
-rw-r--r-- | generic/threadshare/tests/tcpclientsrc.rs | 2 |
12 files changed, 146 insertions, 127 deletions
diff --git a/generic/file/src/file_location.rs b/generic/file/src/file_location.rs index 266845653..788354541 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 1faa24b69..bc68ad798 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 3903f7a1f..9ecfce632 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 2ba9e24fd..497225d4f 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<i32>) { 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<i32>) { } 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<i32>) { 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<i32>) { } 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 e12fdcbbb..8f4321514 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 bf7c65c47..8552a5201 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 2277df941..0ac007746 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 3ac650d94..a815c213b 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 71e702b59..cbbf2505f 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 da0eb28d6..dd17d29e0 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 caa66ac6c..6b9f55343 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 f8b8c2f26..27c9fe1ec 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:?}"), _ => (), } } |