rustc_span::edit_distance

Function find_best_match_for_name_with_substrings

source
pub fn find_best_match_for_name_with_substrings(
    candidates: &[Symbol],
    lookup: Symbol,
    dist: Option<usize>,
) -> Option<Symbol>
Expand description

Finds the best match for given word in the given iterator where substrings are meaningful.

A version of find_best_match_for_name that uses edit_distance_with_substrings as the score for word similarity. This takes an optional distance limit which defaults to one-third of the given word.

We use case insensitive comparison to improve accuracy on an edge case with a lower(upper)case letters mismatch.