diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2018-09-01 17:41:45 -0700 |
|---|---|---|
| committer | Josh Triplett <josh@joshtriplett.org> | 2018-09-01 17:41:45 -0700 |
| commit | 0e65aeb95d230ef5b49b42eebdc3b294bc71fd7a (patch) | |
| tree | ac31ca908efd6b3302d95cfaa7f0986fcfa6ff70 | |
| parent | 87658bb667be731395b45b89ffad2ceba17d88c4 (diff) | |
| download | rust-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.rs | 13 |
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 |
