From deb679b8f58854f366d4666997361a2f1a88392d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 14 Jan 2022 09:16:39 +0100 Subject: [PATCH] Report all matching strings in fuzzy matcher even if they're duplicates --- crates/fuzzy/src/fuzzy.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fuzzy/src/fuzzy.rs b/crates/fuzzy/src/fuzzy.rs index c3624b4037..62624b033d 100644 --- a/crates/fuzzy/src/fuzzy.rs +++ b/crates/fuzzy/src/fuzzy.rs @@ -117,7 +117,7 @@ pub struct StringMatch { impl PartialEq for StringMatch { fn eq(&self, other: &Self) -> bool { - self.score.eq(&other.score) + self.cmp(other).is_eq() } } @@ -134,13 +134,13 @@ impl Ord for StringMatch { self.score .partial_cmp(&other.score) .unwrap_or(Ordering::Equal) - .then_with(|| self.string.cmp(&other.string)) + .then_with(|| self.candidate_index.cmp(&other.candidate_index)) } } impl PartialEq for PathMatch { fn eq(&self, other: &Self) -> bool { - self.score.eq(&other.score) + self.cmp(other).is_eq() } }