No need to map the max_distance

This commit is contained in:
Dániel Buga 2020-10-16 12:49:25 +02:00
parent ed7c6819e4
commit d708d7fb79

View File

@ -54,7 +54,7 @@ pub fn find_best_match_for_name<'a, T>(
T: Iterator<Item = &'a Symbol>,
{
let lookup = &lookup.as_str();
let max_dist = dist.map_or_else(|| cmp::max(lookup.len(), 3) / 3, |d| d);
let max_dist = dist.unwrap_or_else(|| cmp::max(lookup.len(), 3) / 3);
let name_vec: Vec<&Symbol> = iter_names.collect();
let (case_insensitive_match, levenshtein_match) = name_vec