From a234c39e41177d7b1810d7bb0fa6a3f84b19590a Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Sat, 22 Apr 2023 22:25:06 -0400 Subject: [PATCH] Fix new annoyingly pedantic clippy warnings --- Cargo.lock | 10 ---------- src/reduction/mod.rs | 12 ++++++------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 49d2b1ad..9b8d1e67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -265,15 +265,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c397ca3ea05ad509c4ec451fea28b4771236a376ca1c69fd5143aae0cf8f93c4" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "libc" version = "0.2.139" @@ -387,7 +378,6 @@ dependencies = [ "filetime", "image", "indexmap", - "itertools", "libdeflater", "log", "rayon", diff --git a/src/reduction/mod.rs b/src/reduction/mod.rs index 9bedcf62..defd0eab 100644 --- a/src/reduction/mod.rs +++ b/src/reduction/mod.rs @@ -158,16 +158,16 @@ fn palette_map_to_byte_map(png: &PngImage, palette_map: &[Option; 256]) -> O } BitDepth::Four => { for byte in 0..=255usize { - byte_map[byte] = palette_map[(byte & 0x0F)].unwrap_or(0) - | (palette_map[(byte >> 4)].unwrap_or(0) << 4); + byte_map[byte] = palette_map[byte & 0x0F].unwrap_or(0) + | (palette_map[byte >> 4].unwrap_or(0) << 4); } } BitDepth::Two => { for byte in 0..=255usize { - byte_map[byte] = palette_map[(byte & 0x03)].unwrap_or(0) - | (palette_map[((byte >> 2) & 0x03)].unwrap_or(0) << 2) - | (palette_map[((byte >> 4) & 0x03)].unwrap_or(0) << 4) - | (palette_map[(byte >> 6)].unwrap_or(0) << 6); + byte_map[byte] = palette_map[byte & 0x03].unwrap_or(0) + | (palette_map[(byte >> 2) & 0x03].unwrap_or(0) << 2) + | (palette_map[(byte >> 4) & 0x03].unwrap_or(0) << 4) + | (palette_map[byte >> 6].unwrap_or(0) << 6); } } _ => {}