blob: 2c52b99f7a5c5aceb533a8c43ba3594054767a20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
### What it does
Checks for use of `.drain(..)` on `Vec` and `VecDeque` for iteration.
### Why is this bad?
`.into_iter()` is simpler with better performance.
### Example
```
let mut foo = vec![0, 1, 2, 3];
let bar: HashSet<usize> = foo.drain(..).collect();
```
Use instead:
```
let foo = vec![0, 1, 2, 3];
let bar: HashSet<usize> = foo.into_iter().collect();
```
|