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.
This commit is contained in:
parent
fc491526dd
commit
ede1a5d5ed
1 changed files with 4 additions and 2 deletions
|
|
@ -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")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue