Skip to content

Commit 1c2d223

Browse files
Rollup merge of #37314 - tshepang:simple, r=GuillaumeGomez
doc: a more simple description of Iterator::nth
2 parents c3802f6 + 3e26a93 commit 1c2d223

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/libcore/iter/iterator.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,9 @@ pub trait Iterator {
195195
last
196196
}
197197

198-
/// Consumes the `n` first elements of the iterator, then returns the
199-
/// `next()` one.
198+
/// Returns the `n`th element of the iterator.
200199
///
201-
/// This method will evaluate the iterator `n` times, discarding those elements.
202-
/// After it does so, it will call [`next()`] and return its value.
203-
///
204-
/// [`next()`]: #tymethod.next
200+
/// Note that all preceding elements will be consumed (i.e. discarded).
205201
///
206202
/// Like most indexing operations, the count starts from zero, so `nth(0)`
207203
/// returns the first value, `nth(1)` the second, and so on.

0 commit comments

Comments
 (0)