reword Option::as_ref and Option::map examples

This commit is contained in:
Zachary Mayhew 2022-11-26 15:41:48 -08:00
parent 80a96467ec
commit 74e7709485
No known key found for this signature in database
GPG Key ID: 8480D2FB40A25871

View File

@ -608,10 +608,10 @@ pub const fn is_none(&self) -> bool {
/// ///
/// # Examples /// # Examples
/// ///
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving /// Calculates the length of an <code>Option<[String]></code> as an <code>Option<[usize]></code>
/// the original. The [`map`] method takes the `self` argument by value, consuming the original, /// without moving the [`String`]. The [`map`] method takes the `self` argument by value,
/// so this technique uses `as_ref` to first take an `Option` to a reference /// consuming the original, so this technique uses `as_ref` to first take an `Option` to a
/// to the value inside the original. /// reference to the value inside the original.
/// ///
/// [`map`]: Option::map /// [`map`]: Option::map
/// [String]: ../../std/string/struct.String.html "String" /// [String]: ../../std/string/struct.String.html "String"
@ -902,8 +902,8 @@ pub const fn unwrap_or_default(self) -> T
/// ///
/// # Examples /// # Examples
/// ///
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming /// Calculates the length of an <code>Option<[String]></code> as an
/// the original: /// <code>Option<[usize]></code>, consuming the original:
/// ///
/// [String]: ../../std/string/struct.String.html "String" /// [String]: ../../std/string/struct.String.html "String"
/// ``` /// ```