Apply clippy::missing_const_for_fn

This commit is contained in:
Luracasmus 2025-11-22 19:24:51 +01:00 committed by Alejandro González
parent 7c666deda6
commit 3d9d5eab2b
No known key found for this signature in database
4 changed files with 6 additions and 6 deletions

View file

@ -35,12 +35,12 @@ impl IhdrData {
/// Byte length of IDAT that is correct for this IHDR /// Byte length of IDAT that is correct for this IHDR
#[must_use] #[must_use]
pub fn raw_data_size(&self) -> usize { pub const fn raw_data_size(&self) -> usize {
let w = self.width as usize; let w = self.width as usize;
let h = self.height as usize; let h = self.height as usize;
let bpp = self.bpp(); let bpp = self.bpp();
fn bitmap_size(bpp: usize, w: usize, h: usize) -> usize { const fn bitmap_size(bpp: usize, w: usize, h: usize) -> usize {
(w * bpp).div_ceil(8) * h (w * bpp).div_ceil(8) * h
} }

View file

@ -149,7 +149,7 @@ fn deinterlace_bytes(png: &PngImage) -> Vec<u8> {
lines.concat() lines.concat()
} }
fn increment_pass(current_pass: &mut u8, ihdr: &IhdrData) -> bool { const fn increment_pass(current_pass: &mut u8, ihdr: &IhdrData) -> bool {
if *current_pass == 7 { if *current_pass == 7 {
return false; return false;
} }

View file

@ -659,7 +659,7 @@ fn recompress_frames(
} }
/// Check if an image was already optimized prior to oxipng's operations /// Check if an image was already optimized prior to oxipng's operations
fn is_fully_optimized(original_size: usize, optimized_size: usize, opts: &Options) -> bool { const fn is_fully_optimized(original_size: usize, optimized_size: usize, opts: &Options) -> bool {
original_size <= optimized_size && !opts.force original_size <= optimized_size && !opts.force
} }

View file

@ -32,7 +32,7 @@ impl OutFile {
/// ///
/// This is a convenience method for `OutFile::Path { path: Some(path), preserve_attrs: false }`. /// This is a convenience method for `OutFile::Path { path: Some(path), preserve_attrs: false }`.
#[must_use] #[must_use]
pub fn from_path(path: PathBuf) -> Self { pub const fn from_path(path: PathBuf) -> Self {
Self::Path { Self::Path {
path: Some(path), path: Some(path),
preserve_attrs: false, preserve_attrs: false,
@ -199,7 +199,7 @@ impl Options {
self self
} }
fn apply_preset_2(self) -> Self { const fn apply_preset_2(self) -> Self {
self self
} }