Fix Clippy lints
This commit is contained in:
parent
9358f1b55f
commit
b3d5fae116
5 changed files with 18 additions and 10 deletions
|
|
@ -22,6 +22,10 @@ name = "oxipng"
|
|||
path = "src/main.rs"
|
||||
required-features = ["binary"]
|
||||
|
||||
[[bench]]
|
||||
name = "zopfli"
|
||||
required-features = ["zopfli"]
|
||||
|
||||
[dependencies]
|
||||
zopfli = { version = "0.7.1", optional = true }
|
||||
rgb = "0.8.33"
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ use crate::evaluate::Evaluator;
|
|||
use crate::png::PngData;
|
||||
use crate::png::PngImage;
|
||||
use crate::reduction::*;
|
||||
use log::{debug, error, info, warn};
|
||||
use log::{debug, info, warn};
|
||||
use rayon::prelude::*;
|
||||
use std::fmt;
|
||||
use std::fs::{copy, File, Metadata};
|
||||
use std::io::{stdin, stdout, BufWriter, Cursor, Read, Write};
|
||||
use std::io::{stdin, stdout, BufWriter, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
|
@ -1048,6 +1048,8 @@ fn copy_times(input_path_meta: &Metadata, out_path: &Path) -> PngResult<()> {
|
|||
mod sanity_checks {
|
||||
use super::*;
|
||||
use image::{DynamicImage, GenericImageView, ImageFormat, Pixel};
|
||||
use log::error;
|
||||
use std::io::Cursor;
|
||||
|
||||
/// Validate that the output png data still matches the original image
|
||||
pub(super) fn validate_output(output: &[u8], original_data: &[u8]) -> bool {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ where
|
|||
|
||||
impl<I: Iterator> ParallelIterator for I {}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn join<A, B>(a: impl FnOnce() -> A, b: impl FnOnce() -> B) -> (A, B) {
|
||||
(a(), b())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ fn get_opts(input: &Path) -> (OutFile, oxipng::Options) {
|
|||
}
|
||||
|
||||
/// Add callback to allow checks before the output file is deleted again
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn test_it_converts_callbacks<CBPRE, CBPOST>(
|
||||
input: PathBuf,
|
||||
output: &OutFile,
|
||||
|
|
@ -38,8 +39,8 @@ fn test_it_converts_callbacks<CBPRE, CBPOST>(
|
|||
mut callback_pre: CBPRE,
|
||||
mut callback_post: CBPOST,
|
||||
) where
|
||||
CBPOST: FnMut(&Path) -> (),
|
||||
CBPRE: FnMut(&Path) -> (),
|
||||
CBPOST: FnMut(&Path),
|
||||
CBPRE: FnMut(&Path),
|
||||
{
|
||||
let png = PngData::new(&input, opts.fix_errors).unwrap();
|
||||
|
||||
|
|
@ -48,14 +49,14 @@ fn test_it_converts_callbacks<CBPRE, CBPOST>(
|
|||
|
||||
callback_pre(&input);
|
||||
|
||||
match oxipng::optimize(&InFile::Path(input), &output, &opts) {
|
||||
match oxipng::optimize(&InFile::Path(input), output, opts) {
|
||||
Ok(_) => (),
|
||||
Err(x) => panic!("{}", x),
|
||||
};
|
||||
let output = output.path().unwrap();
|
||||
assert!(output.exists());
|
||||
|
||||
callback_post(&output);
|
||||
callback_post(output);
|
||||
|
||||
let png = match PngData::new(output, opts.fix_errors) {
|
||||
Ok(x) => x,
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ fn small_files() {
|
|||
let png = match PngData::new(output, opts.fix_errors) {
|
||||
Ok(x) => x,
|
||||
Err(x) => {
|
||||
remove_file(&output).ok();
|
||||
remove_file(output).ok();
|
||||
panic!("{}", x)
|
||||
}
|
||||
};
|
||||
|
|
@ -866,7 +866,7 @@ fn palette_should_be_reduced_with_dupes() {
|
|||
let png = match PngData::new(output, opts.fix_errors) {
|
||||
Ok(x) => x,
|
||||
Err(x) => {
|
||||
remove_file(&output).ok();
|
||||
remove_file(output).ok();
|
||||
panic!("{}", x)
|
||||
}
|
||||
};
|
||||
|
|
@ -899,7 +899,7 @@ fn palette_should_be_reduced_with_unused() {
|
|||
let png = match PngData::new(output, opts.fix_errors) {
|
||||
Ok(x) => x,
|
||||
Err(x) => {
|
||||
remove_file(&output).ok();
|
||||
remove_file(output).ok();
|
||||
panic!("{}", x)
|
||||
}
|
||||
};
|
||||
|
|
@ -932,7 +932,7 @@ fn palette_should_be_reduced_with_both() {
|
|||
let png = match PngData::new(output, opts.fix_errors) {
|
||||
Ok(x) => x,
|
||||
Err(x) => {
|
||||
remove_file(&output).ok();
|
||||
remove_file(output).ok();
|
||||
panic!("{}", x)
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue