Skip to content
Myr

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

5 files+11 added−11 removed

modified:src/internal/filter/size.rs+4 added-4 removed
22 unmodified lines
23const GIBI: u64 = MEBI * 1024;24const TEBI: u64 = GIBI * 1024;2526impl 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 lines
55 })56 }5758 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 lines
modified:src/app.rs+1 added-1 removed
217 unmodified lines
218 .number_of_values(1),219 )220}221222#[cfg_attr(rustfmt, rustfmt_skip)]222#[rustfmt::skip]223fn usage() -> HashMap<&'static str, Help> {224 let mut h = HashMap::new();225 doc!(h, "hidden"226 , "Search hidden files and directories"
153 unmodified lines
modified:src/main.rs+1 added-1 removed
47 unmodified lines
4849 // 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 lines
modified:src/output.rs+3 added-3 removed
17 unmodified lines
1819use ansi_term;2021/// Remove the `./` prefix from a path.22fn strip_current_dir<'a>(pathbuf: &'a PathBuf) -> &'a Path {22fn 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 lines
6970 write!(stdout, "{}", style.paint(component.to_string_lossy()))?;7172 if wants_to_quit.load(Ordering::Relaxed) {73 write!(stdout, "\n")?;73 writeln!(stdout)?;74 process::exit(ExitCode::KilledBySigint.into());75 }76 }7778 if config.null_separator {79 write!(stdout, "\0")80 } else {81 writeln!(stdout, "")81 writeln!(stdout)82 }83}8485fn print_entry_uncolorized(
9 unmodified lines
modified:src/walk.rs+2 added-2 removed
302 unmodified lines
303 let entry_path = entry.path();304305 // 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 line
313 }314 }315316 // 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 config
56 unmodified lines