diff options
| author | Tom A. Wagner <tom.a.wagner@protonmail.com> | 2020-02-06 12:09:16 +0100 |
|---|---|---|
| committer | Tom A. Wagner <tom.a.wagner@protonmail.com> | 2020-02-06 19:56:25 +0100 |
| commit | d646463a452d77dd7d5e1f8d0830d95bf867863f (patch) | |
| tree | b1158293d36c6a742b487e3aad37fe6771c74503 /src/libcore/result.rs | |
| parent | 1f8df2508f2772d83011f0f651de86181123e519 (diff) | |
| download | rust-d646463a452d77dd7d5e1f8d0830d95bf867863f.tar.gz rust-d646463a452d77dd7d5e1f8d0830d95bf867863f.zip | |
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.
Diffstat (limited to 'src/libcore/result.rs')
| -rw-r--r-- | src/libcore/result.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs index bc70dbd62eb..809d4bace8e 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -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 /// /// ``` |
