Skip to content

Commit 7550b61

Browse files
committed
Fix documentation for Iterator::count().
1 parent 2477e24 commit 7550b61

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/iter/traits/iterator.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ pub trait Iterator {
202202
/// Consumes the iterator, counting the number of iterations and returning it.
203203
///
204204
/// This method will evaluate the iterator until its [`next`] returns
205-
/// [`None`]. Once [`None`] is encountered, `count()` returns the number of
206-
/// times it called [`next`].
205+
/// [`None`]. Once [`None`] is encountered, `count()` returns one less than the
206+
/// number of times it called [`next`]. Note that [`next`] has to be called at
207+
/// least once even if the iterator does not have any elements.
207208
///
208209
/// [`next`]: #tymethod.next
209210
/// [`None`]: ../../std/option/enum.Option.html#variant.None

0 commit comments

Comments
 (0)