From 7550b618f9489f7e7f7c4659beef6f0070ad8b19 Mon Sep 17 00:00:00 2001 From: Artur Kovacs Date: Mon, 4 Nov 2019 19:37:37 +0100 Subject: [PATCH 1/3] Fix documentation for `Iterator::count()`. --- src/libcore/iter/traits/iterator.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 7ffc8b3729cb4..90535a647ccca 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -202,8 +202,9 @@ pub trait Iterator { /// Consumes the iterator, counting the number of iterations and returning it. /// /// This method will evaluate the iterator until its [`next`] returns - /// [`None`]. Once [`None`] is encountered, `count()` returns the number of - /// times it called [`next`]. + /// [`None`]. Once [`None`] is encountered, `count()` returns one less than the + /// number of times it called [`next`]. Note that [`next`] has to be called at + /// least once even if the iterator does not have any elements. /// /// [`next`]: #tymethod.next /// [`None`]: ../../std/option/enum.Option.html#variant.None From 6ce3e1df478cf4f865f4aa5d7a55bae2d87e5871 Mon Sep 17 00:00:00 2001 From: Artur Kovacs Date: Mon, 4 Nov 2019 20:37:39 +0100 Subject: [PATCH 2/3] Fixed trailing whitespace. --- src/libcore/iter/traits/iterator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 90535a647ccca..e9bbe330208c1 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -202,7 +202,7 @@ pub trait Iterator { /// Consumes the iterator, counting the number of iterations and returning it. /// /// This method will evaluate the iterator until its [`next`] returns - /// [`None`]. Once [`None`] is encountered, `count()` returns one less than the + /// [`None`]. Once [`None`] is encountered, `count()` returns one less than the /// number of times it called [`next`]. Note that [`next`] has to be called at /// least once even if the iterator does not have any elements. /// From 23be25c82f517cb9ee5c4df57378e024d3c5b3eb Mon Sep 17 00:00:00 2001 From: Artur Kovacs Date: Mon, 4 Nov 2019 22:11:52 +0100 Subject: [PATCH 3/3] Improve wording in the documentation of `Iterator::count()`. --- src/libcore/iter/traits/iterator.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index e9bbe330208c1..b7a35568e3fc5 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -201,13 +201,13 @@ pub trait Iterator { /// Consumes the iterator, counting the number of iterations and returning it. /// - /// This method will evaluate the iterator until its [`next`] returns - /// [`None`]. Once [`None`] is encountered, `count()` returns one less than the - /// number of times it called [`next`]. Note that [`next`] has to be called at - /// least once even if the iterator does not have any elements. + /// This method will call [`next`] repeatedly until [`None`] is encountered, + /// returning the number of times it saw [`Some`]. Note that [`next`] has to be + /// called at least once even if the iterator does not have any elements. /// /// [`next`]: #tymethod.next /// [`None`]: ../../std/option/enum.Option.html#variant.None + /// [`Some`]: ../../std/option/enum.Option.html#variant.Some /// /// # Overflow Behavior ///