diff options
Diffstat (limited to 'src/tools/clippy/src/docs/copy_iterator.txt')
-rw-r--r-- | src/tools/clippy/src/docs/copy_iterator.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/copy_iterator.txt b/src/tools/clippy/src/docs/copy_iterator.txt new file mode 100644 index 000000000..5f9a2a015 --- /dev/null +++ b/src/tools/clippy/src/docs/copy_iterator.txt @@ -0,0 +1,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(); +```
\ No newline at end of file |