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
///
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, 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 <code>Option<[String]></code> as an <code>Option<[usize]></code>
/// 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"
@ -902,8 +902,8 @@ pub const fn unwrap_or_default(self) -> T
///
/// # Examples
///
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming
/// the original:
/// Calculates the length of an <code>Option<[String]></code> as an
/// <code>Option<[usize]></code>, consuming the original:
///
/// [String]: ../../std/string/struct.String.html "String"
/// ```