Skip to main content

nearest

Function nearest 

Source
pub fn nearest<'a>(
    typed: &str,
    names: impl Iterator<Item = &'a str>,
) -> Option<&'a str>
Expand description

The closest command name to typed, when one is close enough to be worth suggesting.

The threshold is deliberately tight. A suggestion that is wrong is worse than none: the reader types it, gets a second refusal, and now distrusts the first one. One third of the typed length, so revieww suggests review and deploy suggests nothing at all.