]> git.lizzy.rs Git - rust.git/commitdiff
Doc: String isn't a collection
authorKornel Lesiński <kornel@geekhood.net>
Sat, 15 Aug 2020 11:34:15 +0000 (12:34 +0100)
committerKornel Lesiński <kornel@geekhood.net>
Sat, 15 Aug 2020 16:55:10 +0000 (17:55 +0100)
library/core/src/iter/traits/iterator.rs

index 3ea3eeed6b0434f3f4f5fc7b3b5569051a255249..f89b616c4e23bd9b9b0a8125038095d60e96e5b9 100644 (file)
@@ -1543,11 +1543,10 @@ fn by_ref(&mut self) -> &mut Self
     /// collection into another. You take a collection, call [`iter`] on it,
     /// do a bunch of transformations, and then `collect()` at the end.
     ///
-    /// One of the keys to `collect()`'s power is that many things you might
-    /// not think of as 'collections' actually are. For example, a [`String`]
-    /// is a collection of [`char`]s. And a collection of
-    /// [`Result<T, E>`][`Result`] can be thought of as single
-    /// [`Result`]`<Collection<T>, E>`. See the examples below for more.
+    /// `collect()` can also create instances of types that are not typical
+    /// collections. For example, a [`String`] can be built from [`char`]s,
+    /// and an iterator of [`Result<T, E>`][`Result`] items can be collected
+    /// into `Result<Collection<T>, E>`. See the examples below for more.
     ///
     /// Because `collect()` is so general, it can cause problems with type
     /// inference. As such, `collect()` is one of the few times you'll see