summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/if_not_else.txt
blob: 0e5ac4ce6bb8047f8174bf2a1107f16646b347ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
### What it does
Checks for usage of `!` or `!=` in an if condition with an
else branch.

### Why is this bad?
Negations reduce the readability of statements.

### Example
```
if !v.is_empty() {
    a()
} else {
    b()
}
```

Could be written:

```
if v.is_empty() {
    b()
} else {
    a()
}
```