RS.CLIPPY.CLONED_INSTEAD_OF_COPIED
Used `cloned` where `copied` could be used instead
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: cloned_instead_of_copied. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for usage 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();
Configuration
-
msrv: The minimum rust version that the project supports. Defaults to therust-versionfield inCargo.toml(default:
current version)