about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-13 09:13:00 +0000
committerbors <bors@rust-lang.org>2017-11-13 09:13:00 +0000
commite312c8a8c3ecd7fead1e8a6cc591360dc73c9e79 (patch)
treef89bad69d8c6b8ca6bbddb12c16ab8d9adf9e2b7 /src/libcore
parentc8c1424bf44d2dfa5b18dd2a85ee5106919c709d (diff)
parent48d2627c38e014f5372d1a642bc21e5506fe83f3 (diff)
downloadrust-e312c8a8c3ecd7fead1e8a6cc591360dc73c9e79.tar.gz
rust-e312c8a8c3ecd7fead1e8a6cc591360dc73c9e79.zip
Auto merge of #45956 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

- Successful merges: #45828, #45892, #45893, #45914, #45917, #45927, #45933, #45952, #45954
- Failed merges:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/option.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 63c846b25ec..12e6e843056 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -634,16 +634,12 @@ impl<T> Option<T> {
     #[inline]
     #[unstable(feature = "option_filter", issue = "45860")]
     pub fn filter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Self {
-        match self {
-            Some(x) => {
-                if predicate(&x) {
-                    Some(x)
-                } else {
-                    None
-                }
+        if let Some(x) = self {
+            if predicate(&x) {
+                return Some(x)
             }
-            None => None,
         }
+        None
     }
 
     /// Returns the option if it contains a value, otherwise returns `optb`.