@@ -544,12 +544,12 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
544
544
f. decl . output . as_return ( ) . and_then ( |output| notable_traits_button ( output, cx) ) ;
545
545
546
546
wrap_item ( w, |w| {
547
- render_attributes_in_pre ( w, it, "" ) ;
548
547
w. reserve ( header_len) ;
549
548
write ! (
550
549
w,
551
- "{vis}{constness}{asyncness}{unsafety}{abi}fn \
550
+ "{attrs}{ vis}{constness}{asyncness}{unsafety}{abi}fn \
552
551
{name}{generics}{decl}{notable_traits}{where_clause}",
552
+ attrs = render_attributes_in_pre( it, "" ) ,
553
553
vis = visibility,
554
554
constness = constness,
555
555
asyncness = asyncness,
@@ -581,16 +581,16 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
581
581
582
582
// Output the trait definition
583
583
wrap_item ( w, |w| {
584
- render_attributes_in_pre ( w, it, "" ) ;
585
584
write ! (
586
585
w,
587
- "{}{}{}trait {}{}{}" ,
586
+ "{attrs}{ }{}{}trait {}{}{}" ,
588
587
visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
589
588
t. unsafety( tcx) . print_with_space( ) ,
590
589
if t. is_auto( tcx) { "auto " } else { "" } ,
591
590
it. name. unwrap( ) ,
592
591
t. generics. print( cx) ,
593
- bounds
592
+ bounds,
593
+ attrs = render_attributes_in_pre( it, "" ) ,
594
594
) ;
595
595
596
596
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:
1057
1057
1058
1058
fn item_trait_alias ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , t : & clean:: TraitAlias ) {
1059
1059
wrap_item ( w, |w| {
1060
- render_attributes_in_pre ( w, it, "" ) ;
1061
1060
write ! (
1062
1061
w,
1063
- "trait {}{}{} = {};" ,
1062
+ "{attrs} trait {}{}{} = {};" ,
1064
1063
it. name. unwrap( ) ,
1065
1064
t. generics. print( cx) ,
1066
1065
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, "" ) ,
1068
1068
) ;
1069
1069
} ) ;
1070
1070
@@ -1079,14 +1079,14 @@ fn item_trait_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &
1079
1079
1080
1080
fn item_opaque_ty ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , t : & clean:: OpaqueTy ) {
1081
1081
wrap_item ( w, |w| {
1082
- render_attributes_in_pre ( w, it, "" ) ;
1083
1082
write ! (
1084
1083
w,
1085
- "type {}{}{where_clause} = impl {bounds};" ,
1084
+ "{attrs} type {}{}{where_clause} = impl {bounds};" ,
1086
1085
it. name. unwrap( ) ,
1087
1086
t. generics. print( cx) ,
1088
1087
where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
1089
1088
bounds = bounds( & t. bounds, false , cx) ,
1089
+ attrs = render_attributes_in_pre( it, "" ) ,
1090
1090
) ;
1091
1091
} ) ;
1092
1092
@@ -1102,15 +1102,15 @@ fn item_opaque_ty(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &cl
1102
1102
fn item_typedef ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , t : & clean:: Typedef ) {
1103
1103
fn write_content ( w : & mut Buffer , cx : & Context < ' _ > , it : & clean:: Item , t : & clean:: Typedef ) {
1104
1104
wrap_item ( w, |w| {
1105
- render_attributes_in_pre ( w, it, "" ) ;
1106
1105
write ! (
1107
1106
w,
1108
- "{}type {}{}{where_clause} = {type_};" ,
1107
+ "{attrs}{ }type {}{}{where_clause} = {type_};" ,
1109
1108
visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
1110
1109
it. name. unwrap( ) ,
1111
1110
t. generics. print( cx) ,
1112
1111
where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
1113
1112
type_ = t. type_. print( cx) ,
1113
+ attrs = render_attributes_in_pre( it, "" ) ,
1114
1114
) ;
1115
1115
} ) ;
1116
1116
}
@@ -1130,7 +1130,7 @@ fn item_typedef(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clea
1130
1130
1131
1131
fn item_union ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Union ) {
1132
1132
wrap_item ( w, |w| {
1133
- render_attributes_in_pre ( w, it, "" ) ;
1133
+ write ! ( w, "{}" , render_attributes_in_pre ( it, "" ) ) ;
1134
1134
render_union ( w, it, Some ( & s. generics ) , & s. fields , cx) ;
1135
1135
} ) ;
1136
1136
@@ -1197,13 +1197,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
1197
1197
let tcx = cx. tcx ( ) ;
1198
1198
let count_variants = e. variants ( ) . count ( ) ;
1199
1199
wrap_item ( w, |w| {
1200
- render_attributes_in_pre ( w, it, "" ) ;
1201
1200
write ! (
1202
1201
w,
1203
- "{}enum {}{}" ,
1202
+ "{attrs}{ }enum {}{}" ,
1204
1203
visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
1205
1204
it. name. unwrap( ) ,
1206
1205
e. generics. print( cx) ,
1206
+ attrs = render_attributes_in_pre( it, "" ) ,
1207
1207
) ;
1208
1208
if !print_where_clause_and_check ( w, & e. generics , cx) {
1209
1209
// If there wasn't a `where` clause, we add a whitespace.
0 commit comments