]> git.lizzy.rs Git - rust.git/blob - tests/ui/block_in_if_condition.stderr
263193491b7ad18402bbc8a4737674663697c670
[rust.git] / tests / ui / block_in_if_condition.stderr
1 error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
2   --> $DIR/block_in_if_condition.rs:30:8
3    |
4 30 |       if {
5    |  ________^
6 31 | |         let x = 3;
7 32 | |         x == 3
8 33 | |     } {
9    | |_____^
10    |
11 note: lint level defined here
12   --> $DIR/block_in_if_condition.rs:5:9
13    |
14 5  | #![deny(block_in_if_condition_stmt)]
15    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
16    = help: try
17            let res = {
18                let x = 3;
19                x == 3
20            };
21            if res {
22                6
23            } ... 
24
25 error: omit braces around single expression condition
26   --> $DIR/block_in_if_condition.rs:41:8
27    |
28 41 |     if { true } {
29    |        ^^^^^^^^
30    |
31 note: lint level defined here
32   --> $DIR/block_in_if_condition.rs:4:9
33    |
34 4  | #![deny(block_in_if_condition_expr)]
35    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
36    = help: try
37            if true {
38                6
39            } ... 
40
41 error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
42   --> $DIR/block_in_if_condition.rs:58:49
43    |
44 58 |     if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) {
45    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46
47 error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
48   --> $DIR/block_in_if_condition.rs:62:22
49    |
50 62 |     if predicate(|x| { let target = 3; x == target }, v) {
51    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52
53 warning: this boolean expression can be simplified
54   --> $DIR/block_in_if_condition.rs:70:8
55    |
56 70 |     if true && x == 3 {
57    |        ^^^^^^^^^^^^^^
58    |
59 note: lint level defined here
60   --> $DIR/block_in_if_condition.rs:7:9
61    |
62 7  | #![warn(nonminimal_bool)]
63    |         ^^^^^^^^^^^^^^^
64 help: try
65    |     if x == 3 {
66
67 error: aborting due to 4 previous errors
68