diff --git a/src/libcore/result.rs b/src/libcore/result.rs index ed40a5f31d9bd..fd9cb12996b40 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -529,7 +529,6 @@ impl Result { /// Basic usage: /// /// ``` - /// #![feature(result_map_or_else)] /// let k = 21; /// /// let x : Result<_, &str> = Ok("foo"); @@ -539,9 +538,12 @@ impl Result { /// assert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42); /// ``` #[inline] - #[unstable(feature = "result_map_or_else", issue = "53268")] - pub fn map_or_else U, F: FnOnce(E) -> U>(self, fallback: F, map: M) -> U { - self.map(map).unwrap_or_else(fallback) + #[stable(feature = "result_map_or_else", since = "1.41.0")] + pub fn map_or_else U, F: FnOnce(T) -> U>(self, default: D, f: F) -> U { + match self { + Ok(t) => f(t), + Err(e) => default(e), + } } /// Maps a `Result` to `Result` by applying a function to a