]> git.lizzy.rs Git - rust.git/blob - tests/ui/block_in_if_condition.stderr
Merge branch 'master' into rustfmt_tests
[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:35:8
3    |
4 35 |       if {
5    |  ________^
6 36 | |         let x = 3;
7 37 | |         x == 3
8 38 | |     } {
9    | |_____^
10    |
11    = note: `-D clippy::block-in-if-condition-stmt` implied by `-D warnings`
12    = help: try
13            let res = {
14                let x = 3;
15                x == 3
16            };
17            if res {
18                6
19            } ... 
20
21 error: omit braces around single expression condition
22   --> $DIR/block_in_if_condition.rs:46:8
23    |
24 46 |     if { true } {
25    |        ^^^^^^^^
26    |
27    = note: `-D clippy::block-in-if-condition-expr` implied by `-D warnings`
28    = help: try
29            if true {
30                6
31            } ... 
32
33 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'
34   --> $DIR/block_in_if_condition.rs:66:17
35    |
36 66 |               |x| {
37    |  _________________^
38 67 | |                 let target = 3;
39 68 | |                 x == target
40 69 | |             },
41    | |_____________^
42
43 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'
44   --> $DIR/block_in_if_condition.rs:75:13
45    |
46 75 |           |x| {
47    |  _____________^
48 76 | |             let target = 3;
49 77 | |             x == target
50 78 | |         },
51    | |_________^
52
53 error: this boolean expression can be simplified
54   --> $DIR/block_in_if_condition.rs:85:8
55    |
56 85 |     if true && x == 3 {
57    |        ^^^^^^^^^^^^^^ help: try: `x == 3`
58    |
59    = note: `-D clippy::nonminimal-bool` implied by `-D warnings`
60
61 error: aborting due to 5 previous errors
62