Fix clippy lints
This commit is contained in:
parent
9054b2d947
commit
17f5cc36ca
6 changed files with 7 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
/// The color type used to represent this image
|
/// The color type used to represent this image
|
||||||
pub enum ColorType {
|
pub enum ColorType {
|
||||||
/// Grayscale, with one color channel
|
/// Grayscale, with one color channel
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ pub fn zopfli_deflate(data: &[u8]) -> PngResult<Vec<u8>> {
|
||||||
Ok(output)
|
Ok(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
/// DEFLATE algorithms supported by oxipng
|
/// DEFLATE algorithms supported by oxipng
|
||||||
pub enum Deflaters {
|
pub enum Deflaters {
|
||||||
/// Use the Zlib/Miniz DEFLATE implementation
|
/// Use the Zlib/Miniz DEFLATE implementation
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ impl IhdrData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
/// Options to use for performing operations on headers (such as stripping)
|
/// Options to use for performing operations on headers (such as stripping)
|
||||||
pub enum Headers {
|
pub enum Headers {
|
||||||
/// None
|
/// None
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ impl PngImage {
|
||||||
filter_line(filter, bpp, line.data, last_line, &mut f_buf);
|
filter_line(filter, bpp, line.data, last_line, &mut f_buf);
|
||||||
let size = f_buf.iter().fold(0_u64, |acc, &x| {
|
let size = f_buf.iter().fold(0_u64, |acc, &x| {
|
||||||
let signed = x as i8;
|
let signed = x as i8;
|
||||||
acc + i16::from(signed).abs() as u64
|
acc + i16::from(signed).unsigned_abs() as u64
|
||||||
});
|
});
|
||||||
if size < best_size {
|
if size < best_size {
|
||||||
best_size = size;
|
best_size = size;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ pub fn reduce_rgba_to_grayscale_alpha(png: &PngImage) -> Option<PngImage> {
|
||||||
|
|
||||||
let mut aux_headers = png.aux_headers.clone();
|
let mut aux_headers = png.aux_headers.clone();
|
||||||
if let Some(sbit_header) = png.aux_headers.get(b"sBIT") {
|
if let Some(sbit_header) = png.aux_headers.get(b"sBIT") {
|
||||||
if let Some(&s) = sbit_header.get(0) {
|
if let Some(&s) = sbit_header.first() {
|
||||||
aux_headers.insert(*b"sBIT", vec![s]);
|
aux_headers.insert(*b"sBIT", vec![s]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +247,7 @@ pub fn reduce_rgb_to_grayscale(png: &PngImage) -> Option<PngImage> {
|
||||||
|
|
||||||
let mut aux_headers = png.aux_headers.clone();
|
let mut aux_headers = png.aux_headers.clone();
|
||||||
if let Some(sbit_header) = png.aux_headers.get(b"sBIT") {
|
if let Some(sbit_header) = png.aux_headers.get(b"sBIT") {
|
||||||
if let Some(&byte) = sbit_header.get(0) {
|
if let Some(&byte) = sbit_header.first() {
|
||||||
aux_headers.insert(*b"sBIT", vec![byte]);
|
aux_headers.insert(*b"sBIT", vec![byte]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ fn do_palette_reduction(png: &PngImage, palette_map: &[Option<u8>; 256]) -> Opti
|
||||||
let mut aux_headers = png.aux_headers.clone();
|
let mut aux_headers = png.aux_headers.clone();
|
||||||
if let Some(bkgd_header) = png.aux_headers.get(b"bKGD") {
|
if let Some(bkgd_header) = png.aux_headers.get(b"bKGD") {
|
||||||
if let Some(Some(map_to)) = bkgd_header
|
if let Some(Some(map_to)) = bkgd_header
|
||||||
.get(0)
|
.first()
|
||||||
.and_then(|&idx| palette_map.get(idx as usize))
|
.and_then(|&idx| palette_map.get(idx as usize))
|
||||||
{
|
{
|
||||||
aux_headers.insert(*b"bKGD", vec![*map_to]);
|
aux_headers.insert(*b"bKGD", vec![*map_to]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue