Skip to content

Commit fe6ff67

Browse files
committed
Use advance_by instead of nth in Skip::next
Combined with the `iter::Cloned::advance_by` implementation this leads to fewer clone operations
1 parent 67cdc89 commit fe6ff67

File tree

1 file changed

+1
-1
lines changed
  • library/core/src/iter/adapters

1 file changed

+1
-1
lines changed

library/core/src/iter/adapters/skip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where
3333
#[inline]
3434
fn next(&mut self) -> Option<I::Item> {
3535
if unlikely(self.n > 0) {
36-
self.iter.nth(crate::mem::take(&mut self.n) - 1);
36+
let _ = self.iter.advance_by(crate::mem::take(&mut self.n));
3737
}
3838
self.iter.next()
3939
}

0 commit comments

Comments
 (0)