From e5e6c7f09dbe699e33b98dfcd714845d72a89d84 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Sat, 2 Mar 2024 01:02:34 -0500 Subject: [PATCH] Fix Clippy warnings in `fuzzy` crate (#8701) This PR fixes a number of Clippy warnings in the `fuzzy` crate. Release Notes: - N/A --- crates/fuzzy/src/char_bag.rs | 4 ++-- crates/fuzzy/src/paths.rs | 2 +- crates/fuzzy/src/strings.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fuzzy/src/char_bag.rs b/crates/fuzzy/src/char_bag.rs index 8fc36368a1..ca40d730fb 100644 --- a/crates/fuzzy/src/char_bag.rs +++ b/crates/fuzzy/src/char_bag.rs @@ -10,14 +10,14 @@ impl CharBag { fn insert(&mut self, c: char) { let c = c.to_ascii_lowercase(); - if ('a'..='z').contains(&c) { + if c.is_ascii_lowercase() { let mut count = self.0; let idx = c as u8 - b'a'; count >>= idx * 2; count = ((count << 1) | 1) & 3; count <<= idx * 2; self.0 |= count; - } else if ('0'..='9').contains(&c) { + } else if c.is_ascii_digit() { let idx = c as u8 - b'0'; self.0 |= 1 << (idx + 52); } else if c == '-' { diff --git a/crates/fuzzy/src/paths.rs b/crates/fuzzy/src/paths.rs index e982195158..25927f1829 100644 --- a/crates/fuzzy/src/paths.rs +++ b/crates/fuzzy/src/paths.rs @@ -200,7 +200,7 @@ pub async fn match_path_sets<'a, Set: PathMatchCandidateSet<'a>>( usize::MAX, |relative_to| { distance_between_paths( - candidate.path.as_ref(), + candidate.path, relative_to.as_ref(), ) }, diff --git a/crates/fuzzy/src/strings.rs b/crates/fuzzy/src/strings.rs index 5028a43fd7..e1f6de37a5 100644 --- a/crates/fuzzy/src/strings.rs +++ b/crates/fuzzy/src/strings.rs @@ -57,10 +57,10 @@ pub struct StringMatch { } impl StringMatch { - pub fn ranges<'a>(&'a self) -> impl 'a + Iterator> { + pub fn ranges(&self) -> impl '_ + Iterator> { let mut positions = self.positions.iter().peekable(); iter::from_fn(move || { - while let Some(start) = positions.next().copied() { + if let Some(start) = positions.next().copied() { let mut end = start + self.char_len_at_index(start); while let Some(next_start) = positions.peek() { if end == **next_start {