@@ -1413,14 +1413,14 @@ fn print_tuple_struct_fields<'a, 'cx: 'a>(
1413
1413
fn item_enum ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , e : & clean:: Enum ) {
1414
1414
let tcx = cx. tcx ( ) ;
1415
1415
let count_variants = e. variants ( ) . count ( ) ;
1416
- wrap_item ( w, |w| {
1417
- render_attributes_in_code ( w, it, cx) ;
1416
+ wrap_item ( w, |mut w| {
1418
1417
write ! (
1419
1418
w,
1420
- "{}enum {}{}" ,
1419
+ "{attrs}{ }enum {}{}" ,
1421
1420
visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
1422
1421
it. name. unwrap( ) ,
1423
1422
e. generics. print( cx) ,
1423
+ attrs = render_attributes_in_code( it, tcx) ,
1424
1424
) ;
1425
1425
1426
1426
render_enum_fields (
@@ -1733,11 +1733,11 @@ fn item_primitive(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Ite
1733
1733
fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
1734
1734
wrap_item ( w, |w| {
1735
1735
let tcx = cx. tcx ( ) ;
1736
- render_attributes_in_code ( w, it, cx) ;
1737
1736
1738
1737
write ! (
1739
1738
w,
1740
- "{vis}const {name}{generics}: {typ}{where_clause}" ,
1739
+ "{attrs}{vis}const {name}: {typ}" ,
1740
+ attrs = render_attributes_in_code( it, tcx) ,
1741
1741
vis = visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
1742
1742
name = it. name. unwrap( ) ,
1743
1743
generics = c. generics. print( cx) ,
@@ -1782,7 +1782,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
1782
1782
1783
1783
fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1784
1784
wrap_item ( w, |w| {
1785
- render_attributes_in_code ( w, it, cx) ;
1785
+ write ! ( w, "{}" , render_attributes_in_code ( it, cx. tcx ( ) ) ) ;
1786
1786
render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
1787
1787
} ) ;
1788
1788
@@ -1842,10 +1842,10 @@ fn item_fields(
1842
1842
1843
1843
fn item_static ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
1844
1844
wrap_item ( w, |buffer| {
1845
- render_attributes_in_code ( buffer, it, cx) ;
1846
1845
write ! (
1847
1846
buffer,
1848
- "{vis}static {mutability}{name}: {typ}" ,
1847
+ "{attrs}{vis}static {mutability}{name}: {typ}" ,
1848
+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
1849
1849
vis = visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
1850
1850
mutability = s. mutability. print_with_space( ) ,
1851
1851
name = it. name. unwrap( ) ,
@@ -1860,12 +1860,12 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
1860
1860
fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item ) {
1861
1861
wrap_item ( w, |buffer| {
1862
1862
buffer. write_str ( "extern {\n " ) . unwrap ( ) ;
1863
- render_attributes_in_code ( buffer, it, cx) ;
1864
1863
write ! (
1865
1864
buffer,
1866
- " {}type {};\n }}" ,
1865
+ "{attrs} {}type {};\n }}" ,
1867
1866
visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
1868
1867
it. name. unwrap( ) ,
1868
+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
1869
1869
)
1870
1870
. unwrap ( ) ;
1871
1871
} ) ;
0 commit comments