File tree 4 files changed +350
-66
lines changed
4 files changed +350
-66
lines changed Original file line number Diff line number Diff line change @@ -488,3 +488,36 @@ fn attr_prefix(attr: &ast::Attribute) -> &'static str {
488
488
ast:: AttrStyle :: Outer => "#" ,
489
489
}
490
490
}
491
+
492
+ pub ( crate ) trait MetaVisitor < ' ast > {
493
+ fn visit_meta_item ( & mut self , meta_item : & ' ast ast:: MetaItem ) {
494
+ match meta_item. node {
495
+ ast:: MetaItemKind :: Word => self . visit_meta_word ( meta_item) ,
496
+ ast:: MetaItemKind :: List ( ref list) => self . visit_meta_list ( meta_item, list) ,
497
+ ast:: MetaItemKind :: NameValue ( ref lit) => self . visit_meta_name_value ( meta_item, lit) ,
498
+ }
499
+ }
500
+
501
+ fn visit_meta_list (
502
+ & mut self ,
503
+ _meta_item : & ' ast ast:: MetaItem ,
504
+ list : & ' ast [ ast:: NestedMetaItem ] ,
505
+ ) {
506
+ for nm in list {
507
+ self . visit_nested_meta_item ( nm) ;
508
+ }
509
+ }
510
+
511
+ fn visit_meta_word ( & mut self , _meta_item : & ' ast ast:: MetaItem ) { }
512
+
513
+ fn visit_meta_name_value ( & mut self , _meta_item : & ' ast ast:: MetaItem , _lit : & ' ast ast:: Lit ) { }
514
+
515
+ fn visit_nested_meta_item ( & mut self , nm : & ' ast ast:: NestedMetaItem ) {
516
+ match nm {
517
+ ast:: NestedMetaItem :: MetaItem ( ref meta_item) => self . visit_meta_item ( meta_item) ,
518
+ ast:: NestedMetaItem :: Literal ( ref lit) => self . visit_literal ( lit) ,
519
+ }
520
+ }
521
+
522
+ fn visit_literal ( & mut self , _lit : & ' ast ast:: Lit ) { }
523
+ }
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ fn format_project<T: FormatHandler>(
105
105
)
106
106
. visit_crate ( & krate)
107
107
. map_err ( |e| io:: Error :: new ( io:: ErrorKind :: Other , e) ) ?;
108
- for ( path, ( module, _ ) ) in files {
108
+ for ( path, module) in files {
109
109
let should_ignore = !input_is_stdin && ignore_path_set. is_match ( & path) ;
110
110
if ( config. skip_children ( ) && path != main_file) || should_ignore {
111
111
continue ;
You can’t perform that action at this time.
0 commit comments