Skip to content

Commit 46abc12

Browse files
committed
DOC: Add missing arguments to hypothetical code for step_by()
1 parent 3982eb3 commit 46abc12

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

library/core/src/iter/traits/iterator.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,21 +333,22 @@ pub trait Iterator {
333333
/// regardless of the step given.
334334
///
335335
/// Note 2: The time at which ignored elements are pulled is not fixed.
336-
/// `StepBy` behaves like the sequence `next(), nth(step-1), nth(step-1), …`,
337-
/// but is also free to behave like the sequence
338-
/// `advance_n_and_return_first(step), advance_n_and_return_first(step), …`
336+
/// `StepBy` behaves like the sequence `self.next()`, `self.nth(step-1)`,
337+
/// `self.nth(step-1)`, …, but is also free to behave like the sequence
338+
/// `advance_n_and_return_first(&mut self, step)`,
339+
/// `advance_n_and_return_first(&mut self, step)`, …
339340
/// Which way is used may change for some iterators for performance reasons.
340341
/// The second way will advance the iterator earlier and may consume more items.
341342
///
342343
/// `advance_n_and_return_first` is the equivalent of:
343344
/// ```
344-
/// fn advance_n_and_return_first<I>(iter: &mut I, total_step: usize) -> Option<I::Item>
345+
/// fn advance_n_and_return_first<I>(iter: &mut I, n: usize) -> Option<I::Item>
345346
/// where
346347
/// I: Iterator,
347348
/// {
348349
/// let next = iter.next();
349-
/// if total_step > 1 {
350-
/// iter.nth(total_step-2);
350+
/// if n > 1 {
351+
/// iter.nth(n - 2);
351352
/// }
352353
/// next
353354
/// }

0 commit comments

Comments
 (0)