Auto merge of #79925 - camelid:flatten-docs, r=scottmcm
Improve wording of `flatten()` docs
This commit is contained in:
commit
2225ee1b62
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Reference in a new issue