]> git.lizzy.rs Git - rust.git/blob - tests/ui/block_in_if_condition.stderr
factor ifs into function, add differing mutex test
[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:27:5
3    |
4 LL | /     if {
5 LL | |         let x = 3;
6 LL | |         x == 3
7 LL | |     } {
8    | |_____^
9    |
10    = note: `-D clippy::block-in-if-condition-stmt` implied by `-D warnings`
11 help: try
12    |
13 LL |     let res = {
14 LL |         let x = 3;
15 LL |         x == 3
16 LL |     }; if res {
17    |
18
19 error: omit braces around single expression condition
20   --> $DIR/block_in_if_condition.rs:38:8
21    |
22 LL |     if { true } {
23    |        ^^^^^^^^ help: try: `true`
24    |
25    = note: `-D clippy::block-in-if-condition-expr` implied by `-D warnings`
26
27 error: this boolean expression can be simplified
28   --> $DIR/block_in_if_condition.rs:47:8
29    |
30 LL |     if true && x == 3 {
31    |        ^^^^^^^^^^^^^^ help: try: `x == 3`
32    |
33    = note: `-D clippy::nonminimal-bool` implied by `-D warnings`
34
35 error: aborting due to 3 previous errors
36