fix most clippy lints
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Alexandru Macovei · committed by David Peter · parent 6aa87f3 · Browse files · 5 files·+11 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+11 added−11 removed
- other:+11 added−11 removed
Provenance
- Commit
fe53af0- Tree
9595d56- Author
Alexandru Macovei <alexnmaco@gmail.com>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
6aa87f3
5 files changed+11 added−11 removed
modified:src/internal/filter/size.rs+4 added-4 removed
22 unmodified lines23 const GIBI: u64 = MEBI * 1024;24 const TEBI: u64 = GIBI * 1024;25 26 impl SizeFilter {27- pub fn from_string<'a>(s: &str) -> Option<Self> {27+ pub fn from_string(s: &str) -> Option<Self> {28 if !SIZE_CAPTURES.is_match(s) {29 return None;30 }31 23 unmodified lines55 })56 }57 58 pub fn is_within(&self, size: u64) -> bool {59- match self {60- &SizeFilter::Max(limit) => size <= limit,61- &SizeFilter::Min(limit) => size >= limit,59+ match *self {60+ SizeFilter::Max(limit) => size <= limit,61+ SizeFilter::Min(limit) => size >= limit,62 }63 }64 }65 144 unmodified linesmodified:src/app.rs+1 added-1 removed
217 unmodified lines218 .number_of_values(1),219 )220 }221 222-#[cfg_attr(rustfmt, rustfmt_skip)]222+#[rustfmt::skip]223 fn usage() -> HashMap<&'static str, Help> {224 let mut h = HashMap::new();225 doc!(h, "hidden"226 , "Search hidden files and directories"153 unmodified linesmodified:src/main.rs+1 added-1 removed
47 unmodified lines48 49 // Get one or more root directories to search.50 let mut dir_vec: Vec<_> = match matches51 .values_of("path")52- .or(matches.values_of("search-path"))52+ .or_else(|| matches.values_of("search-path"))53 {54 Some(paths) => paths55 .map(|path| {56 let path_buffer = PathBuf::from(path);206 unmodified linesmodified:src/output.rs+3 added-3 removed
17 unmodified lines18 19 use ansi_term;20 21 /// Remove the `./` prefix from a path.22-fn strip_current_dir<'a>(pathbuf: &'a PathBuf) -> &'a Path {22+fn strip_current_dir(pathbuf: &PathBuf) -> &Path {23 let mut iter = pathbuf.components();24 let mut iter_next = iter.clone();25 if iter_next.next() == Some(Component::CurDir) {26 iter.next();42 unmodified lines69 70 write!(stdout, "{}", style.paint(component.to_string_lossy()))?;71 72 if wants_to_quit.load(Ordering::Relaxed) {73- write!(stdout, "\n")?;73+ writeln!(stdout)?;74 process::exit(ExitCode::KilledBySigint.into());75 }76 }77 78 if config.null_separator {79 write!(stdout, "\0")80 } else {81- writeln!(stdout, "")81+ writeln!(stdout)82 }83 }84 85 fn print_entry_uncolorized(9 unmodified linesmodified:src/walk.rs+2 added-2 removed
302 unmodified lines303 let entry_path = entry.path();304 305 // Filter out unwanted extensions.306 if let Some(ref exts_regex) = config.extensions {307- if let Some(path_str) = entry_path.file_name().map_or(None, |s| s.to_str()) {307+ if let Some(path_str) = entry_path.file_name().and_then(|s| s.to_str()) {308 if !exts_regex.is_match(path_str) {309 return ignore::WalkState::Continue;310 }311 } else {1 unmodified line313 }314 }315 316 // Filter out unwanted sizes if it is a file and we have been given size constraints.317- if config.size_constraints.len() > 0 {317+ if !config.size_constraints.is_empty() {318 if entry_path.is_file() {319 if let Ok(metadata) = entry_path.metadata() {320 let file_size = metadata.len();321 if config56 unmodified lines