about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-16 05:23:30 +0100
committerGitHub <noreply@github.com>2019-12-16 05:23:30 +0100
commit84ef88975bff75fc82e6950c688b8d57a6c02bdb (patch)
tree47f976a1788ab4482ec256e19a3f3dc84e2cd346 /src
parentc34ea91a9dbea9b23653dc39cb09e5d412353359 (diff)
parent93438fd839fd48c3714afd9ff5056720bc40ba62 (diff)
downloadrust-84ef88975bff75fc82e6950c688b8d57a6c02bdb.tar.gz
rust-84ef88975bff75fc82e6950c688b8d57a6c02bdb.zip
Rollup merge of #66570 - lzutao:stabilize-result-map_or, r=Dylan-DPC
stabilize Result::map_or

r? @SimonSapin
Closes #66293
Diffstat (limited to 'src')
-rw-r--r--src/libcore/result.rs3
-rw-r--r--src/librustc_mir/transform/const_prop.rs2
-rw-r--r--src/librustc_typeck/check/method/probe.rs2
-rw-r--r--src/libterm/terminfo/mod.rs2
4 files changed, 4 insertions, 5 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 1a0845f3a6d..fb4dc62d8c1 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -520,7 +520,6 @@ impl<T, E> Result<T, E> {
     /// # Examples
     ///
     /// ```
-    /// #![feature(result_map_or)]
     /// let x: Result<_, &str> = Ok("foo");
     /// assert_eq!(x.map_or(42, |v| v.len()), 3);
     ///
@@ -528,7 +527,7 @@ impl<T, E> Result<T, E> {
     /// assert_eq!(x.map_or(42, |v| v.len()), 42);
     /// ```
     #[inline]
-    #[unstable(feature = "result_map_or", issue = "66293")]
+    #[stable(feature = "result_map_or", since = "1.41.0")]
     pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
         match self {
             Ok(t) => f(t),
diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs
index aff91ac5af9..c4d89b1494d 100644
--- a/src/librustc_mir/transform/const_prop.rs
+++ b/src/librustc_mir/transform/const_prop.rs
@@ -517,7 +517,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
                     let left_bits = place_layout.size.bits();
                     let right_size = r.layout.size;
                     let r_bits = r.to_scalar().and_then(|r| r.to_bits(right_size));
-                    if r_bits.ok().map_or(false, |b| b >= left_bits as u128) {
+                    if r_bits.map_or(false, |b| b >= left_bits as u128) {
                         let lint_root = match &self.source_scopes[source_info.scope].local_data {
                             ClearCrossCrate::Set(data) => data.lint_root,
                             ClearCrossCrate::Clear => return None,
diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 992308183b4..880ead0e301 100644
--- a/src/librustc_typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -1456,7 +1456,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
                     pcx.method_name = Some(method_name);
                     pcx.assemble_inherent_candidates();
                     pcx.assemble_extension_candidates_for_traits_in_scope(hir::DUMMY_HIR_ID)
-                        .ok().map_or(None, |_| {
+                        .map_or(None, |_| {
                             pcx.pick_core()
                                 .and_then(|pick| pick.ok())
                                 .and_then(|pick| Some(pick.item))
diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs
index be90195065e..09bea80c95a 100644
--- a/src/libterm/terminfo/mod.rs
+++ b/src/libterm/terminfo/mod.rs
@@ -74,7 +74,7 @@ impl TermInfo {
             Err(..) => return Err(Error::TermUnset),
         };
 
-        if term.is_err() && env::var("MSYSCON").ok().map_or(false, |s| "mintty.exe" == s) {
+        if term.is_err() && env::var("MSYSCON").map_or(false, |s| "mintty.exe" == s) {
             // msys terminal
             Ok(msys_terminfo())
         } else {