diff options
| author | bors <bors@rust-lang.org> | 2015-06-02 08:28:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-02 08:28:20 +0000 |
| commit | 48e9ef640480a5371759d011da7acbe2fa182511 (patch) | |
| tree | 8655cf3be1ed8201ea85a47b0069cb3cb07f6474 /src/libcore | |
| parent | f14190199cdbcd508e0ac28e8c62c61dea404230 (diff) | |
| parent | 6e97b16d0277d86fb06a158683ef3c15ece14a62 (diff) | |
| download | rust-48e9ef640480a5371759d011da7acbe2fa182511.tar.gz rust-48e9ef640480a5371759d011da7acbe2fa182511.zip | |
Auto merge of #25958 - Manishearth:rollup, r=Manishearth
- Successful merges: #25751, #25821, #25920, #25932, #25933, #25936, #25941, #25949, #25951 - Failed merges:
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/option.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs index f7e8480e250..8d2d7252512 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -409,9 +409,11 @@ impl<T> Option<T> { /// Convert an `Option<String>` into an `Option<usize>`, consuming the original: /// /// ``` - /// let num_as_str: Option<String> = Some("10".to_string()); - /// // `Option::map` takes self *by value*, consuming `num_as_str` - /// let num_as_int: Option<usize> = num_as_str.map(|n| n.len()); + /// let maybe_some_string = Some(String::from("Hello, World!")); + /// // `Option::map` takes self *by value*, consuming `maybe_some_string` + /// let maybe_some_len = maybe_some_string.map(|s| s.len()); + /// + /// assert_eq!(maybe_some_len, Some(13)); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] |
