Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

Revert "fix(fst-dict): update dedup and sorting to be hopefully correct"

Grant Lemons8b92ea51a886
diff --git a/harper-core/src/spell/fst_dictionary.rs b/harper-core/src/spell/fst_dictionary.rs
index 47d2d7a62..d2c006e14 100644
--- a/harper-core/src/spell/fst_dictionary.rs
+++ b/harper-core/src/spell/fst_dictionary.rs
@@ -165,8 +165,8 @@ impl Dictionary for FstDictionary {
))
// Sort by edit distance
.sorted_unstable_by_key(|a| a.0)
- .sorted_by_key(|a| a.1)
- .dedup_by(|a, b| a.0 == b.0) // remove the one with the larger distance
+ .dedup_by(|a, b| a.0 == b.0)
+ .sorted_unstable_by_key(|a| a.1)
.take(max_results)
.map(|(index, edit_distance)| {
let (word, metadata) = &self.words[index as usize];