Skip to content

Commit

Permalink
Rollup merge of rust-lang#52218 - rivertam:patch-1, r=withoutboats
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kennytm committed Jul 18, 2018
2 parents 2712fbe + ede1a5d commit 21f7d2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,12 +833,14 @@ impl<T> Option<T> {
///
/// ```
/// let mut x = Some(2);
/// x.take();
/// let y = x.take();
/// assert_eq!(x, None);
/// assert_eq!(y, Some(2));
///
/// let mut x: Option<u32> = None;
/// x.take();
/// let y = x.take();
/// assert_eq!(x, None);
/// assert_eq!(y, None);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit 21f7d2b

Please sign in to comment.