@@ -1334,13 +1334,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
1334
1334
let tcx = cx. tcx ( ) ;
1335
1335
let count_variants = e. variants ( ) . count ( ) ;
1336
1336
wrap_item ( w, |mut w| {
1337
- render_attributes_in_code ( w, it, tcx) ;
1338
1337
write ! (
1339
1338
w,
1340
- "{}enum {}{}" ,
1339
+ "{attrs}{ }enum {}{}" ,
1341
1340
visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
1342
1341
it. name. unwrap( ) ,
1343
1342
e. generics. print( cx) ,
1343
+ attrs = render_attributes_in_code( it, tcx) ,
1344
1344
) ;
1345
1345
if !print_where_clause_and_check ( w, & e. generics , cx) {
1346
1346
// If there wasn't a `where` clause, we add a whitespace.
@@ -1539,11 +1539,11 @@ fn item_primitive(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Ite
1539
1539
fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
1540
1540
wrap_item ( w, |w| {
1541
1541
let tcx = cx. tcx ( ) ;
1542
- render_attributes_in_code ( w, it, tcx) ;
1543
1542
1544
1543
write ! (
1545
1544
w,
1546
- "{vis}const {name}: {typ}" ,
1545
+ "{attrs}{vis}const {name}: {typ}" ,
1546
+ attrs = render_attributes_in_code( it, tcx) ,
1547
1547
vis = visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
1548
1548
name = it. name. unwrap( ) ,
1549
1549
typ = c. type_. print( cx) ,
@@ -1586,7 +1586,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
1586
1586
1587
1587
fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1588
1588
wrap_item ( w, |w| {
1589
- render_attributes_in_code ( w, it, cx. tcx ( ) ) ;
1589
+ write ! ( w, "{}" , render_attributes_in_code ( it, cx. tcx( ) ) ) ;
1590
1590
render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
1591
1591
} ) ;
1592
1592
@@ -1636,10 +1636,10 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
1636
1636
1637
1637
fn item_static ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
1638
1638
wrap_item ( w, |buffer| {
1639
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1640
1639
write ! (
1641
1640
buffer,
1642
- "{vis}static {mutability}{name}: {typ}" ,
1641
+ "{attrs}{vis}static {mutability}{name}: {typ}" ,
1642
+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
1643
1643
vis = visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
1644
1644
mutability = s. mutability. print_with_space( ) ,
1645
1645
name = it. name. unwrap( ) ,
@@ -1654,12 +1654,12 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
1654
1654
fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item ) {
1655
1655
wrap_item ( w, |buffer| {
1656
1656
buffer. write_str ( "extern {\n " ) . unwrap ( ) ;
1657
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1658
1657
write ! (
1659
1658
buffer,
1660
- " {}type {};\n }}" ,
1659
+ "{attrs} {}type {};\n }}" ,
1661
1660
visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
1662
1661
it. name. unwrap( ) ,
1662
+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
1663
1663
)
1664
1664
. unwrap ( ) ;
1665
1665
} ) ;
0 commit comments