Skip to content

Commit 437d70a

Browse files
committed
Auto merge of #28738 - apasel422:peekable, r=alexcrichton
2 parents 3e6d724 + 532ee3c commit 437d70a

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/libcore/iter.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,22 +1862,14 @@ impl<I> DoubleEndedIterator for Enumerate<I> where
18621862
}
18631863

18641864
/// An iterator with a `peek()` that returns an optional reference to the next element.
1865+
#[derive(Clone)]
18651866
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
18661867
#[stable(feature = "rust1", since = "1.0.0")]
18671868
pub struct Peekable<I: Iterator> {
18681869
iter: I,
18691870
peeked: Option<I::Item>,
18701871
}
18711872

1872-
impl<I: Iterator + Clone> Clone for Peekable<I> where I::Item: Clone {
1873-
fn clone(&self) -> Peekable<I> {
1874-
Peekable {
1875-
iter: self.iter.clone(),
1876-
peeked: self.peeked.clone(),
1877-
}
1878-
}
1879-
}
1880-
18811873
#[stable(feature = "rust1", since = "1.0.0")]
18821874
impl<I: Iterator> Iterator for Peekable<I> {
18831875
type Item = I::Item;

0 commit comments

Comments
 (0)