Rollup merge of #68886 - tom-a-wagner:master, r=Mark-Simulacrum
Mark fn map_or() as eagerly evaluated. In the docs for option.rs and result.rs, it is noted for all *_or() functions that they are eagerly evaluated, except for the map_or() function. This commit adds this missing documentation to the two files. Closes #68866
This commit is contained in:
commit
cc3a0e458c
2 changed files with 12 additions and 0 deletions
|
@ -455,6 +455,12 @@ impl<T> Option<T> {
|
|||
/// Applies a function to the contained value (if any),
|
||||
/// or returns the provided default (if not).
|
||||
///
|
||||
/// 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
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
|
|
@ -524,6 +524,12 @@ impl<T, E> Result<T, E> {
|
|||
/// Applies a function to the contained value (if any),
|
||||
/// or returns the provided default (if not).
|
||||
///
|
||||
/// 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
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
|
Loading…
Add table
Reference in a new issue