From b0ca03923359afc8df92a802b7cc1476a72fb2d0 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Tue, 3 Nov 2015 08:25:56 -0500 Subject: [PATCH] Mention what iterator terminators do with an empty iterator --- src/libcore/iter.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 262bfd5de99..c7d01b4ec2e 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1565,6 +1565,8 @@ fn fold(self, init: B, mut f: F) -> B where /// as soon as it finds a `false`, given that no matter what else happens, /// the result will also be `false`. /// + /// An empty iterator returns `true`. + /// /// # Examples /// /// Basic usage: @@ -1613,6 +1615,8 @@ fn all(&mut self, mut f: F) -> bool where /// as soon as it finds a `true`, given that no matter what else happens, /// the result will also be `true`. /// + /// An empty iterator returns `false`. + /// /// # Examples /// /// Basic usage: @@ -2071,6 +2075,8 @@ fn cycle(self) -> Cycle where Self: Sized + Clone { /// /// Takes each element, adds them together, and returns the result. /// + /// An empty iterator returns the zero value of the type. + /// /// # Examples /// /// Basic usage: @@ -2094,6 +2100,8 @@ fn sum::Item>(self) -> S where /// Iterates over the entire iterator, multiplying all the elements /// + /// An empty iterator returns the one value of the type. + /// /// # Examples /// /// ``` -- 2.44.0