small fix

This commit is contained in:
Rémi Lauzier 2021-06-24 16:21:37 -04:00 committed by Josh Holmer
parent 91a18ebe97
commit 286aaffa31
4 changed files with 5 additions and 5 deletions

View file

@ -9,13 +9,13 @@ pub struct AtomicMin {
impl AtomicMin {
pub fn new(init: Option<usize>) -> Self {
Self {
val: AtomicUsize::new(init.unwrap_or(usize::max_value())),
val: AtomicUsize::new(init.unwrap_or(usize::MAX)),
}
}
pub fn get(&self) -> Option<usize> {
let val = self.val.load(SeqCst);
if val == usize::max_value() {
if val == usize::MAX {
None
} else {
Some(val)

View file

@ -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 } {

View file

@ -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();

View file

@ -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();