about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2018-09-01 17:41:45 -0700
committerJosh Triplett <josh@joshtriplett.org>2018-09-01 17:41:45 -0700
commit0e65aeb95d230ef5b49b42eebdc3b294bc71fd7a (patch)
treeac31ca908efd6b3302d95cfaa7f0986fcfa6ff70
parent87658bb667be731395b45b89ffad2ceba17d88c4 (diff)
downloadrust-0e65aeb95d230ef5b49b42eebdc3b294bc71fd7a.tar.gz
rust-0e65aeb95d230ef5b49b42eebdc3b294bc71fd7a.zip
tidy: features.rs: collect_lib_features: Simplify
Use `if let` to simplify a match, and use `contains_key` instead of
`get`.
-rw-r--r--src/tools/tidy/src/features.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index 05eeae7d6b0..91e6423a6b0 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -259,14 +259,11 @@ pub fn collect_lib_features(base_src_path: &Path) -> Features {
 
     map_lib_features(base_src_path,
                      &mut |res, _, _| {
-        match res {
-            Ok((name, feature)) => {
-                if lib_features.get(name).is_some() {
-                    return;
-                }
-                lib_features.insert(name.to_owned(), feature);
-            },
-            Err(_) => (),
+        if let Ok((name, feature)) = res {
+            if lib_features.contains_key(name) {
+                return;
+            }
+            lib_features.insert(name.to_owned(), feature);
         }
     });
    lib_features