diff --git a/src/atomicmin.rs b/src/atomicmin.rs index af2287a9..73c3d997 100644 --- a/src/atomicmin.rs +++ b/src/atomicmin.rs @@ -9,13 +9,13 @@ pub struct AtomicMin { impl AtomicMin { pub fn new(init: Option) -> Self { Self { - val: AtomicUsize::new(init.unwrap_or(usize::max_value())), + val: AtomicUsize::new(init.unwrap_or(usize::MAX)), } } pub fn get(&self) -> Option { let val = self.val.load(SeqCst); - if val == usize::max_value() { + if val == usize::MAX { None } else { Some(val) diff --git a/src/png/mod.rs b/src/png/mod.rs index 4df7169b..44bfded4 100644 --- a/src/png/mod.rs +++ b/src/png/mod.rs @@ -337,7 +337,7 @@ impl PngImage { // http://www.libpng.org/pub/png/book/chapter09.html let mut best_filter = 0; let mut best_line = Vec::new(); - let mut best_size = std::u64::MAX; + let mut best_size = u64::MAX; // Avoid vertical filtering on first line of each interlacing pass for filter in if last_pass == line.pass { 0..5 } else { 0..2 } { diff --git a/tests/filters.rs b/tests/filters.rs index 2f482e9b..4da00a8c 100644 --- a/tests/filters.rs +++ b/tests/filters.rs @@ -57,7 +57,7 @@ fn test_it_converts( if let Some(palette) = png.raw.palette.as_ref() { assert!(palette.len() <= 1 << (png.raw.ihdr.bit_depth.as_u8() as usize)); } else { - assert!(png.raw.ihdr.color_type != ColorType::Indexed); + assert_ne!(png.raw.ihdr.color_type, ColorType::Indexed); } remove_file(output).ok(); diff --git a/tests/regression.rs b/tests/regression.rs index 17a60f25..f4524c3a 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -64,7 +64,7 @@ fn test_it_converts( if let Some(palette) = png.raw.palette.as_ref() { assert!(palette.len() <= 1 << (png.raw.ihdr.bit_depth.as_u8() as usize)); } else { - assert!(png.raw.ihdr.color_type != ColorType::Indexed); + assert_ne!(png.raw.ihdr.color_type, ColorType::Indexed); } remove_file(output).ok();