Apply clippy::if_not_else
This commit is contained in:
parent
59b916e736
commit
ead0097fef
2 changed files with 9 additions and 9 deletions
|
|
@ -44,9 +44,7 @@ impl IhdrData {
|
|||
(w * bpp).div_ceil(8) * h
|
||||
}
|
||||
|
||||
if !self.interlaced {
|
||||
bitmap_size(bpp, w, h) + h
|
||||
} else {
|
||||
if self.interlaced {
|
||||
let mut size = bitmap_size(bpp, (w + 7) >> 3, (h + 7) >> 3) + ((h + 7) >> 3);
|
||||
if w > 4 {
|
||||
size += bitmap_size(bpp, (w + 3) >> 3, (h + 7) >> 3) + ((h + 7) >> 3);
|
||||
|
|
@ -60,6 +58,8 @@ impl IhdrData {
|
|||
size += bitmap_size(bpp, w >> 1, (h + 1) >> 1) + ((h + 1) >> 1);
|
||||
}
|
||||
size + bitmap_size(bpp, w, h >> 1) + (h >> 1)
|
||||
} else {
|
||||
bitmap_size(bpp, w, h) + h
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ pub fn reduced_to_indexed(png: &PngImage, allow_grayscale: bool) -> Option<PngIm
|
|||
let transparency_pixel = transparent_shade.map(|t| Gray::from(t as u8));
|
||||
pmap.into_iter()
|
||||
.map(|px| {
|
||||
RGB::from(px).with_alpha(if Some(px) != transparency_pixel {
|
||||
255
|
||||
} else {
|
||||
RGB::from(px).with_alpha(if Some(px) == transparency_pixel {
|
||||
0
|
||||
} else {
|
||||
255
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
|
|
@ -68,10 +68,10 @@ pub fn reduced_to_indexed(png: &PngImage, allow_grayscale: bool) -> Option<PngIm
|
|||
let transparency_pixel = transparent_color.map(|t| t.map(|c| c as u8));
|
||||
pmap.into_iter()
|
||||
.map(|px| {
|
||||
px.with_alpha(if Some(px) != transparency_pixel {
|
||||
255
|
||||
} else {
|
||||
px.with_alpha(if Some(px) == transparency_pixel {
|
||||
0
|
||||
} else {
|
||||
255
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
|
|
|
|||
Loading…
Reference in a new issue