Skip to content

Commit 21f7d2b

Browse files
authored
Rollup merge of rust-lang#52218 - rivertam:patch-1, r=withoutboats
Amend option.take examples It wasn't abundantly clear to me what `.take` returned. Perhaps this is a slightly frivolous change, but I think it's an improvement. =) Apologies if I'm not following proper procedures.
2 parents 2712fbe + ede1a5d commit 21f7d2b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libcore/option.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -833,12 +833,14 @@ impl<T> Option<T> {
833833
///
834834
/// ```
835835
/// let mut x = Some(2);
836-
/// x.take();
836+
/// let y = x.take();
837837
/// assert_eq!(x, None);
838+
/// assert_eq!(y, Some(2));
838839
///
839840
/// let mut x: Option<u32> = None;
840-
/// x.take();
841+
/// let y = x.take();
841842
/// assert_eq!(x, None);
843+
/// assert_eq!(y, None);
842844
/// ```
843845
#[inline]
844846
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)