From ded452753b7c785c7343bb1a6ff260ccb782997a Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 2 Mar 2026 18:49:16 +0100 Subject: [PATCH] remove useless &format!("const string") in debug log --- src/main.rs | 22 +++++++++++----------- src/transcoder.rs | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index a3be91c..f9b8ab0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -441,12 +441,12 @@ fn main() { if transcoder.input_name.iter().flatten().count() == 0 { println!("no input name(s) provided"); - transcoder.debug_log(DebugLog::GENERAL, &format!("no input name(s) provided")); + transcoder.debug_log(DebugLog::GENERAL, "no input name(s) provided"); return; } if transcoder.output_name.is_empty() { println!("no output name provided"); - transcoder.debug_log(DebugLog::GENERAL, &format!("no output name provided")); + transcoder.debug_log(DebugLog::GENERAL, "no output name provided"); return; } @@ -561,7 +561,7 @@ fn main() { } fmtname } else if transcoder.output_name.as_str() == "/dev/null" { - transcoder.debug_log(DebugLog::MUX, &format!("Using null muxer")); + transcoder.debug_log(DebugLog::MUX, "Using null muxer"); "null" } else if let Some(fmtname) = detect::detect_format_by_name(transcoder.output_name.as_str()) { transcoder.debug_log(DebugLog::MUX, &format!("Detected muxer format as {fmtname}")); @@ -583,7 +583,7 @@ fn main() { if custom_profile && !profile_name.is_empty() { println!("profile setting is incompatible with custom --ostream options"); - transcoder.debug_log(DebugLog::GENERAL, &format!("profile setting is incompatible with custom --ostream options")); + transcoder.debug_log(DebugLog::GENERAL, "profile setting is incompatible with custom --ostream options"); return; } if !profile_name.is_empty() { @@ -608,7 +608,7 @@ fn main() { transcoder.queue.set_sync(force_sync || !mux_quirks.is_unsync()); if transcoder.calc_len { - transcoder.debug_log(DebugLog::GENERAL, &format!("Calculating total length of input streams")); + transcoder.debug_log(DebugLog::GENERAL, "Calculating total length of input streams"); let mut sids = Vec::new(); transcoder.nframes.clear(); @@ -636,7 +636,7 @@ fn main() { demuxers.clear(); if !transcoder.create_demuxers(&mut demuxers, &full_reg, false) { println!("failed to re-create demuxer(s)"); - transcoder.debug_log(DebugLog::GENERAL, &format!("failed to re-create demuxer(s)")); + transcoder.debug_log(DebugLog::GENERAL, "failed to re-create demuxer(s)"); return; } } @@ -645,7 +645,7 @@ fn main() { let mut out_sm = StreamManager::new(); if !transcoder.negotiate_stream_map(&ism, mux_caps, &mut out_sm, &full_reg.enc_reg) { println!("cannot determine stream map"); - transcoder.debug_log(DebugLog::GENERAL, &format!("cannot determine stream map")); + transcoder.debug_log(DebugLog::GENERAL, "cannot determine stream map"); return; } @@ -810,7 +810,7 @@ fn main() { break; } } - transcoder.debug_log(DebugLog::GENERAL, &format!("Demuxing done, flushing leftover frames")); + transcoder.debug_log(DebugLog::GENERAL, "Demuxing done, flushing leftover frames"); 'reord_flush_loop: for stream in ism.iter() { let src_id = stream.get_num(); if let OutputMode::Encode(dst_id, ref mut encoder) = transcoder.encoders[src_id] { @@ -834,7 +834,7 @@ fn main() { } } } - transcoder.debug_log(DebugLog::GENERAL, &format!("Flushing encoders")); + transcoder.debug_log(DebugLog::GENERAL, "Flushing encoders"); /*'flush_loop:*/ for enc in transcoder.encoders.iter_mut() { match enc { OutputMode::Encode(str_id, ref mut encoder) => { @@ -851,14 +851,14 @@ fn main() { }; } - transcoder.debug_log(DebugLog::GENERAL, &format!("Flushing encoded packets")); + transcoder.debug_log(DebugLog::GENERAL, "Flushing encoded packets"); retrieve_packets(&mut transcoder, &mut mux, &mut vdata_size, &mut adata_size, true); if transcoder.verbose > 0 { println!(); } - transcoder.debug_log(DebugLog::MUX, &format!("Finalising muxing")); + transcoder.debug_log(DebugLog::MUX, "Finalising muxing"); let ret = mux.end(); if ret.is_err() { println!("error at finalising muxing"); diff --git a/src/transcoder.rs b/src/transcoder.rs index dbbe160..ca82c99 100644 --- a/src/transcoder.rs +++ b/src/transcoder.rs @@ -467,7 +467,7 @@ impl OutputQueue { } if self.cur_stream == last_str { if let Some(ref mut dlog) = dbg { - dlog.log(DebugLog::SYNC, &format!(" sync: no packets to output")); + dlog.log(DebugLog::SYNC, " sync: no packets to output"); } break; } @@ -1320,7 +1320,7 @@ println!("encoder {} is not supported by output (expected {})", istr.id, istr.ge println!(); println!("cannot create demuxer"); if let Some(ref mut dbg) = self.debug { - dbg.log(DebugLog::DEMUX, &format!("demuxer creation failed")); + dbg.log(DebugLog::DEMUX, "demuxer creation failed"); } return false; } -- 2.39.5