@@ -27,7 +27,6 @@ use crate::comment::{
2727use crate :: config:: lists:: * ;
2828use crate :: config:: Version ;
2929use crate :: expr:: { rewrite_array, rewrite_assign_rhs, RhsAssignKind } ;
30- use crate :: header:: { format_header, HeaderPart } ;
3130use crate :: lists:: { itemize_list, write_list, ListFormatting } ;
3231use crate :: overflow;
3332use crate :: parse:: macros:: lazy_static:: parse_lazy_static;
@@ -37,8 +36,8 @@ use crate::shape::{Indent, Shape};
3736use crate :: source_map:: SpanUtils ;
3837use crate :: spanned:: Spanned ;
3938use crate :: utils:: {
40- filtered_str_fits, indent_next_line, is_empty_line, mk_sp, remove_trailing_white_spaces ,
41- rewrite_ident, trim_left_preserve_layout, NodeIdExt ,
39+ filtered_str_fits, format_visibility , indent_next_line, is_empty_line, mk_sp,
40+ remove_trailing_white_spaces , rewrite_ident, trim_left_preserve_layout, NodeIdExt ,
4241} ;
4342use crate :: visitor:: FmtVisitor ;
4443
@@ -419,21 +418,14 @@ pub(crate) fn rewrite_macro_def(
419418 None => return snippet,
420419 } ;
421420
422- let mut header = if def. macro_rules {
423- let pos = context. snippet_provider . span_after ( span, "macro_rules!" ) ;
424- vec ! [ HeaderPart :: new( "macro_rules!" , span. with_hi( pos) ) ]
421+ let mut result = if def. macro_rules {
422+ String :: from ( "macro_rules!" )
425423 } else {
426- let macro_lo = context. snippet_provider . span_before ( span, "macro" ) ;
427- let macro_hi = macro_lo + BytePos ( "macro" . len ( ) as u32 ) ;
428- vec ! [
429- HeaderPart :: visibility( context, vis) ,
430- HeaderPart :: new( "macro" , mk_sp( macro_lo, macro_hi) ) ,
431- ]
424+ format ! ( "{}macro" , format_visibility( context, vis) )
432425 } ;
433426
434- header. push ( HeaderPart :: ident ( context, ident) ) ;
435-
436- let mut result = format_header ( context, shape, header) ;
427+ result += " " ;
428+ result += rewrite_ident ( context, ident) ;
437429
438430 let multi_branch_style = def. macro_rules || parsed_def. branches . len ( ) != 1 ;
439431
0 commit comments