blob: dac9a8cfc69d49a30d7698369a0674501dce324c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
error: closure bodies that contain statements must be surrounded by braces
--> $DIR/missing_braces_around_block.rs:14:26
|
LL | (1..num).reduce(|a, b|
| ^
...
LL | ).unwrap();
| ^
|
note: statement found outside of a block
--> $DIR/missing_braces_around_block.rs:16: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:14: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: aborting due to previous error
|