Skip to content

Commit 0671b2f

Browse files
authored
Rollup merge of #142871 - chenyukang:yukang-fix-doc-for-transpose, r=ibraheemdev
Trivial improve doc for transpose When I saw old doc, I felt a little confused. Seems it would be clearer this way.
2 parents 633cc0c + 06ae1be commit 0671b2f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/core/src/option.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,19 +2095,19 @@ impl<T> Option<&mut T> {
20952095
impl<T, E> Option<Result<T, E>> {
20962096
/// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.
20972097
///
2098-
/// [`None`] will be mapped to <code>[Ok]\([None])</code>.
2099-
/// <code>[Some]\([Ok]\(\_))</code> and <code>[Some]\([Err]\(\_))</code> will be mapped to
2100-
/// <code>[Ok]\([Some]\(\_))</code> and <code>[Err]\(\_)</code>.
2098+
/// <code>[Some]\([Ok]\(\_))</code> is mapped to <code>[Ok]\([Some]\(\_))</code>,
2099+
/// <code>[Some]\([Err]\(\_))</code> is mapped to <code>[Err]\(\_)</code>,
2100+
/// and [`None`] will be mapped to <code>[Ok]\([None])</code>.
21012101
///
21022102
/// # Examples
21032103
///
21042104
/// ```
21052105
/// #[derive(Debug, Eq, PartialEq)]
21062106
/// struct SomeErr;
21072107
///
2108-
/// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));
2109-
/// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));
2110-
/// assert_eq!(x, y.transpose());
2108+
/// let x: Option<Result<i32, SomeErr>> = Some(Ok(5));
2109+
/// let y: Result<Option<i32>, SomeErr> = Ok(Some(5));
2110+
/// assert_eq!(x.transpose(), y);
21112111
/// ```
21122112
#[inline]
21132113
#[stable(feature = "transpose_result", since = "1.33.0")]

0 commit comments

Comments
 (0)