From ead0097fef56e76eb2b6c9d4559d62a220665a9a Mon Sep 17 00:00:00 2001 From: Luracasmus <77991691+Luracasmus@users.noreply.github.com> Date: Sat, 22 Nov 2025 19:59:36 +0100 Subject: [PATCH] Apply `clippy::if_not_else` --- src/headers.rs | 6 +++--- src/reduction/color.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/headers.rs b/src/headers.rs index f57de8c7..75a814f3 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -44,9 +44,7 @@ impl IhdrData { (w * bpp).div_ceil(8) * h } - if !self.interlaced { - bitmap_size(bpp, w, h) + h - } else { + if self.interlaced { let mut size = bitmap_size(bpp, (w + 7) >> 3, (h + 7) >> 3) + ((h + 7) >> 3); if w > 4 { size += bitmap_size(bpp, (w + 3) >> 3, (h + 7) >> 3) + ((h + 7) >> 3); @@ -60,6 +58,8 @@ impl IhdrData { size += bitmap_size(bpp, w >> 1, (h + 1) >> 1) + ((h + 1) >> 1); } size + bitmap_size(bpp, w, h >> 1) + (h >> 1) + } else { + bitmap_size(bpp, w, h) + h } } } diff --git a/src/reduction/color.rs b/src/reduction/color.rs index 0d1dde81..2836e656 100644 --- a/src/reduction/color.rs +++ b/src/reduction/color.rs @@ -54,10 +54,10 @@ pub fn reduced_to_indexed(png: &PngImage, allow_grayscale: bool) -> Option Option