Fix new annoyingly pedantic clippy warnings

This commit is contained in:
Josh Holmer 2023-04-22 22:25:06 -04:00
parent 0ff1049eb7
commit a234c39e41
2 changed files with 6 additions and 16 deletions

10
Cargo.lock generated
View file

@ -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",

View file

@ -158,16 +158,16 @@ fn palette_map_to_byte_map(png: &PngImage, palette_map: &[Option<u8>; 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);
}
}
_ => {}