]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/ifs_same_cond.txt
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
[rust.git] / src / tools / clippy / src / docs / ifs_same_cond.txt
1 ### What it does
2 Checks for consecutive `if`s with the same condition.
3
4 ### Why is this bad?
5 This is probably a copy & paste error.
6
7 ### Example
8 ```
9 if a == b {
10     …
11 } else if a == b {
12     …
13 }
14 ```
15
16 Note that this lint ignores all conditions with a function call as it could
17 have side effects:
18
19 ```
20 if foo() {
21     …
22 } else if foo() { // not linted
23     …
24 }
25 ```