From 0788c43c3fcd61f0d3a3807d250563739d6ed371 Mon Sep 17 00:00:00 2001 From: garlic-hub <12842269+garlic-hub@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:46:24 -0800 Subject: [PATCH] Clean up clippy warnings --- src/dir_entry.rs | 2 +- src/exec/token.rs | 2 +- src/regex_helper.rs | 2 +- src/walk.rs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dir_entry.rs b/src/dir_entry.rs index f44f2be..64d7adf 100644 --- a/src/dir_entry.rs +++ b/src/dir_entry.rs @@ -113,7 +113,7 @@ impl Eq for DirEntry {} impl PartialOrd for DirEntry { #[inline] fn partial_cmp(&self, other: &Self) -> Option { - self.path().partial_cmp(other.path()) + Some(self.cmp(other)) } } diff --git a/src/exec/token.rs b/src/exec/token.rs index 2dc37ce..b96c3a3 100644 --- a/src/exec/token.rs +++ b/src/exec/token.rs @@ -41,7 +41,7 @@ pub(super) fn tokenize(input: &str) -> ArgumentTemplate { let mut remaining = input; let mut buf = String::new(); let placeholders = PLACEHOLDERS.get_or_init(|| { - AhoCorasick::new(&["{{", "}}", "{}", "{/}", "{//}", "{.}", "{/.}"]).unwrap() + AhoCorasick::new(["{{", "}}", "{}", "{/}", "{//}", "{.}", "{/.}"]).unwrap() }); while let Some(m) = placeholders.find(remaining) { match m.pattern().as_u32() { diff --git a/src/regex_helper.rs b/src/regex_helper.rs index 98211fe..39878f5 100644 --- a/src/regex_helper.rs +++ b/src/regex_helper.rs @@ -16,7 +16,7 @@ fn hir_has_uppercase_char(hir: &Hir) -> bool { use regex_syntax::hir::*; match hir.kind() { - HirKind::Literal(Literal(bytes)) => match std::str::from_utf8(&bytes) { + HirKind::Literal(Literal(bytes)) => match std::str::from_utf8(bytes) { Ok(s) => s.chars().any(|c| c.is_uppercase()), Err(_) => bytes.iter().any(|b| char::from(*b).is_uppercase()), }, diff --git a/src/walk.rs b/src/walk.rs index c81d2a4..6f83365 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -250,7 +250,7 @@ impl<'a, W: Write> ReceiverBuffer<'a, W> { /// Output a path. fn print(&mut self, entry: &DirEntry) -> Result<(), ExitCode> { - output::print_entry(&mut self.stdout, entry, &self.config); + output::print_entry(&mut self.stdout, entry, self.config); if self.interrupt_flag.load(Ordering::Relaxed) { // Ignore any errors on flush, because we're about to exit anyway @@ -413,7 +413,7 @@ impl WorkerState { // This will be set to `Some` if the `--exec` argument was supplied. if let Some(ref cmd) = config.command { if cmd.in_batch_mode() { - exec::batch(rx.into_iter().flatten(), cmd, &config) + exec::batch(rx.into_iter().flatten(), cmd, config) } else { let out_perm = Mutex::new(()); @@ -426,7 +426,7 @@ impl WorkerState { // Spawn a job thread that will listen for and execute inputs. let handle = scope - .spawn(|| exec::job(rx.into_iter().flatten(), cmd, &out_perm, &config)); + .spawn(|| exec::job(rx.into_iter().flatten(), cmd, &out_perm, config)); // Push the handle of the spawned thread into the vector for later joining. handles.push(handle);