Skip to content

Commit

Permalink
fix: inverted suggestions sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Feb 24, 2024
1 parent 7c15d69 commit f0ed577
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub fn suggest(input: &str, package: &PackageJsonOwned) -> Option<String> {
.filter(|(_, confidence)| *confidence > 0.7)
.collect::<Vec<_>>();

distances.sort_unstable_by(|a, b| a.1.partial_cmp(&b.1).unwrap_or(Ordering::Equal));

distances.sort_unstable_by(|a, b| b.1.partial_cmp(&a.1).unwrap_or(Ordering::Equal));
distances.first().map(|a| a.0.to_owned())
}

0 comments on commit f0ed577

Please sign in to comment.