error: closure bodies that contain statements must be surrounded by braces --> $DIR/missing_braces_around_block.rs:16:26 | LL | (1..num).reduce(|a, b| | ^ ... LL | ).unwrap(); | ^ | note: statement found outside of a block --> $DIR/missing_braces_around_block.rs:18:26 | LL | println!("{}", a); | -----------------^ this `;` turns the preceding closure into a statement | | | this expression is a statement because of the trailing semicolon note: the closure body may be incorrectly delimited --> $DIR/missing_braces_around_block.rs:16:21 | LL | (1..num).reduce(|a, b| | _____________________^ LL | | LL | | println!("{}", a); | |_________________________^ this is the parsed closure... LL | a * b LL | ).unwrap(); | - ...but likely you meant the closure to end here help: try adding braces | LL ~ (1..num).reduce(|a, b| { LL | LL | println!("{}", a); LL | a * b LL ~ }).unwrap(); | error: closure bodies that contain statements must be surrounded by braces --> $DIR/missing_braces_around_block.rs:24:29 | LL | v.iter_mut().for_each(|x|*x = *x+1;); | ^ ^ | note: statement found outside of a block --> $DIR/missing_braces_around_block.rs:24:39 | LL | v.iter_mut().for_each(|x|*x = *x+1;); | ---------^ this `;` turns the preceding closure into a statement | | | this expression is a statement because of the trailing semicolon note: the closure body may be incorrectly delimited --> $DIR/missing_braces_around_block.rs:24:27 | LL | v.iter_mut().for_each(|x|*x = *x+1;); | ^^^^^^^^^^^^ - ...but likely you meant the closure to end here | | | this is the parsed closure... help: try adding braces | LL | v.iter_mut().for_each(|x| {*x = *x+1;}); | + + error: aborting due to 2 previous errors