summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/blocks_in_if_conditions.txt
blob: 3afa14853fd216139e4ff8d891fcfab8b57e1eaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
### What it does
Checks for `if` conditions that use blocks containing an
expression, statements or conditions that use closures with blocks.

### Why is this bad?
Style, using blocks in the condition makes it hard to read.

### Examples
```
if { true } { /* ... */ }

if { let x = somefunc(); x } { /* ... */ }
```

Use instead:
```
if true { /* ... */ }

let res = { let x = somefunc(); x };
if res { /* ... */ }
```