Skip to content

Commit

Permalink
More clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 20, 2022
1 parent caec4a2 commit b0df765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,8 @@ impl Cfg {
}),
},
MetaItemKind::List(ref items) => {
let sub_cfgs = items.iter().filter_map(|i| match Cfg::parse_nested(i, exclude) {
Ok(Some(c)) => Some(Ok(c)),
Err(e) => Some(Err(e)),
_ => None,
});
let sub_cfgs =
items.iter().filter_map(|i| Cfg::parse_nested(i, exclude).transpose());
let ret = match name {
sym::all => sub_cfgs.fold(Ok(Cfg::True), |x, y| Ok(x? & y?)),
sym::any => sub_cfgs.fold(Ok(Cfg::False), |x, y| Ok(x? | y?)),
Expand Down
5 changes: 2 additions & 3 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,8 @@ impl AttributesExt for [ast::Attribute] {
self.iter()
.filter(|attr| attr.has_name(sym::cfg))
.filter_map(|attr| single(attr.meta_item_list()?))
.filter_map(|attr| match Cfg::parse_without(attr.meta_item()?, hidden_cfg) {
Ok(Some(c)) => Some(c),
_ => None,
.filter_map(|attr| {
Cfg::parse_without(attr.meta_item()?, hidden_cfg).ok().flatten()
})
.fold(Cfg::True, |cfg, new_cfg| cfg & new_cfg)
} else {
Expand Down

0 comments on commit b0df765

Please sign in to comment.