From fad969c3fe899216b488d9a4f12c7cad92b45faf Mon Sep 17 00:00:00 2001 From: Superyu1337 Date: Sun, 1 Dec 2024 17:08:09 +0100 Subject: [PATCH] wip: address clippy errors --- src/main.rs | 1 + src/video.rs | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 67f34da..158fa85 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,7 @@ struct Cli { } #[derive(Subcommand, Debug)] +#[allow(clippy::large_enum_variant)] enum Commands { /// Compare two still images. Resolutions must be identical. Image { diff --git a/src/video.rs b/src/video.rs index 8752055..b09e923 100644 --- a/src/video.rs +++ b/src/video.rs @@ -115,8 +115,10 @@ fn pretty_spinner_style() -> ProgressStyle { .progress_chars(PROGRESS_CHARS) } +type VideoCompareMutex = Mutex<((usize, usize), (E, F))>; + fn calc_score( - mtx: &Mutex<((usize, usize), (E, F))>, + mtx: &VideoCompareMutex, src_yuvcfg: &YuvConfig, dst_yuvcfg: &YuvConfig, inc: usize, @@ -404,13 +406,7 @@ fn compare_videos_inner( let current_frame = 0usize; let start_frame = start_frame.unwrap_or(0); - let end_frame = { - if let Some(frames_to_compare) = frames_to_compare { - Some(start_frame + (frames_to_compare * inc)) - } else { - None - } - }; + let end_frame = frames_to_compare.map(|frames_to_compare| start_frame + (frames_to_compare * inc)); let decoders = Arc::new(Mutex::new(((start_frame, current_frame), (source, distorted))));