diff --git a/src/main.rs b/src/main.rs index 123728c..5787363 100644 --- a/src/main.rs +++ b/src/main.rs @@ -70,7 +70,9 @@ struct Args { #[show_image::main] fn main() -> Result<(), Box> { fmt() - .with_env_filter(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"))) + .with_env_filter( + EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")), + ) .with_writer(std::io::stderr) .init(); @@ -113,17 +115,17 @@ fn main() -> Result<(), Box> { if debug { debug_mode(&img, &result_rgba)?; - } - - if let Some(output_file) = output_file { - result_rgba.save(&output_file)?; - info!(path = %output_file.display(), "Wrote output image to file"); } else { - debug!("Writing output image to stdout (PNG)"); - let mut buffer = Cursor::new(Vec::new()); - result_rgba.write_to(&mut buffer, image::ImageFormat::Png)?; - let mut stdout = stdout().lock(); - stdout.write_all(&buffer.into_inner())?; + if let Some(output_file) = output_file { + result_rgba.save(&output_file)?; + info!(path = %output_file.display(), "Wrote output image to file"); + } else { + debug!("Writing output image to stdout (PNG)"); + let mut buffer = Cursor::new(Vec::new()); + result_rgba.write_to(&mut buffer, image::ImageFormat::Png)?; + let mut stdout = stdout().lock(); + stdout.write_all(&buffer.into_inner())?; + } } } Command::Batch { diff --git a/src/model.rs b/src/model.rs index 74abef5..18911d2 100644 --- a/src/model.rs +++ b/src/model.rs @@ -68,7 +68,12 @@ fn download_file(url: &str, dest: &Path) -> Result<(), Box> { // Only emit every 10% to avoid log spam while still giving feedback. if progress >= last_reported_pct + 10 { last_reported_pct = progress - (progress % 10); - debug!(percent = last_reported_pct, downloaded, total = total_size, "Download progress"); + debug!( + percent = last_reported_pct, + downloaded, + total = total_size, + "Download progress" + ); } } } diff --git a/src/postprocessing.rs b/src/postprocessing.rs index 98b646a..8a8afa2 100644 --- a/src/postprocessing.rs +++ b/src/postprocessing.rs @@ -16,10 +16,7 @@ pub fn apply_mask(original: &DynamicImage, mask: &GrayImage) -> Result