rust-lang/rust-by-example

Ergonomic match before introduction needs footnote, or caveat

Opened this issue · 0 comments

The lesson on for loops uses match *name and some pretty confusing notation for the matches. It could use a footnote.

fn main() {
    let mut names = vec!["Bob", "Frank", "Ferris"];

    for name in names.iter_mut() {
        *name = match name {
            &mut "Ferris" => "There is a rustacean among us!",
            _ => "Hello",
        }
    }

    println!("names: {:?}", names);
}