summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/ifs_same_cond.txt
blob: 024ba5df93a63a7a1651bb6075f95ab275493c54 (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 consecutive `if`s with the same condition.

### Why is this bad?
This is probably a copy & paste error.

### Example
```
if a == b {
    …
} else if a == b {
    …
}
```

Note that this lint ignores all conditions with a function call as it could
have side effects:

```
if foo() {
    …
} else if foo() { // not linted
    …
}
```