mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
chore: stricter comparison
This commit is contained in:
parent
7980819d6a
commit
e53c61cb59
1 changed files with 5 additions and 1 deletions
|
|
@ -154,7 +154,11 @@ pub fn find_similars(
|
|||
let distance = compare_string(typo, candidate);
|
||||
use std::cmp::Ordering::*;
|
||||
match distance.cmp(&min_distance) {
|
||||
Equal => min_distance_index.push(i),
|
||||
Equal => {
|
||||
if !min_distance_index.is_empty() {
|
||||
min_distance_index.push(i)
|
||||
}
|
||||
},
|
||||
Less => {
|
||||
min_distance = distance;
|
||||
min_distance_index.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue