find_best_match_for_name in rustc_span::edit_distance - Rust
Description: Finds the best match for a given word in the given iterator.

Skip to main content

## find_best_match_for_name

# Function find_best_match_for_name

Source

    pub fn find_best_match_for_name(
        candidates: &[Symbol],
        lookup: Symbol,
        dist: Option<usize>,
    ) -> Option<Symbol>

Expand description

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.

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