]> git.lizzy.rs Git - rust.git/blob - clippy_tests/examples/block_in_if_condition.stderr
18d5843fe3f907b658a38e488204d7a89932abab
[rust.git] / clippy_tests / examples / 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   --> 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: `-D 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   --> block_in_if_condition.rs:41:8
23    |
24 41 |     if { true } {
25    |        ^^^^^^^^
26    |
27    = note: `-D 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   --> block_in_if_condition.rs:58:49
35    |
36 58 |     if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) {
37    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38    |
39    = note: `-D block-in-if-condition-stmt` implied by `-D warnings`
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   --> block_in_if_condition.rs:61:22
43    |
44 61 |     if predicate(|x| { let target = 3; x == target }, v) {
45    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46    |
47    = note: `-D block-in-if-condition-stmt` implied by `-D warnings`
48
49 error: this boolean expression can be simplified
50   --> block_in_if_condition.rs:67:8
51    |
52 67 |     if true && x == 3 {
53    |        ^^^^^^^^^^^^^^ help: try `x == 3`
54    |
55    = note: `-D nonminimal-bool` implied by `-D warnings`
56
57 error: aborting due to previous error(s)
58
59 error: Could not compile `clippy_tests`.
60
61 To learn more, run the command again with --verbose.