]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/blocks_in_if_conditions.stderr
Rollup merge of #71973 - lcnr:lazy-norm, r=nikomatsakis
[rust.git] / src / tools / clippy / tests / ui / blocks_in_if_conditions.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/blocks_in_if_conditions.rs:26:5
3    |
4 LL | /     if {
5 LL | |         let x = 3;
6 LL | |         x == 3
7 LL | |     } {
8    | |_____^
9    |
10    = note: `-D clippy::blocks-in-if-conditions` 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/blocks_in_if_conditions.rs:37:8
21    |
22 LL |     if { true } {
23    |        ^^^^^^^^ help: try: `true`
24
25 error: this boolean expression can be simplified
26   --> $DIR/blocks_in_if_conditions.rs:46:8
27    |
28 LL |     if true && x == 3 {
29    |        ^^^^^^^^^^^^^^ help: try: `x == 3`
30    |
31    = note: `-D clippy::nonminimal-bool` implied by `-D warnings`
32
33 error: aborting due to 3 previous errors
34