@@ -26,7 +26,7 @@ use items::{format_impl, format_trait, rewrite_associated_impl_type, rewrite_ass
2626use lists:: { itemize_list, write_list, DefinitiveListTactic , ListFormatting , SeparatorTactic } ;
2727use macros:: { rewrite_macro, MacroPosition } ;
2828use rewrite:: { Rewrite , RewriteContext } ;
29- use utils:: { self , mk_sp} ;
29+ use utils:: { self , contains_skip , mk_sp} ;
3030
3131fn is_use_item ( item : & ast:: Item ) -> bool {
3232 match item. node {
@@ -79,11 +79,15 @@ impl<'a> FmtVisitor<'a> {
7979 ast:: StmtKind :: Item ( ref item) => {
8080 self . visit_item ( item) ;
8181 }
82- ast:: StmtKind :: Local ( ..) => {
83- let rewrite = stmt. rewrite (
84- & self . get_context ( ) ,
85- Shape :: indented ( self . block_indent , self . config ) ,
86- ) ;
82+ ast:: StmtKind :: Local ( ref local) => {
83+ let rewrite = if contains_skip ( & local. attrs ) {
84+ None
85+ } else {
86+ stmt. rewrite (
87+ & self . get_context ( ) ,
88+ Shape :: indented ( self . block_indent , self . config ) ,
89+ )
90+ } ;
8791 self . push_rewrite ( stmt. span , rewrite) ;
8892 }
8993 ast:: StmtKind :: Expr ( ref expr) => {
@@ -113,8 +117,12 @@ impl<'a> FmtVisitor<'a> {
113117 self . push_rewrite ( span, rewrite)
114118 }
115119 ast:: StmtKind :: Mac ( ref mac) => {
116- let ( ref mac, _macro_style, _) = * * mac;
117- self . visit_mac ( mac, None , MacroPosition :: Statement ) ;
120+ let ( ref mac, _macro_style, ref attrs) = * * mac;
121+ if contains_skip ( attrs) {
122+ self . push_rewrite ( mac. span , None ) ;
123+ } else {
124+ self . visit_mac ( mac, None , MacroPosition :: Statement ) ;
125+ }
118126 self . format_missing ( stmt. span . hi ) ;
119127 }
120128 }
0 commit comments