From 98bf99e2f8cf8b357d63a67ce67d5fc5ceef8b3c Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Fri, 9 Sep 2022 13:36:26 +0200 Subject: Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyup --- src/docs/copy_iterator.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/docs/copy_iterator.txt (limited to 'src/docs/copy_iterator.txt') diff --git a/src/docs/copy_iterator.txt b/src/docs/copy_iterator.txt new file mode 100644 index 00000000000..5f9a2a015b8 --- /dev/null +++ b/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 -- cgit 1.4.1-3-g733a5