Skip to content

Commit

Permalink
Rollup merge of rust-lang#59221 - czipperz:as_ref_documentation, r=Ce…
Browse files Browse the repository at this point in the history
…ntril

Option and Result: Add references to documentation of as_ref and as_mut

This makes the documentation more consistent with that of `Pin::as_ref` which converts "from `&Pin<Pointer<T>>` to `Pin<&t>`".

This generally makes it clearer that the reference is going inside the option.
  • Loading branch information
kennytm committed Mar 16, 2019
2 parents f336043 + 9a61580 commit 7f81a29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl<T> Option<T> {
// Adapter for working with references
/////////////////////////////////////////////////////////////////////////

/// Converts from `Option<T>` to `Option<&T>`.
/// Converts from `&Option<T>` to `Option<&T>`.
///
/// # Examples
///
Expand Down Expand Up @@ -239,7 +239,7 @@ impl<T> Option<T> {
}
}

/// Converts from `Option<T>` to `Option<&mut T>`.
/// Converts from `&mut Option<T>` to `Option<&mut T>`.
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ impl<T, E> Result<T, E> {
// Adapter for working with references
/////////////////////////////////////////////////////////////////////////

/// Converts from `Result<T, E>` to `Result<&T, &E>`.
/// Converts from `&Result<T, E>` to `Result<&T, &E>`.
///
/// Produces a new `Result`, containing a reference
/// into the original, leaving the original in place.
Expand All @@ -394,7 +394,7 @@ impl<T, E> Result<T, E> {
}
}

/// Converts from `Result<T, E>` to `Result<&mut T, &mut E>`.
/// Converts from `&mut Result<T, E>` to `Result<&mut T, &mut E>`.
///
/// # Examples
///
Expand Down

0 comments on commit 7f81a29

Please sign in to comment.