@@ -1334,13 +1334,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
13341334 let tcx = cx. tcx ( ) ;
13351335 let count_variants = e. variants ( ) . count ( ) ;
13361336 wrap_item ( w, |mut w| {
1337- render_attributes_in_code ( w, it, tcx) ;
13381337 write ! (
13391338 w,
1340- "{}enum {}{}" ,
1339+ "{attrs}{ }enum {}{}" ,
13411340 visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
13421341 it. name. unwrap( ) ,
13431342 e. generics. print( cx) ,
1343+ attrs = render_attributes_in_code( it, tcx) ,
13441344 ) ;
13451345 if !print_where_clause_and_check ( w, & e. generics , cx) {
13461346 // 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
15391539fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
15401540 wrap_item ( w, |w| {
15411541 let tcx = cx. tcx ( ) ;
1542- render_attributes_in_code ( w, it, tcx) ;
15431542
15441543 write ! (
15451544 w,
1546- "{vis}const {name}: {typ}" ,
1545+ "{attrs}{vis}const {name}: {typ}" ,
1546+ attrs = render_attributes_in_code( it, tcx) ,
15471547 vis = visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
15481548 name = it. name. unwrap( ) ,
15491549 typ = c. type_. print( cx) ,
@@ -1586,7 +1586,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
15861586
15871587fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
15881588 wrap_item ( w, |w| {
1589- render_attributes_in_code ( w, it, cx. tcx ( ) ) ;
1589+ write ! ( w, "{}" , render_attributes_in_code ( it, cx. tcx( ) ) ) ;
15901590 render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
15911591 } ) ;
15921592
@@ -1636,10 +1636,10 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
16361636
16371637fn item_static ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
16381638 wrap_item ( w, |buffer| {
1639- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
16401639 write ! (
16411640 buffer,
1642- "{vis}static {mutability}{name}: {typ}" ,
1641+ "{attrs}{vis}static {mutability}{name}: {typ}" ,
1642+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
16431643 vis = visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
16441644 mutability = s. mutability. print_with_space( ) ,
16451645 name = it. name. unwrap( ) ,
@@ -1654,12 +1654,12 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
16541654fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item ) {
16551655 wrap_item ( w, |buffer| {
16561656 buffer. write_str ( "extern {\n " ) . unwrap ( ) ;
1657- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
16581657 write ! (
16591658 buffer,
1660- " {}type {};\n }}" ,
1659+ "{attrs} {}type {};\n }}" ,
16611660 visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
16621661 it. name. unwrap( ) ,
1662+ attrs = render_attributes_in_code( it, cx. tcx( ) ) ,
16631663 )
16641664 . unwrap ( ) ;
16651665 } ) ;
0 commit comments