Skip to main content

did_you_mean

Function did_you_mean 

Source
pub fn did_you_mean<'c>(
    word: &str,
    candidates: impl IntoIterator<Item = &'c str>,
) -> Option<&'c str>
Expand description

The candidate an author most likely meant by word — the nearest by edit distance, compared case-insensitively, when it is within a third of the word’s length (at least one edit). The first of equally near candidates wins, so a caller that lists candidates in a stable order gets a stable answer. word itself never counts as a suggestion for itself.

The one did-you-mean rule every LGX refusal uses: a misspelt event qualifier, an unknown component, an unresolved name in a template, a prop a placement does not declare.