Skip to content

Commit

Permalink
docs: make the description of Result::map_or more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
PonasKovas committed Apr 4, 2020
1 parent 1b521f5 commit b4f416d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libcore/result.rs
Expand Up @@ -521,14 +521,16 @@ impl<T, E> Result<T, E> {
}
}

/// Applies a function to the contained value (if any),
/// or returns the provided default (if not).
/// Applies a function to the contained value (if [`Ok`]),
/// or returns the provided default (if [`Err`]).
///
/// Arguments passed to `map_or` are eagerly evaluated; if you are passing
/// the result of a function call, it is recommended to use [`map_or_else`],
/// which is lazily evaluated.
///
/// [`map_or_else`]: #method.map_or_else
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
///
/// # Examples
///
Expand Down

0 comments on commit b4f416d

Please sign in to comment.