fn enfore_minimum_edit_distance(list: Vec<String>, minimum_edit_distance: usize) -> Vec<String> {
    let minimum_edit_distance: u32 = minimum_edit_distance.try_into().unwrap();
    let mut new_list = list.to_vec();
    new_list.retain(|potential_too_close_word| {
        for word in &list {
            // Skip if we're looking at the same word
            if word == potential_too_close_word {
                continue;
            }
            if find_edit_distance(word, potential_too_close_word) < minimum_edit_distance {
                // This potential_too_close_word is too close to another word on the list,
                // so we do NOT want to retain it.
                // return false to the retain
                return false;
            } else {
                // This particular word is not too close to this potential_prefix_word.
                // keep looping
                continue;
            };
        }
        // If we've made it here, we can be sure that potential_prefix_word is NOT too
        // close to another  word. So we want to retain it for the new_list.
        // To do this, we return true to the retain.
        true
    });
    new_list
}
/// Only retain words that are the given `minimum_edit_distance` away from all
/// other words on the list.
///
/// Calulates edit distance using a function in the edit_distance module.
Only retain words that are the given `minimum_edit_distance` away from all
other words on the list.

Calulates edit distance using a function in the edit_distance module.
Only retain words that are the given ` minimum_edit_distance ` away from all other words on the list . Calulates edit distance using a function in the edit_distance module .
fn enfore_minimum_edit_distance(list: Vec<String>, minimum_edit_distance: usize) -> Vec<String> {
    let minimum_edit_distance: u32 = minimum_edit_distance.try_into().unwrap();
    let mut new_list = list.to_vec();
    new_list.retain(|potential_too_close_word| {
        for word in &list {
            // Skip if we're looking at the same word
            if word == potential_too_close_word {
                continue;
            }
            if find_edit_distance(word, potential_too_close_word) < minimum_edit_distance {
                // This potential_too_close_word is too close to another word on the list,
                // so we do NOT want to retain it.
                // return false to the retain
                return false;
            } else {
                // This particular word is not too close to this potential_prefix_word.
                // keep looping
                continue;
            };
        }
        // If we've made it here, we can be sure that potential_prefix_word is NOT too
        // close to another  word. So we want to retain it for the new_list.
        // To do this, we return true to the retain.
        true
    });
    new_list
}
fn enfore_minimum_edit_distance ( list : Vec < String > , minimum_edit_distance : usize ) -> Vec < String > { let minimum_edit_distance : u32 = minimum_edit_distance . try_into ( ) . unwrap ( ) ; let mut new_list = list . to_vec ( ) ; new_list . retain ( | potential_too_close_word | { for word in & list { // Skip if we're looking at the same word if word == potential_too_close_word { continue ; } if find_edit_distance ( word , potential_too_close_word ) < minimum_edit_distance { // This potential_too_close_word is too close to another word on the list, // so we do NOT want to retain it. // return false to the retain return false ; } else { // This particular word is not too close to this potential_prefix_word. // keep looping continue ; } ; } // If we've made it here, we can be sure that potential_prefix_word is NOT too // close to another  word. So we want to retain it for the new_list. // To do this, we return true to the retain. true } ) ; new_list }
Only retain words that are the given `minimum_edit_distance` away from all
other words on the list.
Only retain words that are the given ` minimum_edit_distance ` away from all other words on the list .
list
Vec<String>
minimum_edit_distance
usize
list
Vec<String>
minimum_edit_distance
usize