[][src]Function syntax::util::lev_distance::find_best_match_for_name

pub fn find_best_match_for_name<'a, T>(
    iter_names: T,
    lookup: &str,
    dist: Option<usize>
) -> Option<Symbol> where
    T: Iterator<Item = &'a Symbol>, 
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Finds the best match for a given word in the given iterator

As a loose rule to avoid the obviously incorrect suggestions, it takes an optional limit for the maximum allowable edit distance, which defaults to one-third of the given word.

Besides Levenshtein, we use case insensitive comparison to improve accuracy on an edge case with a lower(upper)case letters mismatch.