summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/iter_count.txt
blob: f3db4a26c2997f42ab673bf3112c6e1a448031f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
### What it does
Checks for the use of `.iter().count()`.

### Why is this bad?
`.len()` is more efficient and more
readable.

### Example
```
let some_vec = vec![0, 1, 2, 3];

some_vec.iter().count();
&some_vec[..].iter().count();
```

Use instead:
```
let some_vec = vec![0, 1, 2, 3];

some_vec.len();
&some_vec[..].len();
```