We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Iterator::cloned
1 parent ddabe07 commit 49632b9Copy full SHA for 49632b9
library/core/src/iter/traits/iterator.rs
@@ -2998,6 +2998,11 @@ pub trait Iterator {
2998
/// This is useful when you have an iterator over `&T`, but you need an
2999
/// iterator over `T`.
3000
///
3001
+ /// Note that unlike copying, cloning is regarded as a side effect, because
3002
+ /// `Clone` implementations may contain observable behavior. For example,
3003
+ /// `iter.cloned().last()` will clone all elements even if only the last
3004
+ /// one is actually returned.
3005
+ ///
3006
/// [`clone`]: Clone::clone
3007
3008
/// # Examples
0 commit comments