File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -250,30 +250,18 @@ fn impl_item_in_cfg(cx: &mut Context, impl_item: &ast::ImplItem) -> bool {
250
250
// Determine if an item should be translated in the current crate
251
251
// configuration based on the item's attributes
252
252
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| {
256
254
let mis = match attr. node . value . node {
257
255
ast:: MetaList ( _, ref mis) if attr. check_name ( "cfg" ) => mis,
258
- _ => continue
256
+ _ => return true
259
257
} ;
260
258
261
259
if mis. len ( ) != 1 {
262
260
diagnostic. span_err ( attr. span , "expected 1 cfg-pattern" ) ;
263
- return false ;
261
+ return true ;
264
262
}
265
263
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
+ } )
278
266
}
279
267
You can’t perform that action at this time.
0 commit comments