fn join_english_list(items: &[&str]) -> String {
    match items.len() {
        0 => String::new(),
        1 => items[0].to_string(),
        2 => items.join(" and "),
        len => format!("{}, and {}", items[..(len - 1)].join(", "), items[len - 1]),
    }
}
// Flatten a collection of strings into a single string, adding in commas as necessary, and adding
// "and" before the last item.
Flatten a collection of strings into a single string, adding in commas as necessary, and adding
"and" before the last item.
Flatten a collection of strings into a single string adding in commas as necessary and adding " and " before the last item .
fn join_english_list(items: &[&str]) -> String {
    match items.len() {
        0 => String::new(),
        1 => items[0].to_string(),
        2 => items.join(" and "),
        len => format!("{}, and {}", items[..(len - 1)].join(", "), items[len - 1]),
    }
}
fn join_english_list ( items : & [ & str ] ) -> String { match items . len ( ) { 0 => String :: new ( ) , 1 => items [ 0 ] . to_string ( ) , 2 => items . join ( " " ) , len => format ! ( " " items [ ( len 1 ) ] join ( " " ) items [ len 1 ] ) , } }
Flatten a collection of strings into a single string, adding in commas as necessary, and adding
"and" before the last item.
Flatten a collection of strings into a single string adding in commas as necessary and adding " and " before the last item .
items
&[&str]
items
&[&str]