]> git.lizzy.rs Git - rust.git/blob - src/docs/copy_iterator.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / copy_iterator.txt
1 ### What it does
2 Checks for types that implement `Copy` as well as
3 `Iterator`.
4
5 ### Why is this bad?
6 Implicit copies can be confusing when working with
7 iterator combinators.
8
9 ### Example
10 ```
11 #[derive(Copy, Clone)]
12 struct Countdown(u8);
13
14 impl Iterator for Countdown {
15     // ...
16 }
17
18 let a: Vec<_> = my_iterator.take(1).collect();
19 let b: Vec<_> = my_iterator.collect();
20 ```