Skip to content

Commit b3a317c

Browse files
committed
iterator: simplify the take implementation
1 parent 6972eb4 commit b3a317c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/libstd/iterator.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,10 +1316,9 @@ pub struct Take<T> {
13161316
impl<A, T: Iterator<A>> Iterator<A> for Take<T> {
13171317
#[inline]
13181318
fn next(&mut self) -> Option<A> {
1319-
let next = self.iter.next();
13201319
if self.n != 0 {
13211320
self.n -= 1;
1322-
next
1321+
self.iter.next()
13231322
} else {
13241323
None
13251324
}

0 commit comments

Comments
 (0)