@@ -544,12 +544,12 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
544544 f. decl . output . as_return ( ) . and_then ( |output| notable_traits_button ( output, cx) ) ;
545545
546546 wrap_item ( w, |w| {
547- render_attributes_in_pre ( w, it, "" ) ;
548547 w. reserve ( header_len) ;
549548 write ! (
550549 w,
551- "{vis}{constness}{asyncness}{unsafety}{abi}fn \
550+ "{attrs}{ vis}{constness}{asyncness}{unsafety}{abi}fn \
552551 {name}{generics}{decl}{notable_traits}{where_clause}",
552+ attrs = render_attributes_in_pre( it, "" ) ,
553553 vis = visibility,
554554 constness = constness,
555555 asyncness = asyncness,
@@ -581,16 +581,16 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
581581
582582 // Output the trait definition
583583 wrap_item ( w, |w| {
584- render_attributes_in_pre ( w, it, "" ) ;
585584 write ! (
586585 w,
587- "{}{}{}trait {}{}{}" ,
586+ "{attrs}{ }{}{}trait {}{}{}" ,
588587 visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
589588 t. unsafety( tcx) . print_with_space( ) ,
590589 if t. is_auto( tcx) { "auto " } else { "" } ,
591590 it. name. unwrap( ) ,
592591 t. generics. print( cx) ,
593- bounds
592+ bounds,
593+ attrs = render_attributes_in_pre( it, "" ) ,
594594 ) ;
595595
596596 if !t. generics . where_predicates . is_empty ( ) {
@@ -1057,14 +1057,14 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
10571057
10581058fn item_trait_alias ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , t : & clean:: TraitAlias ) {
10591059 wrap_item ( w, |w| {
1060- render_attributes_in_pre ( w, it, "" ) ;
10611060 write ! (
10621061 w,
1063- "trait {}{}{} = {};" ,
1062+ "{attrs} trait {}{}{} = {};" ,
10641063 it. name. unwrap( ) ,
10651064 t. generics. print( cx) ,
10661065 print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
1067- bounds( & t. bounds, true , cx)
1066+ bounds( & t. bounds, true , cx) ,
1067+ attrs = render_attributes_in_pre( it, "" ) ,
10681068 ) ;
10691069 } ) ;
10701070
@@ -1079,14 +1079,14 @@ fn item_trait_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &
10791079
10801080fn item_opaque_ty ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , t : & clean:: OpaqueTy ) {
10811081 wrap_item ( w, |w| {
1082- render_attributes_in_pre ( w, it, "" ) ;
10831082 write ! (
10841083 w,
1085- "type {}{}{where_clause} = impl {bounds};" ,
1084+ "{attrs} type {}{}{where_clause} = impl {bounds};" ,
10861085 it. name. unwrap( ) ,
10871086 t. generics. print( cx) ,
10881087 where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
10891088 bounds = bounds( & t. bounds, false , cx) ,
1089+ attrs = render_attributes_in_pre( it, "" ) ,
10901090 ) ;
10911091 } ) ;
10921092
@@ -1102,15 +1102,15 @@ fn item_opaque_ty(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &cl
11021102fn item_typedef ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , t : & clean:: Typedef ) {
11031103 fn write_content ( w : & mut Buffer , cx : & Context < ' _ > , it : & clean:: Item , t : & clean:: Typedef ) {
11041104 wrap_item ( w, |w| {
1105- render_attributes_in_pre ( w, it, "" ) ;
11061105 write ! (
11071106 w,
1108- "{}type {}{}{where_clause} = {type_};" ,
1107+ "{attrs}{ }type {}{}{where_clause} = {type_};" ,
11091108 visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
11101109 it. name. unwrap( ) ,
11111110 t. generics. print( cx) ,
11121111 where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
11131112 type_ = t. type_. print( cx) ,
1113+ attrs = render_attributes_in_pre( it, "" ) ,
11141114 ) ;
11151115 } ) ;
11161116 }
@@ -1130,7 +1130,7 @@ fn item_typedef(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clea
11301130
11311131fn item_union ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Union ) {
11321132 wrap_item ( w, |w| {
1133- render_attributes_in_pre ( w, it, "" ) ;
1133+ write ! ( w, "{}" , render_attributes_in_pre ( it, "" ) ) ;
11341134 render_union ( w, it, Some ( & s. generics ) , & s. fields , cx) ;
11351135 } ) ;
11361136
@@ -1197,13 +1197,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
11971197 let tcx = cx. tcx ( ) ;
11981198 let count_variants = e. variants ( ) . count ( ) ;
11991199 wrap_item ( w, |w| {
1200- render_attributes_in_pre ( w, it, "" ) ;
12011200 write ! (
12021201 w,
1203- "{}enum {}{}" ,
1202+ "{attrs}{ }enum {}{}" ,
12041203 visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
12051204 it. name. unwrap( ) ,
12061205 e. generics. print( cx) ,
1206+ attrs = render_attributes_in_pre( it, "" ) ,
12071207 ) ;
12081208 if !print_where_clause_and_check ( w, & e. generics , cx) {
12091209 // If there wasn't a `where` clause, we add a whitespace.
0 commit comments