@@ -27,7 +27,6 @@ use crate::comment::{
27
27
use crate :: config:: lists:: * ;
28
28
use crate :: config:: Version ;
29
29
use crate :: expr:: { rewrite_array, rewrite_assign_rhs, RhsAssignKind } ;
30
- use crate :: header:: { format_header, HeaderPart } ;
31
30
use crate :: lists:: { itemize_list, write_list, ListFormatting } ;
32
31
use crate :: overflow;
33
32
use crate :: parse:: macros:: lazy_static:: parse_lazy_static;
@@ -37,8 +36,8 @@ use crate::shape::{Indent, Shape};
37
36
use crate :: source_map:: SpanUtils ;
38
37
use crate :: spanned:: Spanned ;
39
38
use 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 ,
42
41
} ;
43
42
use crate :: visitor:: FmtVisitor ;
44
43
@@ -419,21 +418,14 @@ pub(crate) fn rewrite_macro_def(
419
418
None => return snippet,
420
419
} ;
421
420
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!" )
425
423
} 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) )
432
425
} ;
433
426
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) ;
437
429
438
430
let multi_branch_style = def. macro_rules || parsed_def. branches . len ( ) != 1 ;
439
431
0 commit comments