Skip to content

Commit 9acce10

Browse files
committed
Finish cfg syntax transition
1 parent 80e5fe1 commit 9acce10

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/libsyntax/config.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -250,30 +250,18 @@ fn impl_item_in_cfg(cx: &mut Context, impl_item: &ast::ImplItem) -> bool {
250250
// Determine if an item should be translated in the current crate
251251
// configuration based on the item's attributes
252252
fn in_cfg(diagnostic: &SpanHandler, cfg: &[P<ast::MetaItem>], attrs: &[ast::Attribute]) -> bool {
253-
let mut in_cfg = false;
254-
let mut seen_cfg = false;
255-
for attr in attrs.iter() {
253+
attrs.iter().all(|attr| {
256254
let mis = match attr.node.value.node {
257255
ast::MetaList(_, ref mis) if attr.check_name("cfg") => mis,
258-
_ => continue
256+
_ => return true
259257
};
260258

261259
if mis.len() != 1 {
262260
diagnostic.span_err(attr.span, "expected 1 cfg-pattern");
263-
return false;
261+
return true;
264262
}
265263

266-
if seen_cfg {
267-
diagnostic.span_err(attr.span, "The semantics of multiple `#[cfg(..)]` attributes on \
268-
same item are changing from the union of the cfgs to \
269-
the intersection of the cfgs. Change `#[cfg(a)] \
270-
#[cfg(b)]` to `#[cfg(any(a, b))]`.");
271-
return false;
272-
}
273-
274-
seen_cfg = true;
275-
in_cfg |= attr::cfg_matches(diagnostic, cfg, &*mis[0]);
276-
}
277-
in_cfg | !seen_cfg
264+
attr::cfg_matches(diagnostic, cfg, &*mis[0])
265+
})
278266
}
279267

0 commit comments

Comments
 (0)