about summary refs log tree commit diff
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2025-06-22 20:43:31 +0800
committeryukang <moorekang@gmail.com>2025-06-22 20:43:31 +0800
commit06ae1bee205c9f85cc89047568737a87c791a032 (patch)
tree762756884a5fc64bbd61aefed0b1786bc8ec6fc9
parent9972ebfcc2b1ab322dc6611c1c997344078e05cd (diff)
downloadrust-06ae1bee205c9f85cc89047568737a87c791a032.tar.gz
rust-06ae1bee205c9f85cc89047568737a87c791a032.zip
Make doc for transpose api better
-rw-r--r--library/core/src/option.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index f2a1e901188..2132376b3c5 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -2037,9 +2037,9 @@ impl<T> Option<&mut T> {
 impl<T, E> Option<Result<T, E>> {
     /// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.
     ///
-    /// [`None`] will be mapped to <code>[Ok]\([None])</code>.
-    /// <code>[Some]\([Ok]\(\_))</code> and <code>[Some]\([Err]\(\_))</code> will be mapped to
-    /// <code>[Ok]\([Some]\(\_))</code> and <code>[Err]\(\_)</code>.
+    /// <code>[Some]\([Ok]\(\_))</code> is mapped to <code>[Ok]\([Some]\(\_))</code>,
+    /// <code>[Some]\([Err]\(\_))</code> is mapped to <code>[Err]\(\_)</code>,
+    /// and [`None`] will be mapped to <code>[Ok]\([None])</code>.
     ///
     /// # Examples
     ///
@@ -2047,9 +2047,9 @@ impl<T, E> Option<Result<T, E>> {
     /// #[derive(Debug, Eq, PartialEq)]
     /// struct SomeErr;
     ///
-    /// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));
-    /// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));
-    /// assert_eq!(x, y.transpose());
+    /// let x: Option<Result<i32, SomeErr>> = Some(Ok(5));
+    /// let y: Result<Option<i32>, SomeErr> = Ok(Some(5));
+    /// assert_eq!(x.transpose(), y);
     /// ```
     #[inline]
     #[stable(feature = "transpose_result", since = "1.33.0")]