diff --git a/deny.toml b/deny.toml index 951f2a2fab..fb0a8d4b0b 100644 --- a/deny.toml +++ b/deny.toml @@ -19,16 +19,9 @@ allow = [ "BSD-2-Clause", "BSD-3-Clause", "MIT", - "MIT-0", - "MPL-2.0", - "Unicode-DFS-2016", + "Unicode-3.0", ] -[[licenses.exceptions]] -allow = ["WTFPL"] -name = "pcx" -version = "*" - [advisories] yanked = "deny" ignore = [] @@ -41,5 +34,4 @@ deny = [] skip = [ { name = "bitflags" }, # Some deps depend on 1.3.2 while others on 2.6.0 { name = "hashbrown" }, # Some deps depend on 0.13.2 while others on 0.14.5 - { name = "miniz_oxide" } # Some deps depend on 0.7.4 while others on 0.8.0 ] diff --git a/src/buffer.rs b/src/buffer.rs index 6a87ae9313..269d446fc8 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -801,7 +801,7 @@ where /// the bounds will not overflow. fn check_image_fits(width: u32, height: u32, len: usize) -> bool { let checked_len = Self::image_buffer_len(width, height); - checked_len.map_or(false, |min_len| min_len <= len) + checked_len.is_some_and(|min_len| min_len <= len) } fn image_buffer_len(width: u32, height: u32) -> Option { diff --git a/src/codecs/avif/yuv.rs b/src/codecs/avif/yuv.rs index 29167342a4..e0c70174e6 100644 --- a/src/codecs/avif/yuv.rs +++ b/src/codecs/avif/yuv.rs @@ -528,7 +528,7 @@ fn process_halved_chroma_row< // preventing accidental use of invalid values from the trailing region. let y_plane = &image.y_plane[0..image.width]; - let chroma_size = image.width.div_ceil(2); + let chroma_size = (image.width + 1) / 2; let u_plane = &image.u_plane[0..chroma_size]; let v_plane = &image.v_plane[0..chroma_size]; let rgba = &mut rgba[0..image.width * CHANNELS]; diff --git a/src/codecs/pnm/decoder.rs b/src/codecs/pnm/decoder.rs index 01c2c54b44..7b22f9c003 100644 --- a/src/codecs/pnm/decoder.rs +++ b/src/codecs/pnm/decoder.rs @@ -692,8 +692,8 @@ where let token = reader .bytes() - .skip_while(|v| v.as_ref().ok().map_or(false, is_separator)) - .take_while(|v| v.as_ref().ok().map_or(false, |c| !is_separator(c))) + .skip_while(|v| v.as_ref().ok().is_some_and(is_separator)) + .take_while(|v| v.as_ref().ok().is_some_and(|c| !is_separator(c))) .collect::, _>>()?; if !token.is_ascii() { diff --git a/src/color.rs b/src/color.rs index b3745d9b83..a83ca8c6b4 100644 --- a/src/color.rs +++ b/src/color.rs @@ -441,6 +441,7 @@ impl FromPrimitive for T { // 1.0 (white) was picked as firefox and chrome choose to map NaN to that. #[inline] fn normalize_float(float: f32, max: f32) -> f32 { + #[allow(clippy::neg_cmp_op_on_partial_ord)] let clamped = if !(float < 1.0) { 1.0 } else { float.max(0.0) }; (clamped * max).round() } diff --git a/src/flat.rs b/src/flat.rs index 08f82475b9..a67dc9ab2f 100644 --- a/src/flat.rs +++ b/src/flat.rs @@ -282,7 +282,7 @@ impl SampleLayout { /// Check if a buffer of length `len` is large enough. #[must_use] pub fn fits(&self, len: usize) -> bool { - self.min_length().map_or(false, |min| len >= min) + self.min_length().is_some_and(|min| len >= min) } /// The extents of this array, in order of increasing strides. @@ -747,10 +747,7 @@ impl FlatSamples { where Buffer: AsRef<[T]>, { - let min_length = match self.min_length() { - None => return None, - Some(index) => index, - }; + let min_length = self.min_length()?; let slice = self.samples.as_ref(); if slice.len() < min_length { @@ -765,10 +762,7 @@ impl FlatSamples { where Buffer: AsMut<[T]>, { - let min_length = match self.min_length() { - None => return None, - Some(index) => index, - }; + let min_length = self.min_length()?; let slice = self.samples.as_mut(); if slice.len() < min_length { diff --git a/src/imageops/sample.rs b/src/imageops/sample.rs index 1f6ce53a77..fa8043a20e 100644 --- a/src/imageops/sample.rs +++ b/src/imageops/sample.rs @@ -870,6 +870,7 @@ where let max = S::DEFAULT_MAX_VALUE; let max: f32 = NumCast::from(max).unwrap(); + #[allow(clippy::redundant_guards)] let sum = match kernel.iter().fold(0.0, |s, &item| s + item) { x if x == 0.0 => 1.0, sum => sum,