Skip to content

Commit 6f595e8

Browse files
authored
Rollup merge of #70760 - PonasKovas:docs, r=Dylan-DPC
docs: make the description of Result::map_or more clear The documentation of [`Result::map_or`](https://doc.rust-lang.org/std/result/enum.Result.html#method.map_or) is very unclear and confusing, probably because it was copied straight from [`Option::map_or`](https://doc.rust-lang.org/std/option/enum.Option.html#method.map_or) and someone forgot to adapt it for Result.
2 parents 7e4ed72 + b4f416d commit 6f595e8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libcore/result.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,16 @@ impl<T, E> Result<T, E> {
521521
}
522522
}
523523

524-
/// Applies a function to the contained value (if any),
525-
/// or returns the provided default (if not).
524+
/// Applies a function to the contained value (if [`Ok`]),
525+
/// or returns the provided default (if [`Err`]).
526526
///
527527
/// Arguments passed to `map_or` are eagerly evaluated; if you are passing
528528
/// the result of a function call, it is recommended to use [`map_or_else`],
529529
/// which is lazily evaluated.
530530
///
531531
/// [`map_or_else`]: #method.map_or_else
532+
/// [`Ok`]: enum.Result.html#variant.Ok
533+
/// [`Err`]: enum.Result.html#variant.Err
532534
///
533535
/// # Examples
534536
///

0 commit comments

Comments
 (0)