summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/collapsible_if.txt
blob: e1264ee062e955437c7199981de2dd21a2eaa135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
### What it does
Checks for nested `if` statements which can be collapsed
by `&&`-combining their conditions.

### Why is this bad?
Each `if`-statement adds one level of nesting, which
makes code look more complex than it really is.

### Example
```
if x {
    if y {
        // …
    }
}
```

Use instead:
```
if x && y {
    // …
}
```