From: Daniel Micay Date: Mon, 5 Aug 2013 23:23:29 +0000 (-0400) Subject: iterator: simplify the `take` implementation X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=b3a317c368d424929cdd2e6c3be661d7d8553cc0;p=rust.git iterator: simplify the `take` implementation --- diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs index 56a0dca5667..4803e2e004e 100644 --- a/src/libstd/iterator.rs +++ b/src/libstd/iterator.rs @@ -1316,10 +1316,9 @@ pub struct Take { impl> Iterator for Take { #[inline] fn next(&mut self) -> Option { - let next = self.iter.next(); if self.n != 0 { self.n -= 1; - next + self.iter.next() } else { None }