Fix various new clippy 1.88 warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2323>
This commit is contained in:
Sebastian Dröge 2025-06-26 22:50:31 +03:00
parent ff2b71cbbd
commit 2d61a4cc06
31 changed files with 98 additions and 125 deletions

View file

@ -271,7 +271,7 @@ impl HrtfRender {
// Convert to Right Handed, this is what HRTF crate expects
let new_sample_vector = Vec3 {
z: new_sample_vector.z * -1.0,
z: -new_sample_vector.z,
..new_sample_vector
};

View file

@ -43,7 +43,7 @@ async fn main() -> Result<(), Error> {
MessageView::Latency(..) => {
if let Some(o) = msg.src() {
if let Ok(pipeline) = toplevel(o).downcast::<gst::Pipeline>() {
eprintln!("Recalculating latency {:?}", pipeline);
eprintln!("Recalculating latency {pipeline:?}");
let _ = pipeline.recalculate_latency();
}
}

View file

@ -244,7 +244,7 @@ fn test_encode_uncompressed(video_format: &str, width: u32, height: u32) {
let temp_dir = tempdir().unwrap();
let temp_file_path = temp_dir.path().join(filename);
let location = temp_file_path.as_path();
let pipeline_text = format!("videotestsrc num-buffers=34 ! video/x-raw,format={video_format},width={width},height={height} ! isomp4mux ! filesink location={:?}", location);
let pipeline_text = format!("videotestsrc num-buffers=34 ! video/x-raw,format={video_format},width={width},height={height} ! isomp4mux ! filesink location={location:?}");
let Ok(pipeline) = gst::parse::launch(&pipeline_text) else {
panic!("could not build encoding pipeline")
@ -349,8 +349,7 @@ fn check_generic_single_trak_file_structure(
}
assert!(
required_top_level_boxes.is_empty(),
"expected all top level boxes to be found, but these were missed: {:?}",
required_top_level_boxes
"expected all top level boxes to be found, but these were missed: {required_top_level_boxes:?}"
);
}
@ -577,7 +576,7 @@ fn test_encode_uncompressed_image_sequence(video_format: &str, width: u32, heigh
let temp_dir = tempdir().unwrap();
let temp_file_path = temp_dir.path().join(filename);
let location = temp_file_path.as_path();
let pipeline_text = format!("videotestsrc num-buffers=10 ! video/x-raw,format={video_format},width={width},height={height} ! isomp4mux name=mux ! filesink location={:?}", location);
let pipeline_text = format!("videotestsrc num-buffers=10 ! video/x-raw,format={video_format},width={width},height={height} ! isomp4mux name=mux ! filesink location={location:?}");
let Ok(pipeline) = gst::parse::launch(&pipeline_text) else {
panic!("could not build encoding pipeline")
@ -650,7 +649,7 @@ fn test_encode_audio_trak() {
let temp_dir = tempdir().unwrap();
let temp_file_path = temp_dir.path().join(filename);
let location = temp_file_path.as_path();
let pipeline_text = format!("audiotestsrc num-buffers=100 ! audioconvert ! opusenc ! isomp4mux ! filesink location={:?}", location);
let pipeline_text = format!("audiotestsrc num-buffers=100 ! audioconvert ! opusenc ! isomp4mux ! filesink location={location:?}");
let Ok(pipeline) = gst::parse::launch(&pipeline_text) else {
panic!("could not build encoding pipeline")
@ -972,7 +971,7 @@ fn check_uncv_codec_sanity(uncv: &mp4_atom::Uncv, expected_config: &ExpectedConf
} => {
assert!(uncv.cmpd.is_some());
let cmpd = uncv.cmpd.as_ref().unwrap();
println!("profile: {:?}", profile);
println!("profile: {profile:?}");
assert!(valid_v0_profiles.contains(profile));
assert!(!components.is_empty());
for component in components {
@ -1021,7 +1020,7 @@ fn test_taic_encode(video_enc: &str) {
let temp_dir = tempdir().unwrap();
let temp_file_path = temp_dir.path().join(filename);
let location = temp_file_path.as_path();
let pipeline_text = format!("videotestsrc num-buffers=250 ! {video_enc} ! taginject tags=\"precision-clock-type=can-sync-to-TAI,precision-clock-time-uncertainty-nanoseconds=100000\" scope=stream ! isomp4mux ! filesink location={:?}", location);
let pipeline_text = format!("videotestsrc num-buffers=250 ! {video_enc} ! taginject tags=\"precision-clock-type=can-sync-to-TAI,precision-clock-time-uncertainty-nanoseconds=100000\" scope=stream ! isomp4mux ! filesink location={location:?}");
let Ok(pipeline) = gst::parse::launch(&pipeline_text) else {
panic!("could not build encoding pipeline")
@ -1072,7 +1071,7 @@ fn test_taic_encode_cannot_sync(video_enc: &str) {
let temp_dir = tempdir().unwrap();
let temp_file_path = temp_dir.path().join(filename);
let location = temp_file_path.as_path();
let pipeline_text = format!("videotestsrc num-buffers=250 ! {video_enc} ! taginject tags=\"precision-clock-type=cannot-sync-to-TAI\" scope=stream ! isomp4mux ! filesink location={:?}", location);
let pipeline_text = format!("videotestsrc num-buffers=250 ! {video_enc} ! taginject tags=\"precision-clock-type=cannot-sync-to-TAI\" scope=stream ! isomp4mux ! filesink location={location:?}");
let Ok(pipeline) = gst::parse::launch(&pipeline_text) else {
panic!("could not build encoding pipeline")
};

View file

@ -58,7 +58,7 @@ impl<'a> NaluReader<'a> {
match bit {
1 => Ok(true),
0 => Ok(false),
_ => panic!("Unexpected value {}", bit),
_ => panic!("Unexpected value {bit}"),
}
}

View file

@ -827,7 +827,7 @@ impl Parser {
3 => *default_scaling_list_inter,
4 => scaling_list4x4[3],
5 => scaling_list4x4[4],
_ => panic!("Unexpected value {}", i),
_ => panic!("Unexpected value {i}"),
}
}
@ -845,7 +845,7 @@ impl Parser {
3 => scaling_list8x8[1],
4 => scaling_list8x8[2],
5 => scaling_list8x8[3],
_ => panic!("Unexpected value {}", i),
_ => panic!("Unexpected value {i}"),
}
}
@ -1079,7 +1079,7 @@ impl Parser {
r.skip_bits(2)?;
let level: u8 = r.read_bits(8)?;
sps.level_idc = Level::n(level).with_context(|| format!("Unsupported level {}", level))?;
sps.level_idc = Level::n(level).with_context(|| format!("Unsupported level {level}"))?;
sps.seq_parameter_set_id = r.read_ue_max(31)?;
if sps.profile_idc == 100

View file

@ -1595,7 +1595,7 @@ impl Parser {
let level: u8 = r.read_bits(8)?;
ptl.general_level_idc =
Level::n(level).with_context(|| format!("Unsupported level {}", level))?;
Level::n(level).with_context(|| format!("Unsupported level {level}"))?;
for i in 0..sps_max_sub_layers_minus_1 as usize {
ptl.sub_layer_profile_present_flag[i] = r.read_bit()?;
@ -1695,7 +1695,7 @@ impl Parser {
if ptl.sub_layer_level_present_flag[i] {
let level: u8 = r.read_bits(8)?;
ptl.sub_layer_level_idc[i] =
Level::n(level).with_context(|| format!("Unsupported level {}", level))?;
Level::n(level).with_context(|| format!("Unsupported level {level}"))?;
}
}
}
@ -1712,7 +1712,7 @@ impl Parser {
1 => &mut sl.scaling_list_8x8[matrix_id as usize],
2 => &mut sl.scaling_list_16x16[matrix_id as usize],
3 => &mut sl.scaling_list_32x32[matrix_id as usize],
_ => panic!("Invalid size_id {}", size_id),
_ => panic!("Invalid size_id {size_id}"),
};
let src = if matrix_id < 3 {
@ -1720,7 +1720,7 @@ impl Parser {
} else if matrix_id <= 5 {
&DEFAULT_SCALING_LIST_2
} else {
panic!("Invalid matrix_id {}", matrix_id);
panic!("Invalid matrix_id {matrix_id}");
};
*dst = *src;

View file

@ -451,8 +451,8 @@ fn hlssink_element(muxer_type: HlsMultivariantSinkMuxerType, sink_name: String)
fn hlssink_name(uri: String, muxer_type: HlsMultivariantSinkMuxerType) -> String {
match muxer_type {
HlsMultivariantSinkMuxerType::Cmaf => format!("hlscmafsink-{}", uri).to_string(),
HlsMultivariantSinkMuxerType::MpegTs => format!("hlssink3-{}", uri).to_string(),
HlsMultivariantSinkMuxerType::Cmaf => format!("hlscmafsink-{uri}").to_string(),
HlsMultivariantSinkMuxerType::MpegTs => format!("hlssink3-{uri}").to_string(),
}
}

View file

@ -204,7 +204,7 @@ fn write_master_playlist(pipeline: &gst::Pipeline, path: &PathBuf) {
let mut alternatives = Vec::new();
for i in 0..2 {
let name = format!("audio_{}", i);
let name = format!("audio_{i}");
let language = if i == 0 {
Some("enc".to_string())
} else {

View file

@ -204,7 +204,7 @@ impl QuinnQuicDemux {
.element_class()
.pad_template("stream_%u")
.unwrap();
let stream_pad_name = format!("stream_{}", stream_id);
let stream_pad_name = format!("stream_{stream_id}");
let srcpad = gst::Pad::builder_from_template(&templ)
.name(stream_pad_name.clone())

View file

@ -1025,7 +1025,7 @@ impl QuinnQuicSink {
match wait(&self.canceller, stream.stopped(), timeout) {
Ok(r) => {
if let Err(e) = r {
let err_msg = format!("Stream finish request error: {}", e);
let err_msg = format!("Stream finish request error: {e}");
gst::error!(CAT, imp = self, "{}", err_msg);
} else {
gst::info!(CAT, imp = self, "Stream {} finished", stream.id());
@ -1037,7 +1037,7 @@ impl QuinnQuicSink {
gst::warning!(CAT, imp = self, "{}", err_msg);
}
WaitError::FutureError(e) => {
let err_msg = format!("Stream finish request future error: {}", e);
let err_msg = format!("Stream finish request future error: {e}");
gst::error!(CAT, imp = self, "{}", err_msg);
}
},

View file

@ -826,7 +826,7 @@ impl QuinnWebTransportServerSink {
match wait(&self.canceller, stream.stopped(), timeout) {
Ok(r) => {
if let Err(e) = r {
let err_msg = format!("Stream finish request error: {}", e);
let err_msg = format!("Stream finish request error: {e}");
gst::error!(CAT, imp = self, "{}", err_msg);
} else {
gst::info!(CAT, imp = self, "Stream {:?} finished", stream);
@ -838,7 +838,7 @@ impl QuinnWebTransportServerSink {
gst::warning!(CAT, imp = self, "{}", err_msg);
}
WaitError::FutureError(e) => {
let err_msg = format!("Stream finish request future error: {}", e);
let err_msg = format!("Stream finish request future error: {e}");
gst::error!(CAT, imp = self, "{}", err_msg);
}
},

View file

@ -34,14 +34,10 @@ fn send_receive(src_pipeline_props: &str, sink_pipeline_props: &str) {
let content = "Hello, world!\n".as_bytes();
let src_pipeline = format!(
"quinnwtclientsrc {} secure-connection=false",
src_pipeline_props
);
let src_pipeline = format!("quinnwtclientsrc {src_pipeline_props} secure-connection=false");
let sink_pipeline = format!(
"quinnwtserversink {} server-name=localhost \
address=127.0.0.1 secure-connection=false",
sink_pipeline_props
"quinnwtserversink {sink_pipeline_props} server-name=localhost \
address=127.0.0.1 secure-connection=false"
);
let h1_orig = Arc::new(Mutex::new(gst_check::Harness::new_empty()));

View file

@ -323,7 +323,7 @@ fn test_opus_payloader_get_caps() {
{
let allowed_opus_caps = get_allowed_opus_caps_for_rtp_caps("OPUS", "stereo=(string)0");
eprintln!("OPUS stereo=0 => {:?}", allowed_opus_caps);
eprintln!("OPUS stereo=0 => {allowed_opus_caps:?}");
assert_eq!(allowed_opus_caps.size(), 2);
@ -345,7 +345,7 @@ fn test_opus_payloader_get_caps() {
{
let allowed_opus_caps = get_allowed_opus_caps_for_rtp_caps("OPUS", "stereo=(string)1");
eprintln!("OPUS stereo=1 => {:?}", allowed_opus_caps);
eprintln!("OPUS stereo=1 => {allowed_opus_caps:?}");
assert_eq!(allowed_opus_caps.size(), 2);

View file

@ -147,7 +147,7 @@ impl JitterBuffer {
self.last_input_ts = Some(pts);
self.base_times.get_or_insert_with(|| {
debug!("Selected base times {:?} {}", now, pts);
debug!("Selected base times {now:?} {pts}");
(now, pts)
});
@ -208,7 +208,7 @@ impl JitterBuffer {
}
}
trace!("Polling at {:?}", now);
trace!("Polling at {now:?}");
let Some(item) = self.items.first() else {
return PollResult::Empty;
@ -229,10 +229,7 @@ impl JitterBuffer {
let duration_since_base_instant = now - base_instant;
trace!(
"Duration since base instant {:?}",
duration_since_base_instant
);
trace!("Duration since base instant {duration_since_base_instant:?}");
let ts = pts.checked_sub(base_ts).unwrap();
let deadline = Duration::from_nanos(ts) + self.latency;

View file

@ -452,7 +452,7 @@ impl RecvSession {
this.rtp_src_activatemode(pad, mode, active, id)
}
})
.name(format!("rtp_src_{}_{}_{}", id, pt, ssrc))
.name(format!("rtp_src_{id}_{pt}_{ssrc}"))
.build();
srcpad.use_fixed_caps();
@ -1798,7 +1798,7 @@ impl ElementImpl for RtpRecv {
|this| this.rtp_sink_query(pad, query, id),
)
})
.name(format!("rtp_sink_{}", id))
.name(format!("rtp_sink_{id}"))
.build();
session.rtp_recv_sinkpad = Some(sinkpad.clone());
Some((sinkpad, None, id, vec![]))
@ -1843,7 +1843,7 @@ impl ElementImpl for RtpRecv {
|this| this.iterate_internal_links(pad),
)
})
.name(format!("rtcp_sink_{}", id))
.name(format!("rtcp_sink_{id}"))
.build();
session.rtcp_recv_sinkpad = Some(sinkpad.clone());
Some((sinkpad, None, id, vec![]))

View file

@ -729,7 +729,7 @@ impl ElementImpl for RtpSend {
)
})
.flags(gst::PadFlags::PROXY_CAPS)
.name(format!("rtp_sink_{}", id))
.name(format!("rtp_sink_{id}"))
.build();
let src_templ = self.obj().pad_template("rtp_src_%u").unwrap();
let srcpad = gst::Pad::builder_from_template(&src_templ)
@ -740,7 +740,7 @@ impl ElementImpl for RtpSend {
|this| this.iterate_internal_links(pad),
)
})
.name(format!("rtp_src_{}", id))
.name(format!("rtp_src_{id}"))
.build();
session.rtp_send_sinkpad = Some(sinkpad.clone());
session.rtp_send_srcpad = Some(srcpad.clone());
@ -785,10 +785,10 @@ impl ElementImpl for RtpSend {
|this| this.iterate_internal_links(pad),
)
})
.name(format!("rtcp_src_{}", id))
.name(format!("rtcp_src_{id}"))
.build();
let stream_id = format!("{}/rtcp", id);
let stream_id = format!("{id}/rtcp");
let stream_start = gst::event::StreamStart::builder(&stream_id).build();
let seqnum = stream_start.seqnum();

View file

@ -1112,7 +1112,7 @@ impl Session {
if have_fir {
let ssrc = self.ensure_internal_send_src();
debug!("Generating FIR: {:?}", fir);
debug!("Generating FIR: {fir:?}");
rtcp =
rtcp.add_packet(rtcp_types::PayloadFeedback::builder_owned(fir).sender_ssrc(ssrc));
}

View file

@ -202,10 +202,7 @@ impl Context {
let mut pts = match self.mode {
TimestampingMode::Skew => {
let (skew_corrected, discont) = ssrc.observations.process(rtp_ext_ns, arrival_time);
trace!(
"{ssrc_val:#08x} using skew corrected RTP ext: {}",
skew_corrected
);
trace!("{ssrc_val:#08x} using skew corrected RTP ext: {skew_corrected}");
if discont {
ssrc.reset_times();
@ -218,12 +215,12 @@ impl Context {
skew_corrected
}
TimestampingMode::Rtp => {
trace!("{ssrc_val:#08x} using uncorrected RTP ext: {}", rtp_ext_ns);
trace!("{ssrc_val:#08x} using uncorrected RTP ext: {rtp_ext_ns}");
rtp_ext_ns
}
TimestampingMode::Arrival => {
trace!("{ssrc_val:#08x} using arrival time: {}", arrival_time);
trace!("{ssrc_val:#08x} using arrival time: {arrival_time}");
arrival_time
}
@ -238,10 +235,10 @@ impl Context {
// Base the PTS on the first arrival time
pts += base_arrival_time;
trace!("{ssrc_val:#08x} added up base arrival time: {}", pts);
trace!("{ssrc_val:#08x} added up base arrival time: {pts}");
// Now subtract the base PTS we calculated
pts = pts.saturating_sub(base_pts);
trace!("{ssrc_val:#08x} subtracted base PTS: {}", base_pts);
trace!("{ssrc_val:#08x} subtracted base PTS: {base_pts}");
trace!("{ssrc_val:#08x} PTS prior to potential SR offsetting: {pts}");
@ -349,12 +346,12 @@ impl Context {
cname_largest_delay
});
trace!("{ssrc_val:#08x} Largest delay is {:?}", cname_largest_delay);
trace!("{ssrc_val:#08x} Largest delay is {cname_largest_delay:?}");
if cname_largest_delay.all_sync {
let offset = (cname_largest_delay.largest_delay - delay.unwrap()) as u64;
trace!("{ssrc_val:#08x} applying offset {}", offset);
trace!("{ssrc_val:#08x} applying offset {offset}");
pts += offset;
}
@ -406,7 +403,7 @@ impl Observations {
};
trace!("Skew {}, min delta {}", self.skew, self.min_delta);
trace!("Outputting {}", out_time);
trace!("Outputting {out_time}");
(out_time, false)
}
@ -415,16 +412,13 @@ impl Observations {
// Fober, Orlarey and Letz, 2005, "Real Time Clock Skew Estimation over Network Delays":
// http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.102.1546
fn process(&mut self, remote_time: u64, local_time: u64) -> (u64, bool) {
trace!("Local time {}, remote time {}", local_time, remote_time,);
trace!("Local time {local_time}, remote time {remote_time}",);
let (base_remote_time, base_local_time) =
match (self.base_remote_time, self.base_local_time) {
(Some(remote), Some(local)) => (remote, local),
_ => {
debug!(
"Initializing base time: local {}, remote {}",
local_time, remote_time,
);
debug!("Initializing base time: local {local_time}, remote {remote_time}",);
self.base_remote_time = Some(remote_time);
self.base_local_time = Some(local_time);
self.highest_remote_time = Some(remote_time);
@ -447,25 +441,17 @@ impl Observations {
let local_diff = local_time.saturating_sub(base_local_time);
let delta = (local_diff as i64) - (remote_diff as i64);
trace!(
"Local diff {}, remote diff {}, delta {}",
local_diff,
remote_diff,
delta,
);
trace!("Local diff {local_diff}, remote diff {remote_diff}, delta {delta}",);
if remote_diff > 0 && local_diff > 0 {
let slope = (local_diff as f64) / (remote_diff as f64);
if !(0.8..1.2).contains(&slope) {
warn!("Too small/big slope {}, resetting", slope);
warn!("Too small/big slope {slope}, resetting");
let discont = !self.deltas.is_empty();
*self = Observations::default();
debug!(
"Initializing base time: local {}, remote {}",
local_time, remote_time,
);
debug!("Initializing base time: local {local_time}, remote {remote_time}",);
self.base_remote_time = Some(remote_time);
self.base_local_time = Some(local_time);
self.highest_remote_time = Some(remote_time);
@ -482,10 +468,7 @@ impl Observations {
let discont = !self.deltas.is_empty();
*self = Observations::default();
debug!(
"Initializing base time: local {}, remote {}",
local_time, remote_time,
);
debug!("Initializing base time: local {local_time}, remote {remote_time}",);
self.base_remote_time = Some(remote_time);
self.base_local_time = Some(local_time);
self.highest_remote_time = Some(remote_time);

View file

@ -228,7 +228,7 @@ impl RtspSrc {
scheme => {
return Err(glib::Error::new(
gst::URIError::UnsupportedProtocol,
&format!("Unsupported URI scheme '{}'", scheme),
&format!("Unsupported URI scheme '{scheme}'"),
));
}
};
@ -694,7 +694,7 @@ impl RtspSrc {
.link(&manager.rtp_recv_sinkpad(rtpsession_n).unwrap())?;
let templ = obj.pad_template("stream_%u").unwrap();
let ghostpad = gst::GhostPad::builder_from_template(&templ)
.name(format!("stream_{}", rtpsession_n))
.name(format!("stream_{rtpsession_n}"))
.build();
gst::info!(CAT, "Adding ghost srcpad {}", ghostpad.name());
obj.add_pad(&ghostpad)
@ -997,7 +997,7 @@ impl RtspSrc {
};
gst::info!(CAT, "Setting rtpbin pad {} as ghostpad target", name);
let srcpad = obj
.static_pad(&format!("stream_{}", stream_id))
.static_pad(&format!("stream_{stream_id}"))
.expect("ghostpad should've been available already");
let ghostpad = srcpad
.downcast::<gst::GhostPad>()
@ -1058,7 +1058,7 @@ impl RtspSrc {
continue;
};
let Some(s) = &session else {
return Err(RtspError::Fatal(format!("Can't handle {:?} response, no SETUP", expected)).into());
return Err(RtspError::Fatal(format!("Can't handle {expected:?} response, no SETUP")).into());
};
match expected {
Method::Play => {
@ -1166,9 +1166,9 @@ impl RtspManager {
fn rtp_recv_sinkpad(&self, rtpsession: usize) -> Option<gst::Pad> {
let name = if self.using_rtp2 {
format!("rtp_sink_{}", rtpsession)
format!("rtp_sink_{rtpsession}")
} else {
format!("recv_rtp_sink_{}", rtpsession)
format!("recv_rtp_sink_{rtpsession}")
};
gst::info!(CAT, "requesting {name} for receiving RTP");
self.recv.request_pad_simple(&name)
@ -1176,9 +1176,9 @@ impl RtspManager {
fn rtcp_recv_sinkpad(&self, rtpsession: usize) -> Option<gst::Pad> {
let name = if self.using_rtp2 {
format!("rtcp_sink_{}", rtpsession)
format!("rtcp_sink_{rtpsession}")
} else {
format!("recv_rtcp_sink_{}", rtpsession)
format!("recv_rtcp_sink_{rtpsession}")
};
gst::info!(CAT, "requesting {name} for receiving RTCP");
self.recv.request_pad_simple(&name)
@ -1186,9 +1186,9 @@ impl RtspManager {
fn rtcp_send_srcpad(&self, rtpsession: usize) -> Option<gst::Pad> {
let name = if self.using_rtp2 {
format!("rtcp_src_{}", rtpsession)
format!("rtcp_src_{rtpsession}")
} else {
format!("send_rtcp_src_{}", rtpsession)
format!("send_rtcp_src_{rtpsession}")
};
gst::info!(CAT, "requesting {name} for sending RTCP");
self.send.request_pad_simple(&name)
@ -1406,7 +1406,7 @@ impl RtspTaskState {
for transport in transports.iter() {
let Transport::Rtp(t) = transport else {
last_error =
RtspError::Fatal(format!("Expected RTP transport, got {:#?}", transports));
RtspError::Fatal(format!("Expected RTP transport, got {transports:#?}"));
continue;
};
// RTSP 2 specifies that we can have multiple SSRCs in the response

View file

@ -214,15 +214,13 @@ fn parse_rtpmap(
if pt >= 96 {
return guess_rtpmap_from_pt(pt, media, s).map_err(|err| {
RtspError::Fatal(format!(
"Could not get clock-rate from rtpmap {rtpmap}: {}",
err
"Could not get clock-rate from rtpmap {rtpmap}: {err}"
))
});
} else {
return guess_rtpmap_from_encoding_name(&encoding_name, media, s).map_err(|err| {
RtspError::Fatal(format!(
"Could not get clock-rate from rtpmap {rtpmap}: {}",
err
"Could not get clock-rate from rtpmap {rtpmap}: {err}"
))
});
}

View file

@ -183,7 +183,7 @@ fn run_pipeline(pipeline: gst::Pipeline) -> Result<(), Error> {
"Error in element {:?}, {}",
err.src().map(|o| o.name()),
err.debug()
.map(|d| format!("debug:\n{}", d))
.map(|d| format!("debug:\n{d}"))
.unwrap_or(String::from("no debug"))
);

View file

@ -97,7 +97,7 @@ fn run_pipeline(pipeline: gst::Pipeline) -> Result<(), Error> {
"Error in element {:?}, {}",
err.src().map(|o| o.name()),
err.debug()
.map(|d| format!("debug:\n{}", d))
.map(|d| format!("debug:\n{d}"))
.unwrap_or(String::from("no debug"))
);

View file

@ -342,7 +342,7 @@ impl Signaller {
async move {
if let Err(err) = sender.send(msg).await {
this.obj()
.emit_by_name::<()>("error", &[&format!("Error: {}", err)]);
.emit_by_name::<()>("error", &[&format!("Error: {err}")]);
}
}
));
@ -574,7 +574,7 @@ impl Signaller {
self.obj().emit_by_name::<()>(
"error",
&[&format!("Unknown message from server: {}", msg)],
&[&format!("Unknown message from server: {msg}")],
);
}
}
@ -585,7 +585,7 @@ impl Signaller {
Ok(_) => (),
Err(err) => {
self.obj()
.emit_by_name::<()>("error", &[&format!("Error receiving: {}", err)]);
.emit_by_name::<()>("error", &[&format!("Error receiving: {err}")]);
return ControlFlow::Break(());
}
}
@ -740,7 +740,7 @@ impl SignallableImpl for Signaller {
async move {
if let Err(err) = this.connect().await {
this.obj()
.emit_by_name::<()>("error", &[&format!("Error receiving: {}", err)]);
.emit_by_name::<()>("error", &[&format!("Error receiving: {err}")]);
}
}
));
@ -847,7 +847,7 @@ impl SignallableImpl for Signaller {
.await
{
this.obj()
.emit_by_name::<()>("error", &[&format!("Error: {}", err)]);
.emit_by_name::<()>("error", &[&format!("Error: {err}")]);
}
}
));

View file

@ -1426,7 +1426,7 @@ mod tests {
let actual = find_smallest_available_ext_id(ids);
if actual != expected {
return Err(format!("Expected {}, got {}", expected, actual));
return Err(format!("Expected {expected}, got {actual}"));
}
Ok(())

View file

@ -1874,7 +1874,7 @@ impl BaseWebRTCSink {
let ssrc = self.generate_ssrc(webrtc_pads);
let media_idx = webrtc_pads.len() as i32;
let Some(pad) = webrtcbin.request_pad_simple(&format!("sink_{}", media_idx)) else {
let Some(pad) = webrtcbin.request_pad_simple(&format!("sink_{media_idx}")) else {
gst::error!(CAT, imp = self, "Failed to request pad from webrtcbin");
gst::element_imp_error!(
self,
@ -2021,7 +2021,7 @@ impl BaseWebRTCSink {
payloader_caps
);
let Some(pad) = webrtcbin.request_pad_simple(&format!("sink_{}", media_idx)) else {
let Some(pad) = webrtcbin.request_pad_simple(&format!("sink_{media_idx}")) else {
gst::error!(CAT, imp = self, "Failed to request pad from webrtcbin");
gst::element_imp_error!(
self,

View file

@ -252,7 +252,7 @@ impl ObjectImpl for BaseWebRTCSrc {
settings.enable_control_data_channel.to_value()
}
"do-retransmission" => self.settings.lock().unwrap().do_retransmission.to_value(),
name => panic!("{} getter not implemented", name),
name => panic!("{name} getter not implemented"),
}
}
@ -1833,7 +1833,7 @@ impl URIHandlerImpl for WebRTCSrc {
fn set_uri(&self, uri: &str) -> Result<(), glib::Error> {
let uri = Url::from_str(uri)
.map_err(|err| glib::Error::new(gst::URIError::BadUri, &format!("{:?}", err)))?;
.map_err(|err| glib::Error::new(gst::URIError::BadUri, &format!("{err:?}")))?;
let socket_scheme = match uri.scheme() {
"gstwebrtc" => Ok("ws"),
@ -2393,7 +2393,7 @@ pub(super) mod janus {
gst::debug!(CAT, imp = self, "parsing URI {uri}");
let uri = Url::from_str(uri)
.map_err(|err| glib::Error::new(gst::URIError::BadUri, &format!("{:?}", err)))?;
.map_err(|err| glib::Error::new(gst::URIError::BadUri, &format!("{err:?}")))?;
let socket_scheme = match uri.scheme() {
"gstjanusvr" => Ok("ws"),

View file

@ -283,9 +283,9 @@ impl PadPushTimings {
let mut include = true;
let name = if let Some(ref parent_name) = parent_name {
format!("{}:{}", parent_name, pad_name)
format!("{parent_name}:{pad_name}")
} else {
format!(":{}", pad_name)
format!(":{pad_name}")
};
if let Some(ref filter) = settings.include_filter {

View file

@ -149,7 +149,7 @@ impl std::str::FromStr for CleanupMode {
"initial" => Ok(CleanupMode::Initial),
"automatic" => Ok(CleanupMode::Automatic),
"none" => Ok(CleanupMode::None),
_ => Err(format!("unknown cleanup mode: {}", s)),
_ => Err(format!("unknown cleanup mode: {s}")),
}
}
}
@ -183,7 +183,7 @@ impl std::str::FromStr for FolderMode {
"none" => Ok(FolderMode::None),
"numbered" => Ok(FolderMode::Numbered),
"timed" => Ok(FolderMode::Timed),
_ => Err(format!("unknown folder mode: {}", s)),
_ => Err(format!("unknown folder mode: {s}")),
}
}
}
@ -621,7 +621,7 @@ impl PipelineSnapshot {
let pipeline_ptr = if settings.dot_pipeline_ptr {
let pipeline_ptr: *const gst::ffi::GstPipeline = pipeline.to_glib_none().0;
format!("-{:?}", pipeline_ptr)
format!("-{pipeline_ptr:?}")
} else {
"".to_string()
};

View file

@ -461,7 +461,7 @@ impl TranscriberBin {
if let Some(channel) = cea608_channel {
builder = builder.property("cea608-channel", channel);
}
(builder.build()?, format!("sink_{}", service_no))
(builder.build()?, format!("sink_{service_no}"))
}
};
let cccapsfilter = gst::ElementFactory::make("capsfilter").build()?;
@ -515,7 +515,7 @@ impl TranscriberBin {
pad_state
.transcription_bin
.set_property("name", format!("transcription-bin-{}", pad_name));
.set_property("name", format!("transcription-bin-{pad_name}"));
state
.internal_bin
@ -1158,7 +1158,7 @@ impl TranscriberBin {
use std::collections::hash_map::Entry::*;
if let Vacant(e) = pad_state.language_tees.entry(k.clone()) {
let tee = gst::ElementFactory::make("tee")
.name(format!("tee-{}", k))
.name(format!("tee-{k}"))
.property("allow-not-linked", true)
.build()?;
@ -1255,7 +1255,7 @@ impl TranscriberBin {
let _ = channel.bin.set_state(gst::State::Null);
if let Some(serial) = serial {
pad_name = format!("{}_{}", pad_name, serial);
pad_name = format!("{pad_name}_{serial}");
}
let srcpad = transcription_bin.static_pad(&pad_name).unwrap();
let _ = transcription_bin.remove_pad(&srcpad);
@ -1655,7 +1655,7 @@ impl TranscriberBin {
use std::collections::hash_map::Entry::*;
if let Vacant(e) = pad_state.language_tees.entry(k.clone()) {
let tee = gst::ElementFactory::make("tee")
.name(format!("tee-{}", k))
.name(format!("tee-{k}"))
.property("allow-not-linked", true)
.build()?;
@ -1872,7 +1872,7 @@ impl TranscriberBin {
pad_transcription_bin.add_pad(&srcpad)?;
if let Some(serial) = serial {
pad_name = format!("{}_{}", pad_name, serial);
pad_name = format!("{pad_name}_{serial}");
}
let srcpad = gst::GhostPad::builder_with_target(&srcpad)
@ -3245,7 +3245,7 @@ impl TranscriberSinkPadState {
return;
};
let mut unsynced_pad_name = format!("unsynced_{}", srcpad_name);
let mut unsynced_pad_name = format!("unsynced_{srcpad_name}");
if transcriber.static_pad(&unsynced_pad_name).is_some() {
let srcpad = self
@ -3254,7 +3254,7 @@ impl TranscriberSinkPadState {
.unwrap();
let _ = self.transcription_bin.remove_pad(&srcpad);
if let Some(serial) = self.serial {
unsynced_pad_name = format!("{}_{}", unsynced_pad_name, serial);
unsynced_pad_name = format!("{unsynced_pad_name}_{serial}");
}
let srcpad = state
.transcription_bin
@ -3327,7 +3327,7 @@ impl TranscriberSinkPadState {
self.transcription_bin.add_pad(&srcpad)?;
if let Some(serial) = self.serial {
unsynced_pad_name = format!("{}_{}", unsynced_pad_name, serial);
unsynced_pad_name = format!("{unsynced_pad_name}_{serial}");
}
let srcpad = gst::GhostPad::builder_with_target(&srcpad)

View file

@ -399,7 +399,7 @@ impl ElementImpl for TranslationBin {
};
let pad = gst::PadBuilder::<super::TranslationSrcPad>::from_template(templ)
.name(format!("translate_src_{}", serial))
.name(format!("translate_src_{serial}"))
.build();
self.obj().add_pad(pad.upcast_ref::<gst::Pad>()).unwrap();

View file

@ -330,7 +330,7 @@ fn test_cea708mux_inputs_overflow_output_new_service() {
assert_eq!(service_numbers, (1..=6).collect::<Vec<_>>());
for no in service_numbers {
let codes = seen_services.get(&no).unwrap();
println!("service {no}: {:?}", codes);
println!("service {no}: {codes:?}");
let offset = no as usize - 1;
// one of the services will have a length that is 1 byte shorter than others due to size
// limits of the packet.
@ -425,7 +425,7 @@ fn test_cea708mux_output_overflow_max_time() {
service_numbers.sort();
assert_eq!(service_numbers, (1..=6).collect::<Vec<_>>());
for (&no, codes) in seen_services.iter() {
println!("service {no}: {:?}", codes);
println!("service {no}: {codes:?}");
let offset = no as usize - 1;
assert_eq!(&codes[..10], &CODES[offset..offset + 10]);
}