diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 8da28094be3ae..048955d4d8acf 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -409,9 +409,11 @@ impl Option { /// Convert an `Option` into an `Option`, consuming the original: /// /// ``` - /// let num_as_str: Option = Some("10".to_string()); - /// // `Option::map` takes self *by value*, consuming `num_as_str` - /// let num_as_int: Option = 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")]