mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-19 02:10:34 +01:00
fix most clippy lints
This commit is contained in:
parent
6aa87f3423
commit
fe53af064b
5 changed files with 11 additions and 11 deletions
|
@ -219,7 +219,7 @@ pub fn build_app() -> App<'static, 'static> {
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#[rustfmt::skip]
|
||||
fn usage() -> HashMap<&'static str, Help> {
|
||||
let mut h = HashMap::new();
|
||||
doc!(h, "hidden"
|
||||
|
|
|
@ -24,7 +24,7 @@ const GIBI: u64 = MEBI * 1024;
|
|||
const TEBI: u64 = GIBI * 1024;
|
||||
|
||||
impl SizeFilter {
|
||||
pub fn from_string<'a>(s: &str) -> Option<Self> {
|
||||
pub fn from_string(s: &str) -> Option<Self> {
|
||||
if !SIZE_CAPTURES.is_match(s) {
|
||||
return None;
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ impl SizeFilter {
|
|||
}
|
||||
|
||||
pub fn is_within(&self, size: u64) -> bool {
|
||||
match self {
|
||||
&SizeFilter::Max(limit) => size <= limit,
|
||||
&SizeFilter::Min(limit) => size >= limit,
|
||||
match *self {
|
||||
SizeFilter::Max(limit) => size <= limit,
|
||||
SizeFilter::Min(limit) => size >= limit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ fn main() {
|
|||
// Get one or more root directories to search.
|
||||
let mut dir_vec: Vec<_> = match matches
|
||||
.values_of("path")
|
||||
.or(matches.values_of("search-path"))
|
||||
.or_else(|| matches.values_of("search-path"))
|
||||
{
|
||||
Some(paths) => paths
|
||||
.map(|path| {
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::sync::Arc;
|
|||
use ansi_term;
|
||||
|
||||
/// Remove the `./` prefix from a path.
|
||||
fn strip_current_dir<'a>(pathbuf: &'a PathBuf) -> &'a Path {
|
||||
fn strip_current_dir(pathbuf: &PathBuf) -> &Path {
|
||||
let mut iter = pathbuf.components();
|
||||
let mut iter_next = iter.clone();
|
||||
if iter_next.next() == Some(Component::CurDir) {
|
||||
|
@ -70,7 +70,7 @@ fn print_entry_colorized(
|
|||
write!(stdout, "{}", style.paint(component.to_string_lossy()))?;
|
||||
|
||||
if wants_to_quit.load(Ordering::Relaxed) {
|
||||
write!(stdout, "\n")?;
|
||||
writeln!(stdout)?;
|
||||
process::exit(ExitCode::KilledBySigint.into());
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ fn print_entry_colorized(
|
|||
if config.null_separator {
|
||||
write!(stdout, "\0")
|
||||
} else {
|
||||
writeln!(stdout, "")
|
||||
writeln!(stdout)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ fn spawn_senders(
|
|||
|
||||
// Filter out unwanted extensions.
|
||||
if let Some(ref exts_regex) = config.extensions {
|
||||
if let Some(path_str) = entry_path.file_name().map_or(None, |s| s.to_str()) {
|
||||
if let Some(path_str) = entry_path.file_name().and_then(|s| s.to_str()) {
|
||||
if !exts_regex.is_match(path_str) {
|
||||
return ignore::WalkState::Continue;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ fn spawn_senders(
|
|||
}
|
||||
|
||||
// Filter out unwanted sizes if it is a file and we have been given size constraints.
|
||||
if config.size_constraints.len() > 0 {
|
||||
if !config.size_constraints.is_empty() {
|
||||
if entry_path.is_file() {
|
||||
if let Ok(metadata) = entry_path.metadata() {
|
||||
let file_size = metadata.len();
|
||||
|
|
Loading…
Reference in a new issue