diff options
| author | Ben Berman <ben.m.berman@gmail.com> | 2018-07-10 13:26:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-10 13:26:44 -0400 |
| commit | ede1a5d5edcebe28f98057d915ae4602378354dc (patch) | |
| tree | afd9515ea517161697efeeb860a7fe217e55e69c | |
| parent | fc491526dd0b5d8c8c25faa6400599e08ede1907 (diff) | |
| download | rust-ede1a5d5edcebe28f98057d915ae4602378354dc.tar.gz rust-ede1a5d5edcebe28f98057d915ae4602378354dc.zip | |
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.
| -rw-r--r-- | src/libcore/option.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 20bc173f7e1..c219a9fb521 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -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")] |
