about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-11 15:18:47 +0000
committerbors <bors@rust-lang.org>2020-12-11 15:18:47 +0000
commit2225ee1b62ff089917434aefd9b2bf509cfa087f (patch)
tree27c1243902b451fa8d7d22a964148f867aecff8f
parenta9f7d19a916419dbb652d3f272bdc0b5578b6d61 (diff)
parent97cd55e962928f08a4958ba7edc199d0b2e87a43 (diff)
downloadrust-2225ee1b62ff089917434aefd9b2bf509cfa087f.tar.gz
rust-2225ee1b62ff089917434aefd9b2bf509cfa087f.zip
Auto merge of #79925 - camelid:flatten-docs, r=scottmcm
Improve wording of `flatten()` docs
-rw-r--r--library/core/src/iter/traits/iterator.rs4
-rw-r--r--library/core/src/option.rs6
-rw-r--r--library/core/src/result.rs4
3 files changed, 10 insertions, 4 deletions
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index 19484bfd041..7ba16f89284 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -1332,7 +1332,7 @@ pub trait Iterator {
     /// assert_eq!(merged, "alphabetagamma");
     /// ```
     ///
-    /// Flattening once only removes one level of nesting:
+    /// Flattening only removes one level of nesting at a time:
     ///
     /// ```
     /// let d3 = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];
@@ -1346,7 +1346,7 @@ pub trait Iterator {
     ///
     /// Here we see that `flatten()` does not perform a "deep" flatten.
     /// Instead, only one level of nesting is removed. That is, if you
-    /// `flatten()` a three-dimensional array the result will be
+    /// `flatten()` a three-dimensional array, the result will be
     /// two-dimensional and not one-dimensional. To get a one-dimensional
     /// structure, you have to `flatten()` again.
     ///
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 3daf26208b9..1afa30f5843 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -1695,7 +1695,9 @@ impl<T> Option<Option<T>> {
     /// Converts from `Option<Option<T>>` to `Option<T>`
     ///
     /// # Examples
+    ///
     /// Basic usage:
+    ///
     /// ```
     /// let x: Option<Option<u32>> = Some(Some(6));
     /// assert_eq!(Some(6), x.flatten());
@@ -1706,7 +1708,9 @@ impl<T> Option<Option<T>> {
     /// let x: Option<Option<u32>> = None;
     /// assert_eq!(None, x.flatten());
     /// ```
-    /// Flattening once only removes one level of nesting:
+    ///
+    /// Flattening only removes one level of nesting at a time:
+    ///
     /// ```
     /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));
     /// assert_eq!(Some(Some(6)), x.flatten());
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index b6d9f13d881..0b4ca2b7214 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -1184,7 +1184,9 @@ impl<T, E> Result<Result<T, E>, E> {
     /// Converts from `Result<Result<T, E>, E>` to `Result<T, E>`
     ///
     /// # Examples
+    ///
     /// Basic usage:
+    ///
     /// ```
     /// #![feature(result_flattening)]
     /// let x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));
@@ -1197,7 +1199,7 @@ impl<T, E> Result<Result<T, E>, E> {
     /// assert_eq!(Err(6), x.flatten());
     /// ```
     ///
-    /// Flattening once only removes one level of nesting:
+    /// Flattening only removes one level of nesting at a time:
     ///
     /// ```
     /// #![feature(result_flattening)]