]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
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: `-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 | --> $DIR/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 | --> $DIR/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 | 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' | |
40 | --> $DIR/block_in_if_condition.rs:61:22 | |
41 | | | |
42 | 61 | if predicate(|x| { let target = 3; x == target }, v) { | |
43 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
44 | ||
45 | error: this boolean expression can be simplified | |
46 | --> $DIR/block_in_if_condition.rs:67:8 | |
47 | | | |
48 | 67 | if true && x == 3 { | |
49 | | ^^^^^^^^^^^^^^ help: try: `x == 3` | |
50 | | | |
51 | = note: `-D nonminimal-bool` implied by `-D warnings` | |
52 |