summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/manual_range_contains.txt
blob: 0ade26951d38523180ef49c247037c993a07653c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
### What it does
Checks for expressions like `x >= 3 && x < 8` that could
be more readably expressed as `(3..8).contains(x)`.

### Why is this bad?
`contains` expresses the intent better and has less
failure modes (such as fencepost errors or using `||` instead of `&&`).

### Example
```
// given
let x = 6;

assert!(x >= 3 && x < 8);
```
Use instead:
```
assert!((3..8).contains(&x));
```