X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=library%2Fcore%2Fsrc%2Foption.rs;h=7cc00e3f8d1b7205b3e470b8302d52bcc8ddaba4;hb=b8f9cb345ab1401f2fbd14cc23f64dda9dd2314e;hp=39462dca4ff3ea46b1f7c8ecf7216eb9b34b624a;hpb=ec56537c4325ce5b798fc3628cbdd48ba4949ae5;p=rust.git diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 39462dca4ff..7cc00e3f8d1 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -652,13 +652,14 @@ pub const fn is_none(&self) -> bool { /// /// # Examples /// - /// Converts an Option<[String]> into an Option<[usize]>, preserving - /// the original. The [`map`] method takes the `self` argument by value, consuming the original, - /// so this technique uses `as_ref` to first take an `Option` to a reference - /// to the value inside the original. + /// Calculates the length of an Option<[String]> as an Option<[usize]> + /// without moving the [`String`]. The [`map`] method takes the `self` argument by value, + /// consuming the original, so this technique uses `as_ref` to first take an `Option` to a + /// reference to the value inside the original. /// /// [`map`]: Option::map /// [String]: ../../std/string/struct.String.html "String" + /// [`String`]: ../../std/string/struct.String.html "String" /// /// ``` /// let text: Option = Some("Hello, world!".to_string()); @@ -946,8 +947,8 @@ pub const fn unwrap_or_default(self) -> T /// /// # Examples /// - /// Converts an Option<[String]> into an Option<[usize]>, consuming - /// the original: + /// Calculates the length of an Option<[String]> as an + /// Option<[usize]>, consuming the original: /// /// [String]: ../../std/string/struct.String.html "String" /// ```