Skip to content

Commit

Permalink
Fix new Clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTMjugador committed Jan 30, 2025
1 parent 2632be2 commit 5f0a0d6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions benches/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ extern crate test;

use std::path::PathBuf;

use oxipng::internal_tests::*;
use oxipng::*;
use oxipng::{internal_tests::*, *};
use test::Bencher;

#[bench]
Expand Down
2 changes: 1 addition & 1 deletion src/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl IhdrData {
let bpp = self.bpp();

fn bitmap_size(bpp: usize, w: usize, h: usize) -> usize {
((w * bpp + 7) / 8) * h
(w * bpp).div_ceil(8) * h
}

if self.interlaced == Interlacing::None {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl RawImage {

// Validate data length
let bpp = bit_depth as usize * color_type.channels_per_pixel() as usize;
let row_bytes = (bpp * width as usize + 7) / 8;
let row_bytes = (bpp * width as usize).div_ceil(8);
let expected_len = row_bytes * height as usize;
if data.len() != expected_len {
return Err(PngError::IncorrectDataLength(data.len(), expected_len));
Expand Down
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ mod rayon;

#[cfg(feature = "zopfli")]
use std::num::NonZeroU8;
use std::process::ExitCode;
use std::{ffi::OsString, fs::DirBuilder, io::Write, path::PathBuf, time::Duration};
use std::{
ffi::OsString, fs::DirBuilder, io::Write, path::PathBuf, process::ExitCode, time::Duration,
};

use clap::ArgMatches;
mod cli;
Expand Down
2 changes: 1 addition & 1 deletion src/png/scan_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl Iterator for ScanLineRanges {
(self.width, None)
};
let bits_per_line = pixels_per_line as usize * self.bits_per_pixel;
let mut len = (bits_per_line + 7) / 8;
let mut len = bits_per_line.div_ceil(8);
if self.has_filter {
len += 1;
}
Expand Down

0 comments on commit 5f0a0d6

Please sign in to comment.