//! The closest candidate to a misspelt name.
usecrate::similar_names::_helpers::distance::edit_distance;/// The candidate with the smallest edit distance to `name`, if there are any candidates.
pubfnnearest_name<'a>(name:&str,
candidates: impl IntoIterator<Item = &'astr>,
)->Option<&'astr>{
candidates
.into_iter().min_by_key(|candidate|edit_distance(name, candidate))}