]> git.lizzy.rs Git - rust.git/blob - src/docs/bool_comparison.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / bool_comparison.txt
1 ### What it does
2 Checks for expressions of the form `x == true`,
3 `x != true` and order comparisons such as `x < true` (or vice versa) and
4 suggest using the variable directly.
5
6 ### Why is this bad?
7 Unnecessary code.
8
9 ### Example
10 ```
11 if x == true {}
12 if y == false {}
13 ```
14 use `x` directly:
15 ```
16 if x {}
17 if !y {}
18 ```