]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/if_not_else.txt
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
[rust.git] / src / tools / clippy / src / docs / if_not_else.txt
1 ### What it does
2 Checks for usage of `!` or `!=` in an if condition with an
3 else branch.
4
5 ### Why is this bad?
6 Negations reduce the readability of statements.
7
8 ### Example
9 ```
10 if !v.is_empty() {
11     a()
12 } else {
13     b()
14 }
15 ```
16
17 Could be written:
18
19 ```
20 if v.is_empty() {
21     b()
22 } else {
23     a()
24 }
25 ```