RS.CLIPPY.COPY_ITERATOR

Implementing `Iterator` on a `Copy` type

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: copy_iterator. Copyright ©2025 The Rust Team. All rights reserved.

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();