Skip to content

Commit 4dcfc5d

Browse files
committed
Fix docs for flatten_ref on mut inner
1 parent 2a9c4f0 commit 4dcfc5d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

library/core/src/option.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,7 +2638,7 @@ impl<'a, T> Option<&'a Option<T>> {
26382638
}
26392639

26402640
impl<'a, T> Option<&'a mut Option<T>> {
2641-
/// Converts from `Option<&mut Option<T>>` to `Option<&T>`.
2641+
/// Converts from `Option<&mut Option<T>>` to `&Option<T>`.
26422642
///
26432643
/// # Examples
26442644
///
@@ -2647,10 +2647,12 @@ impl<'a, T> Option<&'a mut Option<T>> {
26472647
/// ```
26482648
/// #![feature(option_reference_flattening)]
26492649
///
2650-
/// let x: Option<&mut Option<u32>> = Some(&mut Some(6));
2650+
/// let y = &mut Some(6);
2651+
/// let x: Option<&mut Option<u32>> = Some(y);
26512652
/// assert_eq!(&Some(6), x.flatten_ref());
26522653
///
2653-
/// let x: Option<&mut Option<u32>> = Some(&mut None);
2654+
/// let y: &mut Option<u32> = &mut None;
2655+
/// let x: Option<&mut Option<u32>> = Some(y);
26542656
/// assert_eq!(&None, x.flatten_ref());
26552657
///
26562658
/// let x: Option<&mut Option<u32>> = None;

0 commit comments

Comments
 (0)