Function rslint_core::util::find_best_match_for_name[][src]

pub fn find_best_match_for_name<'a>(
    iter_names: impl Iterator<Item = &'a str>,
    lookup: &str,
    dist: impl Into<Option<usize>>
) -> Option<&'a str>
Expand description

Find the best match for a string in an iterator of strings based on levenshtein distance.

This considers a case insensitive match and the levenshtein distance with a cutoff. This is taken from rustc’s implementation