From 17b22f7d63d85cb737e2d4e72259788d74a3ac83 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Mon, 31 Aug 2015 15:09:43 +0300 Subject: [PATCH] Specialise count, last, nth for Cloned iterator --- src/libcore/iter.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 97dcb2475a3cf..44f6e1d10ed5b 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1421,6 +1421,18 @@ impl<'a, I, T: 'a> Iterator for Cloned fn size_hint(&self) -> (usize, Option) { self.it.size_hint() } + + fn count(self) -> usize { + self.it.count() + } + + fn last(self) -> Option { + self.it.last().cloned() + } + + fn nth(&mut self, n: usize) -> Option { + self.it.nth(n).cloned() + } } #[stable(feature = "rust1", since = "1.0.0")]