summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/copy_iterator.txt
blob: 5f9a2a015b86c7bd9bd2c3956bfeff4fe6702e31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
### What it does
Checks for types that implement `Copy` as well as
`Iterator`.

### Why is this bad?
Implicit copies can be confusing when working with
iterator combinators.

### Example
```
#[derive(Copy, Clone)]
struct Countdown(u8);

impl Iterator for Countdown {
    // ...
}

let a: Vec<_> = my_iterator.take(1).collect();
let b: Vec<_> = my_iterator.collect();
```