summaryrefslogtreecommitdiffstats
path: root/library/core/src/result.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/src/result.rs')
-rw-r--r--library/core/src/result.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index 1ee270f4c..6981abc9b 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -749,7 +749,7 @@ impl<T, E> Result<T, E> {
}
/// Returns the provided default (if [`Err`]), or
- /// applies a function to the contained value (if [`Ok`]),
+ /// applies a function to the contained value (if [`Ok`]).
///
/// 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`],
@@ -768,6 +768,7 @@ impl<T, E> Result<T, E> {
/// ```
#[inline]
#[stable(feature = "result_map_or", since = "1.41.0")]
+ #[must_use = "if you don't need the returned value, use `if let` instead"]
pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
match self {
Ok(t) => f(t),