From 44619fd24d973c4648a8561e6b65e21ffd489929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= Date: Sat, 28 Sep 2024 15:42:02 +0200 Subject: [PATCH] Fix new Clippy lint about manual `div_ceil` implementation This numeric method was added on Rust 1.73, which is below our MSRV. --- src/interlace.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/interlace.rs b/src/interlace.rs index 96b05fd3..b4670cf5 100644 --- a/src/interlace.rs +++ b/src/interlace.rs @@ -118,10 +118,8 @@ fn deinterlace_bits(png: &PngImage) -> Vec { let mut current_y: usize = pass_constants.y_shift as usize; for line in png.scan_lines(false) { let bit_vec = line.data.view_bits::(); - let bits_in_line = ((png.ihdr.width - u32::from(pass_constants.x_shift) - + u32::from(pass_constants.x_step) - - 1) - / u32::from(pass_constants.x_step)) as usize + let bits_in_line = (png.ihdr.width - u32::from(pass_constants.x_shift)) + .div_ceil(u32::from(pass_constants.x_step)) as usize * bits_per_pixel; for (i, bit) in bit_vec.iter().by_vals().enumerate() { // Avoid moving padded 0's into new image