diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-08-05 19:23:29 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-08-06 18:09:20 -0400 |
| commit | b3a317c368d424929cdd2e6c3be661d7d8553cc0 (patch) | |
| tree | b824560af05ba713b08746352aa662261bab2a48 | |
| parent | 6972eb4cd7702a343a7e79c4a57522d0de763327 (diff) | |
| download | rust-b3a317c368d424929cdd2e6c3be661d7d8553cc0.tar.gz rust-b3a317c368d424929cdd2e6c3be661d7d8553cc0.zip | |
iterator: simplify the `take` implementation
| -rw-r--r-- | src/libstd/iterator.rs | 3 |
1 files changed, 1 insertions, 2 deletions
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<T> { impl<A, T: Iterator<A>> Iterator<A> for Take<T> { #[inline] fn next(&mut self) -> Option<A> { - let next = self.iter.next(); if self.n != 0 { self.n -= 1; - next + self.iter.next() } else { None } |
