From 8f62b0c325fe7a0622d03981bcc5ea0973e77b21 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 24 Sep 2023 12:42:23 -0500 Subject: [PATCH] clippy --- src/generate/magick.rs | 2 +- src/ingest.rs | 6 ++---- src/magick.rs | 5 +++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/generate/magick.rs b/src/generate/magick.rs index 3834355..5776a87 100644 --- a/src/generate/magick.rs +++ b/src/generate/magick.rs @@ -31,7 +31,7 @@ where let output_arg = format!("{}:-", format.magick_format()); let quality = quality.map(|q| q.to_string()); - let len = format.coalesce().then(|| 4).unwrap_or(3) + quality.is_some().then(|| 1).unwrap_or(0); + let len = 3 + if format.coalesce() { 1 } else { 0 } + if quality.is_some() { 1 } else { 0 }; let mut args: Vec<&str> = Vec::with_capacity(len); args.push("convert"); diff --git a/src/ingest.rs b/src/ingest.rs index c2fc9e5..40c353d 100644 --- a/src/ingest.rs +++ b/src/ingest.rs @@ -82,7 +82,7 @@ where } }; - let processed_reader = crate::magick::process_image_async_read( + crate::magick::process_image_async_read( validated_reader, magick_args, format, @@ -90,9 +90,7 @@ where quality, media.process_timeout, ) - .await?; - - processed_reader + .await? } else { validated_reader } diff --git a/src/magick.rs b/src/magick.rs index d08fef3..41a6b91 100644 --- a/src/magick.rs +++ b/src/magick.rs @@ -117,8 +117,9 @@ where let output_arg = format!("{}:-", format.magick_format()); let quality = quality.map(|q| q.to_string()); - let len = format.coalesce().then(|| 4).unwrap_or(3) - + quality.is_some().then(|| 1).unwrap_or(0) + let len = 3 + + if format.coalesce() { 1 } else { 0 } + + if quality.is_some() { 1 } else { 0 } + process_args.len(); let mut args: Vec<&str> = Vec::with_capacity(len);