1
Fork 0

tidy: features.rs: collect_lib_features: Simplify

Use `if let` to simplify a match, and use `contains_key` instead of
`get`.
This commit is contained in:
Josh Triplett 2018-09-01 17:41:45 -07:00
parent 87658bb667
commit 0e65aeb95d

View file

@ -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