From bc3618e5c007e69e6b21b2aa4d2aad110da6655e Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 2 Dec 2016 21:13:57 +0100 Subject: core: Remove Self: Sized from Iterator::nth It is an unnecessary restriction; nth neither needs self to be sized nor needs to be exempted from the trait object. It increases the utility of the nth method, because type specific implementations are available through `&mut I` or through an iterator trait object. It is a backwards compatible change due to the special cases of the `where Self: Sized` bound; it was already optional to include this bound in `Iterator` implementations. --- src/liballoc/boxed.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 28f4dda1408..d10d7a5e58d 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -524,6 +524,9 @@ impl Iterator for Box { fn size_hint(&self) -> (usize, Option) { (**self).size_hint() } + fn nth(&mut self, n: usize) -> Option { + (**self).nth(n) + } } #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for Box { -- cgit 1.4.1-3-g733a5