ferrous-systems / rust-training

Learning materials for the Rust Training courses by Ferrous Systems
144 stars 19 forks source link

Extra commas #54

Closed jonathanpallant closed 1 year ago

jonathanpallant commented 1 year ago

control-flow.html#/8 does not require the commas. It's also overly indented.

    fn main() {
        let a = 4;
        match a % 3 {
            0 => { println!("divisible by 3") },
            _ => { println!("not divisible by 3") },
        }
    }

should be

fn main() {
    let a = 4;
    match a % 3 {
        0 => { println!("divisible by 3") }
        _ => { println!("not divisible by 3") }
    }
}

or

fn main() {
    let a = 4;
    match a % 3 {
        0 => println!("divisible by 3"),
        _ => {
            println!("not divisible by 3")
        }
    }
}

to highlight the two kinds of match arms.