mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Document that Result.unwrap prints the Err's value
It is implied by the Show bound, but that implication can be missed.
This commit is contained in:
parent
da4e4e4e0a
commit
ded48c5847
@ -536,7 +536,10 @@ impl<T, E> Result<T, E> {
|
||||
impl<T, E: Show> Result<T, E> {
|
||||
/// Unwraps a result, yielding the content of an `Ok`.
|
||||
///
|
||||
/// Fails if the value is an `Err`.
|
||||
/// # Failure
|
||||
///
|
||||
/// Fails if the value is an `Err`, with a custom failure message provided
|
||||
/// by the `Err`'s value.
|
||||
#[inline]
|
||||
pub fn unwrap(self) -> T {
|
||||
match self {
|
||||
@ -550,7 +553,10 @@ impl<T, E: Show> Result<T, E> {
|
||||
impl<T: Show, E> Result<T, E> {
|
||||
/// Unwraps a result, yielding the content of an `Err`.
|
||||
///
|
||||
/// Fails if the value is an `Ok`.
|
||||
/// # Failure
|
||||
///
|
||||
/// Fails if the value is an `Ok`, with a custom failure message provided
|
||||
/// by the `Ok`'s value.
|
||||
#[inline]
|
||||
pub fn unwrap_err(self) -> E {
|
||||
match self {
|
||||
|
Loading…
Reference in New Issue
Block a user