summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/cloned_instead_of_copied.txt
blob: 2f2014d5fd2990e7d559cf95e675d8d4fa1a9a17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
### What it does
Checks for usages of `cloned()` on an `Iterator` or `Option` where
`copied()` could be used instead.

### Why is this bad?
`copied()` is better because it guarantees that the type being cloned
implements `Copy`.

### Example
```
[1, 2, 3].iter().cloned();
```
Use instead:
```
[1, 2, 3].iter().copied();
```