Fix new Clippy lints
This commit is contained in:
parent
2632be2034
commit
5f0a0d6938
5 changed files with 7 additions and 7 deletions
|
|
@ -5,8 +5,7 @@ extern crate test;
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use oxipng::internal_tests::*;
|
use oxipng::{internal_tests::*, *};
|
||||||
use oxipng::*;
|
|
||||||
use test::Bencher;
|
use test::Bencher;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ impl IhdrData {
|
||||||
let bpp = self.bpp();
|
let bpp = self.bpp();
|
||||||
|
|
||||||
fn bitmap_size(bpp: usize, w: usize, h: usize) -> usize {
|
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 {
|
if self.interlaced == Interlacing::None {
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ impl RawImage {
|
||||||
|
|
||||||
// Validate data length
|
// Validate data length
|
||||||
let bpp = bit_depth as usize * color_type.channels_per_pixel() as usize;
|
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;
|
let expected_len = row_bytes * height as usize;
|
||||||
if data.len() != expected_len {
|
if data.len() != expected_len {
|
||||||
return Err(PngError::IncorrectDataLength(data.len(), expected_len));
|
return Err(PngError::IncorrectDataLength(data.len(), expected_len));
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ mod rayon;
|
||||||
|
|
||||||
#[cfg(feature = "zopfli")]
|
#[cfg(feature = "zopfli")]
|
||||||
use std::num::NonZeroU8;
|
use std::num::NonZeroU8;
|
||||||
use std::process::ExitCode;
|
use std::{
|
||||||
use std::{ffi::OsString, fs::DirBuilder, io::Write, path::PathBuf, time::Duration};
|
ffi::OsString, fs::DirBuilder, io::Write, path::PathBuf, process::ExitCode, time::Duration,
|
||||||
|
};
|
||||||
|
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
mod cli;
|
mod cli;
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ impl Iterator for ScanLineRanges {
|
||||||
(self.width, None)
|
(self.width, None)
|
||||||
};
|
};
|
||||||
let bits_per_line = pixels_per_line as usize * self.bits_per_pixel;
|
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 {
|
if self.has_filter {
|
||||||
len += 1;
|
len += 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue