Apply clippy::redundant_closure_for_method_calls
This commit is contained in:
parent
3d9d5eab2b
commit
06ce65c714
2 changed files with 9 additions and 4 deletions
|
|
@ -28,7 +28,7 @@ mod rayon;
|
|||
use std::{
|
||||
fs::{File, Metadata},
|
||||
io::{BufWriter, Read, Write, stdin, stdout},
|
||||
path::Path,
|
||||
path::{Path, PathBuf},
|
||||
sync::{
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
|
|
@ -275,7 +275,7 @@ pub fn optimize(input: &InFile, output: &OutFile, opts: &Options) -> PngResult<(
|
|||
(OutFile::Path { path, .. }, _) => {
|
||||
let output_path = path
|
||||
.as_ref()
|
||||
.map(|p| p.as_path())
|
||||
.map(PathBuf::as_path)
|
||||
.unwrap_or_else(|| input.path().unwrap());
|
||||
let out_file = File::create(output_path)
|
||||
.map_err(|err| PngError::WriteFailed(output_path.display().to_string(), err))?;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,12 @@ mod rayon;
|
|||
#[cfg(feature = "zopfli")]
|
||||
use std::num::NonZeroU64;
|
||||
use std::{
|
||||
ffi::OsString, fs::DirBuilder, io::Write, path::PathBuf, process::ExitCode, time::Duration,
|
||||
ffi::{OsStr, OsString},
|
||||
fs::DirBuilder,
|
||||
io::Write,
|
||||
path::PathBuf,
|
||||
process::ExitCode,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use clap::ArgMatches;
|
||||
|
|
@ -143,7 +148,7 @@ fn collect_files(
|
|||
} else {
|
||||
// Skip non png files if not given on top level
|
||||
if !top_level && {
|
||||
let extension = input.extension().map(|f| f.to_ascii_lowercase());
|
||||
let extension = input.extension().map(OsStr::to_ascii_lowercase);
|
||||
extension != Some(OsString::from("png"))
|
||||
&& extension != Some(OsString::from("apng"))
|
||||
} {
|
||||
|
|
|
|||
Loading…
Reference in a new issue