about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-16 06:26:38 +0000
committerbors <bors@rust-lang.org>2020-08-16 06:26:38 +0000
commit243c725c2401e00c83ac68e80fa18d3b0dd3f551 (patch)
treec23c9d6c9e6d947a5e19e92b4dc31516f7bb3603
parent9d38dc22e5d543b9c350dd48ac014135547e7953 (diff)
parentd5cb5eb08bc75cd9cd297b15cfac8bded9edc053 (diff)
downloadrust-243c725c2401e00c83ac68e80fa18d3b0dd3f551.tar.gz
rust-243c725c2401e00c83ac68e80fa18d3b0dd3f551.zip
Auto merge of #75561 - kornelski:stringcol, r=Dylan-DPC
Doc: String isn't a collection

On forums one user was confused by this text, interpreting it as saying that `String` is a `Vec<char>` literally, rather than figuratively for the purpose of collect. I've reworded that paragraph.
-rw-r--r--library/core/src/iter/traits/iterator.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index 3ea3eeed6b0..f89b616c4e2 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -1543,11 +1543,10 @@ pub trait Iterator {
     /// 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