@@ -1413,14 +1413,14 @@ fn print_tuple_struct_fields<'a, 'cx: 'a>(
14131413fn item_enum ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , e : & clean:: Enum ) {
14141414 let tcx = cx. tcx ( ) ;
14151415 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| {
14181417 write ! (
14191418 w,
1420- "{}enum {}{}" ,
1419+ "{attrs}{ }enum {}{}" ,
14211420 visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
14221421 it. name. unwrap( ) ,
14231422 e. generics. print( cx) ,
1423+ attrs = render_attributes_in_code( it, tcx) ,
14241424 ) ;
14251425
14261426 render_enum_fields (
@@ -1733,11 +1733,11 @@ fn item_primitive(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Ite
17331733fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
17341734 wrap_item ( w, |w| {
17351735 let tcx = cx. tcx ( ) ;
1736- render_attributes_in_code ( w, it, cx) ;
17371736
17381737 write ! (
17391738 w,
1740- "{vis}const {name}{generics}: {typ}{where_clause}" ,
1739+ "{attrs}{vis}const {name}: {typ}" ,
1740+ attrs = render_attributes_in_code( it, tcx) ,
17411741 vis = visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
17421742 name = it. name. unwrap( ) ,
17431743 generics = c. generics. print( cx) ,
@@ -1782,7 +1782,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
17821782
17831783fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
17841784 wrap_item ( w, |w| {
1785- render_attributes_in_code ( w, it, cx) ;
1785+ write ! ( w, "{}" , render_attributes_in_code ( it, cx. tcx ( ) ) ) ;
17861786 render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
17871787 } ) ;
17881788
@@ -1842,10 +1842,10 @@ fn item_fields(
18421842
18431843fn item_static ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
18441844 wrap_item ( w, |buffer| {
1845- render_attributes_in_code ( buffer, it, cx) ;
18461845 write ! (
18471846 buffer,
1848- "{vis}static {mutability}{name}: {typ}" ,
1847+ "{attrs}{vis}static {mutability}{name}: {typ}" ,
1848+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
18491849 vis = visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
18501850 mutability = s. mutability. print_with_space( ) ,
18511851 name = it. name. unwrap( ) ,
@@ -1860,12 +1860,12 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
18601860fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item ) {
18611861 wrap_item ( w, |buffer| {
18621862 buffer. write_str ( "extern {\n " ) . unwrap ( ) ;
1863- render_attributes_in_code ( buffer, it, cx) ;
18641863 write ! (
18651864 buffer,
1866- " {}type {};\n }}" ,
1865+ "{attrs} {}type {};\n }}" ,
18671866 visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
18681867 it. name. unwrap( ) ,
1868+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
18691869 )
18701870 . unwrap ( ) ;
18711871 } ) ;
0 commit comments