File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ use std::{fs, path::PathBuf};
44pub mod codegen;
55mod flags;
66use codegen:: grammar:: ast_src:: { AstNodeSrc , AstSrc , Field } ;
7- use itertools:: Itertools ;
87use std:: collections:: { BTreeMap , BTreeSet } ;
98use std:: env;
109use ungrammar:: Grammar ;
Original file line number Diff line number Diff line change @@ -560,16 +560,12 @@ impl<'a> Translator<'a> {
560560 }
561561
562562 pub ( crate ) fn should_be_excluded ( & self , item : & impl ast:: HasAttrs ) -> bool {
563- let Some ( sema) = self . semantics else {
564- return false ;
565- } ;
566- for attr in item. attrs ( ) {
567- if let Some ( ( name, tokens) ) = attr. as_simple_call ( ) {
568- if name == "cfg" && sema. check_cfg_attr ( & tokens) == Some ( false ) {
569- return true ;
570- }
571- }
572- }
573- false
563+ self . semantics . is_some_and ( |sema| {
564+ item. attrs ( ) . any ( |attr| {
565+ attr. as_simple_call ( ) . is_some_and ( |( name, tokens) | {
566+ name == "cfg" && sema. check_cfg_attr ( & tokens) == Some ( false )
567+ } )
568+ } )
569+ } )
574570 }
575571}
You can’t perform that action at this time.
0 commit comments