diff --git a/av1an-core/src/broker.rs b/av1an-core/src/broker.rs index 6049e839..223fe751 100644 --- a/av1an-core/src/broker.rs +++ b/av1an-core/src/broker.rs @@ -45,7 +45,7 @@ impl Debug for StringOrBytes { f.write_str(s)?; } } - Self::Bytes(b) => write!(f, "raw bytes: {:?}", b)?, + Self::Bytes(b) => write!(f, "raw bytes: {b:?}")?, } Ok(()) @@ -96,7 +96,7 @@ impl Display for EncoderCrash { )?; if let Some(ffmpeg_pipe_stderr) = &self.ffmpeg_pipe_stderr { - write!(f, "\nffmpeg pipe stderr:\n{:#?}", ffmpeg_pipe_stderr)?; + write!(f, "\nffmpeg pipe stderr:\n{ffmpeg_pipe_stderr:#?}")?; } Ok(()) @@ -287,7 +287,7 @@ impl<'a> Broker<'a> { }, ); - let mut progress_file = File::create(&progress_file).unwrap(); + let mut progress_file = File::create(progress_file).unwrap(); progress_file .write_all(serde_json::to_string(get_done()).unwrap().as_bytes()) .unwrap(); diff --git a/av1an-core/src/concat.rs b/av1an-core/src/concat.rs index 947448b2..a93fd838 100644 --- a/av1an-core/src/concat.rs +++ b/av1an-core/src/concat.rs @@ -104,8 +104,8 @@ pub fn ivf(input: &Path, out: &Path) -> anyhow::Result<()> { loop { match demuxer.read_event() { Ok(event) => match event { - Event::MoreDataNeeded(sz) => panic!("needed more data: {} bytes", sz), - Event::NewStream(s) => panic!("new stream: {:?}", s), + Event::MoreDataNeeded(sz) => panic!("needed more data: {sz} bytes"), + Event::NewStream(s) => panic!("new stream: {s:?}"), Event::NewPacket(mut packet) => { if let Some(p) = packet.pos.as_mut() { last_pos = *p; @@ -196,7 +196,7 @@ pub fn mkvmerge( audio_file.as_deref(), ); - let mut options_json = File::create(&options_path)?; + let mut options_json = File::create(options_path)?; options_json.write_all(options_json_contents.as_bytes())?; let mut cmd = Command::new("mkvmerge"); @@ -228,13 +228,13 @@ pub fn mkvmerge_options_json( audio: Option<&str>, ) -> String { let mut file_string = String::with_capacity(64 + 12 * num); - write!(file_string, "[\"-o\", {:?}", output).unwrap(); + write!(file_string, "[\"-o\", {output:?}").unwrap(); if let Some(audio) = audio { - write!(file_string, ", {:?}", audio).unwrap(); + write!(file_string, ", {audio:?}").unwrap(); } file_string.push_str(", \"[\""); for i in 0..num { - write!(file_string, ", \"{:05}.{}\"", i, encoder.output_extension()).unwrap(); + write!(file_string, ", \"{i:05}.{}\"", encoder.output_extension()).unwrap(); } file_string.push_str(",\"]\"]"); diff --git a/av1an-core/src/encoder.rs b/av1an-core/src/encoder.rs index 09db7c06..0d5aaa46 100644 --- a/av1an-core/src/encoder.rs +++ b/av1an-core/src/encoder.rs @@ -161,7 +161,7 @@ impl Encoder { Self::aom => chain!( into_array!["aomenc", "--passes=2", "--pass=1"], params, - into_array![format!("--fpf={}.log", fpf), "-o", NULL, "-"], + into_array![format!("--fpf={fpf}.log"), "-o", NULL, "-"], ) .collect(), Self::rav1e => chain!( @@ -174,13 +174,13 @@ impl Encoder { frame_count.to_string() ], params, - into_array!["--first-pass", format!("{}.stat", fpf), "--output", NULL] + into_array!["--first-pass", format!("{fpf}.stat"), "--output", NULL] ) .collect(), Self::vpx => chain!( into_array!["vpxenc", "--passes=2", "--pass=1"], params, - into_array![format!("--fpf={}.log", fpf), "-o", NULL, "-"], + into_array![format!("--fpf={fpf}.log"), "-o", NULL, "-"], ) .collect(), Self::svt_av1 => chain!( @@ -194,14 +194,7 @@ impl Encoder { "2", ], params, - into_array![ - "--pass", - "1", - "--stats", - format!("{}.stat", fpf), - "-b", - NULL, - ], + into_array!["--pass", "1", "--stats", format!("{fpf}.stat"), "-b", NULL,], ) .collect(), Self::x264 => chain!( @@ -218,7 +211,7 @@ impl Encoder { frame_count.to_string() ], params, - into_array!["--stats", format!("{}.log", fpf), "-", "-o", NULL] + into_array!["--stats", format!("{fpf}.log"), "-", "-o", NULL] ) .collect(), Self::x265 => chain!( @@ -236,9 +229,9 @@ impl Encoder { params, into_array![ "--stats", - format!("{}.log", fpf), + format!("{fpf}.log"), "--analysis-reuse-file", - format!("{}_analysis.dat", fpf), + format!("{fpf}_analysis.dat"), "-", "-o", NULL @@ -260,7 +253,7 @@ impl Encoder { Self::aom => chain!( into_array!["aomenc", "--passes=2", "--pass=2"], params, - into_array![format!("--fpf={}.log", fpf), "-o", output, "-"], + into_array![format!("--fpf={fpf}.log"), "-o", output, "-"], ) .collect(), Self::rav1e => chain!( @@ -273,13 +266,13 @@ impl Encoder { frame_count.to_string() ], params, - into_array!["--second-pass", format!("{}.stat", fpf), "--output", output] + into_array!["--second-pass", format!("{fpf}.stat"), "--output", output] ) .collect(), Self::vpx => chain!( into_array!["vpxenc", "--passes=2", "--pass=2"], params, - into_array![format!("--fpf={}.log", fpf), "-o", output, "-"], + into_array![format!("--fpf={fpf}.log"), "-o", output, "-"], ) .collect(), Self::svt_av1 => chain!( @@ -297,7 +290,7 @@ impl Encoder { "--pass", "2", "--stats", - format!("{}.stat", fpf), + format!("{fpf}.stat"), "-b", output, ], @@ -317,7 +310,7 @@ impl Encoder { frame_count.to_string() ], params, - into_array!["--stats", format!("{}.log", fpf), "-", "-o", output] + into_array!["--stats", format!("{fpf}.log"), "-", "-o", output] ) .collect(), Self::x265 => chain!( @@ -335,9 +328,9 @@ impl Encoder { params, into_array![ "--stats", - format!("{}.log", fpf), + format!("{fpf}.log"), "--analysis-reuse-file", - format!("{}_analysis.dat", fpf), + format!("{fpf}_analysis.dat"), "-", "-o", output @@ -378,8 +371,8 @@ impl Encoder { let rows = ilog2(rows); let aom_tiles: Vec = into_vec![ - format!("--tile-columns={}", columns), - format!("--tile-rows={}", rows) + format!("--tile-columns={columns}"), + format!("--tile-rows={rows}") ]; chain!(defaults, aom_tiles).collect() } else { @@ -418,8 +411,8 @@ impl Encoder { let rows = ilog2(rows); let aom_tiles: Vec = into_vec![ - format!("--tile-columns={}", columns), - format!("--tile-rows={}", rows) + format!("--tile-columns={columns}"), + format!("--tile-rows={rows}") ]; chain!(defaults, aom_tiles).collect() } else { @@ -434,9 +427,9 @@ impl Encoder { let tiles: Vec = into_vec![ "--tile-columns", - format!("{}", columns), + columns.to_string(), "--tile-rows", - format!("{}", rows) + rows.to_string() ]; chain!(defaults, tiles).collect() } else { @@ -528,8 +521,8 @@ impl Encoder { fn replace_q(self, index: usize, q: usize) -> (usize, String) { match self { - Self::aom | Self::vpx => (index, format!("--cq-level={}", q)), - Self::rav1e | Self::svt_av1 | Self::x265 | Self::x264 => (index + 1, format!("{}", q)), + Self::aom | Self::vpx => (index, format!("--cq-level={q}")), + Self::rav1e | Self::svt_av1 | Self::x265 | Self::x264 => (index + 1, q.to_string()), } } @@ -537,15 +530,15 @@ impl Encoder { let mut output = ArrayVec::new(); match self { Self::aom | Self::vpx => { - output.push(format!("--cq-level={}", q)); + output.push(format!("--cq-level={q}")); } Self::rav1e => { output.push("--quantizer".into()); - output.push(format!("{}", q)); + output.push(q.to_string()); } Self::svt_av1 | Self::x264 | Self::x265 => { output.push("--crf".into()); - output.push(format!("{}", q)); + output.push(q.to_string()); } } output @@ -597,14 +590,14 @@ impl Encoder { Self::aom => inplace_vec![ "aomenc", "--passes=1", - format!("--threads={}", threads), + format!("--threads={threads}"), "--tile-columns=2", "--tile-rows=1", "--end-usage=q", "-b", "8", "--cpu-used=6", - format!("--cq-level={}", q), + format!("--cq-level={q}"), "--enable-filter-intra=0", "--enable-smooth-intra=0", "--enable-paeth-intra=0", @@ -640,11 +633,11 @@ impl Encoder { "-s", "10", "--threads", - format!("{}", threads), + threads.to_string(), "--tiles", "16", "--quantizer", - format!("{}", q), + q.to_string(), "--low-latency", "--rdo-lookahead-frames", "5", @@ -658,10 +651,10 @@ impl Encoder { "--passes=1", "--pass=1", "--codec=vp9", - format!("--threads={}", threads), + format!("--threads={threads}"), "--cpu-used=9", "--end-usage=q", - format!("--cq-level={}", q), + format!("--cq-level={q}"), "--row-mt=1", ], Self::svt_av1 => { @@ -671,13 +664,13 @@ impl Encoder { "-i", "stdin", "--lp", - format!("{}", threads), + threads.to_string(), "--preset", "8", "--keyint", "240", "--crf", - format!("{}", q), + q.to_string(), "--tile-rows", "1", "--tile-columns", @@ -735,13 +728,13 @@ impl Encoder { "-i", "stdin", "--lp", - format!("{}", threads), + threads.to_string(), "--preset", "12", "--keyint", "240", "--crf", - format!("{}", q), + q.to_string(), "--tile-rows", "1", "--tile-columns", @@ -758,11 +751,11 @@ impl Encoder { "-", "--no-progress", "--threads", - format!("{}", threads), + threads.to_string(), "--preset", "medium", "--crf", - format!("{}", q), + q.to_string(), ], Self::x265 => inplace_vec![ "x265", @@ -771,11 +764,11 @@ impl Encoder { "--no-progress", "--y4m", "--frame-threads", - format!("{}", cmp::min(threads, 16)), + cmp::min(threads, 16).to_string(), "--preset", "fast", "--crf", - format!("{}", q), + q.to_string(), ], } } @@ -783,17 +776,17 @@ impl Encoder { /// Returns command used for target quality probing (slow, correctness focused version) pub fn construct_target_quality_command_probe_slow(self, q: usize) -> Vec> { match &self { - Self::aom => inplace_vec!["aomenc", "--passes=1", format!("--cq-level={}", q)], - Self::rav1e => inplace_vec!["rav1e", "-y", "--quantizer", format!("{}", q)], + Self::aom => inplace_vec!["aomenc", "--passes=1", format!("--cq-level={q}")], + Self::rav1e => inplace_vec!["rav1e", "-y", "--quantizer", q.to_string()], Self::vpx => inplace_vec![ "vpxenc", "--passes=1", "--pass=1", "--codec=vp9", "--end-usage=q", - format!("--cq-level={}", q), + format!("--cq-level={q}"), ], - Self::svt_av1 => inplace_vec!["SvtAv1EncApp", "-i", "stdin", "--crf", format!("{}", q)], + Self::svt_av1 => inplace_vec!["SvtAv1EncApp", "-i", "stdin", "--crf", q.to_string()], Self::x264 => inplace_vec![ "x264", "--log-level", @@ -803,7 +796,7 @@ impl Encoder { "-", "--no-progress", "--crf", - format!("{}", q), + q.to_string(), ], Self::x265 => inplace_vec![ "x265", @@ -812,7 +805,7 @@ impl Encoder { "--no-progress", "--y4m", "--crf", - format!("{}", q), + q.to_string(), ], } } @@ -845,14 +838,14 @@ impl Encoder { let pipe = compose_ffmpeg_pipe( [ "-vf", - format!("select=not(mod(n\\,{}))", probing_rate).as_str(), + format!("select=not(mod(n\\,{probing_rate}))").as_str(), "-vsync", "0", ], pix_fmt, ); - let probe_name = format!("v_{}_{}.ivf", q, chunk_index); + let probe_name = format!("v_{q}_{chunk_index}.ivf"); let mut probe = PathBuf::from(temp); probe.push("split"); probe.push(&probe_name); diff --git a/av1an-core/src/lib.rs b/av1an-core/src/lib.rs index 7a28bd0f..f669461c 100644 --- a/av1an-core/src/lib.rs +++ b/av1an-core/src/lib.rs @@ -154,7 +154,7 @@ impl Input { } Input::Video(video) => { let fmt = crate::ffmpeg::get_pixel_format(video).map_err(|_| anyhow::anyhow!(FAIL_MSG))?; - format!("{:?}", fmt) + format!("{fmt:?}") } }) } diff --git a/av1an-core/src/parse.rs b/av1an-core/src/parse.rs index 17dd178b..393b5e96 100644 --- a/av1an-core/src/parse.rs +++ b/av1an-core/src/parse.rs @@ -264,8 +264,8 @@ pub fn valid_params(help_text: &str, encoder: Encoder) -> HashSet> .map(|stripped| stripped.strip_prefix('-').unwrap_or(stripped)); if let Some(arg) = arg { - params.insert(Cow::Owned(format!("--{}", arg))); - params.insert(Cow::Owned(format!("--no-{}", arg))); + params.insert(Cow::Owned(format!("--{arg}"))); + params.insert(Cow::Owned(format!("--no-{arg}"))); continue; } } diff --git a/av1an-core/src/progress_bar.rs b/av1an-core/src/progress_bar.rs index 005daea1..2f4af024 100644 --- a/av1an-core/src/progress_bar.rs +++ b/av1an-core/src/progress_bar.rs @@ -46,7 +46,7 @@ fn pretty_progress_style() -> ProgressStyle { if fps < 1.0 { write!(w, "{:.2} s/fr", 1.0 / fps).unwrap(); } else { - write!(w, "{:.2} fps", fps).unwrap(); + write!(w, "{fps:.2} fps").unwrap(); } } }) @@ -85,7 +85,7 @@ fn spinner_style() -> ProgressStyle { if fps < 1.0 { write!(w, "{:.2} s/fr", 1.0 / fps).unwrap(); } else { - write!(w, "{:.2} fps", fps).unwrap(); + write!(w, "{fps:.2} fps",).unwrap(); } } }) @@ -133,7 +133,7 @@ pub fn dec_bar(dec: u64) { pub fn update_bar_info(kbps: f64, est_size: HumanBytes) { if let Some(pb) = PROGRESS_BAR.get() { - pb.set_message(format!(", {:.1} Kbps, est. {}", kbps, est_size)); + pb.set_message(format!(", {kbps:.1} Kbps, est. {est_size}")); } } @@ -204,7 +204,7 @@ pub fn init_multi_progress_bar(len: u64, workers: usize, total_chunks: usize) { }) .unwrap(), ); - pb.set_prefix(format!("[Idle {width:width$}]", width = digits)); + pb.set_prefix(format!("[Idle {digits:digits$}]")); pbs.push(mpb.add(pb)); } @@ -226,7 +226,7 @@ pub fn init_multi_progress_bar(len: u64, workers: usize, total_chunks: usize) { pub fn update_mp_chunk(worker_idx: usize, chunk: usize, padding: usize) { if let Some((_, pbs)) = MULTI_PROGRESS_BAR.get() { - pbs[worker_idx].set_prefix(format!("[Chunk {:>digits$}]", chunk, digits = padding)); + pbs[worker_idx].set_prefix(format!("[Chunk {chunk:>padding$}]")); } } @@ -254,7 +254,7 @@ pub fn update_mp_bar_info(kbps: f64, est_size: HumanBytes) { pbs .last() .unwrap() - .set_message(format!(", {:.1} Kbps, est. {}", kbps, est_size)); + .set_message(format!(", {kbps:.1} Kbps, est. {est_size}")); } } diff --git a/av1an-core/src/scene_detect.rs b/av1an-core/src/scene_detect.rs index ae0ea926..8c88833b 100644 --- a/av1an-core/src/scene_detect.rs +++ b/av1an-core/src/scene_detect.rs @@ -207,7 +207,7 @@ fn build_decoder( sdh ) ], - (Some(sdh), None) => into_smallvec!["-vf", format!("scale=-2:'min({},ih)'", sdh)], + (Some(sdh), None) => into_smallvec!["-vf", format!("scale=-2:'min({sdh},ih)'")], (None, Some(spf)) => into_smallvec!["-pix_fmt", spf.descriptor().unwrap().name()], (None, None) => smallvec![], }; @@ -244,7 +244,7 @@ fn build_decoder( } Input::Video(path) => { let input_pix_format = crate::ffmpeg::get_pixel_format(path.as_ref()) - .unwrap_or_else(|e| panic!("FFmpeg failed to get pixel format for input video: {:?}", e)); + .unwrap_or_else(|e| panic!("FFmpeg failed to get pixel format for input video: {e:?}")); bit_depth = encoder.get_format_bit_depth(sc_pix_format.unwrap_or(input_pix_format))?; Command::new("ffmpeg") .args(["-r", "1", "-i"]) diff --git a/av1an-core/src/scenes.rs b/av1an-core/src/scenes.rs index e0e26a73..6c10c24e 100644 --- a/av1an-core/src/scenes.rs +++ b/av1an-core/src/scenes.rs @@ -153,9 +153,7 @@ impl Scene { let raw_zone_args = if [Encoder::aom, Encoder::vpx].contains(&encoder) { zone_args .into_iter() - .map(|(key, value)| { - value.map_or_else(|| key.to_string(), |value| format!("{}={}", key, value)) - }) + .map(|(key, value)| value.map_or_else(|| key.to_string(), |value| format!("{key}={value}"))) .collect::>() } else { zone_args @@ -193,9 +191,9 @@ impl Scene { let invalid_params = invalid_params(&interleaved_args, &valid_params); for wrong_param in &invalid_params { - eprintln!("'{}' isn't a valid parameter for {}", wrong_param, encoder); + eprintln!("'{wrong_param}' isn't a valid parameter for {encoder}"); if let Some(suggestion) = suggest_fix(wrong_param, &valid_params) { - eprintln!("\tDid you mean '{}'?", suggestion); + eprintln!("\tDid you mean '{suggestion}'?"); } } @@ -212,7 +210,7 @@ impl Scene { let key = arg.split_once('=').map_or(arg.as_str(), |split| split.0); if let Some(pos) = video_params .iter() - .position(|param| param == key || param.starts_with(&format!("{}=", key))) + .position(|param| param == key || param.starts_with(&format!("{key}="))) { video_params.remove(pos); if let Some(next) = video_params.get(pos) { diff --git a/av1an-core/src/settings.rs b/av1an-core/src/settings.rs index 2ff9942e..02573731 100644 --- a/av1an-core/src/settings.rs +++ b/av1an-core/src/settings.rs @@ -395,9 +395,9 @@ impl EncodeArgs { if let Some(new) = encoder.parse_encoded_frames(line) { if new > frame { if self.verbosity == Verbosity::Normal { - inc_bar((new - frame) as u64); + inc_bar(new - frame); } else if self.verbosity == Verbosity::Verbose { - inc_mp_bar((new - frame) as u64); + inc_mp_bar(new - frame); } frame = new; } @@ -439,12 +439,12 @@ impl EncodeArgs { let err_str = match encoded_frames { Ok(encoded_frames) if encoded_frames != chunk.frames => Some(format!( - "FRAME MISMATCH: chunk {}: {}/{} (actual/expected frames)", - chunk.index, encoded_frames, chunk.frames + "FRAME MISMATCH: chunk {}: {encoded_frames}/{} (actual/expected frames)", + chunk.index, chunk.frames )), Err(error) => Some(format!( - "FAILED TO COUNT FRAMES: chunk {}: {}", - chunk.index, error + "FAILED TO COUNT FRAMES: chunk {}: {error}", + chunk.index )), _ => None, }; @@ -496,7 +496,7 @@ impl EncodeArgs { wrong_param, self.encoder, ); if let Some(suggestion) = suggest_fix(wrong_param, &valid_params) { - eprintln!("\tDid you mean '{}'?", suggestion); + eprintln!("\tDid you mean '{suggestion}'?"); } } @@ -875,9 +875,9 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin "y4m", "-", "-s", - format!("{}", scene.start_frame), + scene.start_frame.to_string(), "-e", - format!("{}", frame_end), + frame_end.to_string(), ]; let output_ext = self.encoder.output_extension(); @@ -1188,7 +1188,7 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin // We can reuse the existing photon noise table from the main encode grain_table.clone().unwrap() } else { - let grain_table = Path::new(&self.temp).join(&format!("chunk{}-grain.tbl", chunk.index)); + let grain_table = Path::new(&self.temp).join(format!("chunk{}-grain.tbl", chunk.index)); let iso_setting = u32::from(strength) * 100; debug!("Generating grain table at ISO {}", iso_setting); let (width, height) = self.input.resolution()?; @@ -1232,7 +1232,7 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin get_done().audio_done.store(true, atomic::Ordering::SeqCst); let progress_file = Path::new(temp).join("done.json"); - let mut progress_file = File::create(&progress_file).unwrap(); + let mut progress_file = File::create(progress_file).unwrap(); progress_file .write_all(serde_json::to_string(get_done()).unwrap().as_bytes()) .unwrap(); diff --git a/av1an-core/src/split.rs b/av1an-core/src/split.rs index 6207eb91..4641b754 100644 --- a/av1an-core/src/split.rs +++ b/av1an-core/src/split.rs @@ -48,7 +48,7 @@ pub fn segment(input: impl AsRef, temp: impl AsRef, segments: &[usiz cmd.arg(split_path); } let out = cmd.output().unwrap(); - assert!(out.status.success(), "FFmpeg failed to segment: {:#?}", out); + assert!(out.status.success(), "FFmpeg failed to segment: {out:#?}"); } pub fn extra_splits(scenes: &[Scene], total_frames: usize, split_size: usize) -> Vec { diff --git a/av1an-core/src/target_quality.rs b/av1an-core/src/target_quality.rs index 58de6456..afeb06bc 100644 --- a/av1an-core/src/target_quality.rs +++ b/av1an-core/src/target_quality.rs @@ -264,7 +264,7 @@ impl<'a> TargetQuality<'a> { let probe_name = Path::new(&chunk.temp) .join("split") - .join(format!("v_{}_{}.ivf", q, chunk.index)); + .join(format!("v_{q}_{}.ivf", chunk.index)); let fl_path = Path::new(&chunk.temp) .join("split") .join(format!("{}.json", chunk.index)); @@ -293,8 +293,8 @@ impl<'a> TargetQuality<'a> { } pub fn weighted_search(num1: f64, vmaf1: f64, num2: f64, vmaf2: f64, target: f64) -> usize { - let dif1 = (transform_vmaf(target as f64) - transform_vmaf(vmaf2)).abs(); - let dif2 = (transform_vmaf(target as f64) - transform_vmaf(vmaf1)).abs(); + let dif1 = (transform_vmaf(target) - transform_vmaf(vmaf2)).abs(); + let dif2 = (transform_vmaf(target) - transform_vmaf(vmaf1)).abs(); let tot = dif1 + dif2; @@ -347,7 +347,7 @@ pub fn interpolate_target_vmaf(scores: Vec<(f64, u32)>, q: f64) -> Result anyhow::Res let mut sorted_scores = scores.clone(); sorted_scores.sort_unstable_by(|a, b| a.partial_cmp(b).unwrap_or(Ordering::Less)); - let plot_width = 1600 + (printable_base10_digits(scores.len()) as u32 * 200); + let plot_width = 1600 + (printable_base10_digits(scores.len()) * 200); let plot_heigth = 600; let length = scores.len() as u32; @@ -61,25 +61,25 @@ pub fn plot_vmaf_score_file(scores_file: &Path, plot_path: &Path) -> anyhow::Res // 1% chart .draw_series(LineSeries::new((0..=length).map(|x| (x, perc_1)), RED))? - .label(format!("1%: {}", perc_1)) + .label(format!("1%: {perc_1}")) .legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], RED)); // 25% chart .draw_series(LineSeries::new((0..=length).map(|x| (x, perc_25)), YELLOW))? - .label(format!("25%: {}", perc_25)) + .label(format!("25%: {perc_25}")) .legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], YELLOW)); // 50% (median, except not averaged in the case of an even number of elements) chart .draw_series(LineSeries::new((0..=length).map(|x| (x, perc_50)), BLACK))? - .label(format!("50%: {}", perc_50)) + .label(format!("50%: {perc_50}")) .legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], BLACK)); // 75% chart .draw_series(LineSeries::new((0..=length).map(|x| (x, perc_75)), GREEN))? - .label(format!("75%: {}", perc_75)) + .label(format!("75%: {perc_75}")) .legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], GREEN)); // Data @@ -235,7 +235,7 @@ pub fn run_vmaf( filter, &res ); - cmd.arg(format!("{}{}{}", distorted, reference, vmaf)); + cmd.arg(format!("{distorted}{reference}{vmaf}")); cmd.args(["-f", "null", "-"]); cmd.stdin(source_pipe.stdout.take().unwrap()); cmd.stderr(Stdio::piped());