Skip to content

Commit 17b22f7

Browse files
committed
Specialise count, last, nth for Cloned iterator
1 parent 205c356 commit 17b22f7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libcore/iter.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,18 @@ impl<'a, I, T: 'a> Iterator for Cloned<I>
14211421
fn size_hint(&self) -> (usize, Option<usize>) {
14221422
self.it.size_hint()
14231423
}
1424+
1425+
fn count(self) -> usize {
1426+
self.it.count()
1427+
}
1428+
1429+
fn last(self) -> Option<T> {
1430+
self.it.last().cloned()
1431+
}
1432+
1433+
fn nth(&mut self, n: usize) -> Option<T> {
1434+
self.it.nth(n).cloned()
1435+
}
14241436
}
14251437

14261438
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)