@@ -117,8 +117,7 @@ macro_rules! item_template_methods {
117
117
fn render_attributes_in_pre<' b>( & ' b self ) -> impl fmt:: Display + Captures <' a> + ' b + Captures <' cx> {
118
118
display_fn( move |f| {
119
119
let ( item, cx) = self . item_and_mut_cx( ) ;
120
- let tcx = cx. tcx( ) ;
121
- let v = render_attributes_in_pre( item, "" , tcx) ;
120
+ let v = render_attributes_in_pre( item, "" , & cx) ;
122
121
write!( f, "{v}" )
123
122
} )
124
123
}
@@ -656,7 +655,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
656
655
w,
657
656
"{attrs}{vis}{constness}{asyncness}{unsafety}{abi}fn \
658
657
{name}{generics}{decl}{notable_traits}{where_clause}",
659
- attrs = render_attributes_in_pre( it, "" , tcx ) ,
658
+ attrs = render_attributes_in_pre( it, "" , cx ) ,
660
659
vis = visibility,
661
660
constness = constness,
662
661
asyncness = asyncness,
@@ -691,7 +690,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
691
690
write ! (
692
691
w,
693
692
"{attrs}{vis}{unsafety}{is_auto}trait {name}{generics}{bounds}" ,
694
- attrs = render_attributes_in_pre( it, "" , tcx ) ,
693
+ attrs = render_attributes_in_pre( it, "" , cx ) ,
695
694
vis = visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
696
695
unsafety = t. unsafety( tcx) . print_with_space( ) ,
697
696
is_auto = if t. is_auto( tcx) { "auto " } else { "" } ,
@@ -1170,7 +1169,7 @@ fn item_trait_alias(
1170
1169
write ! (
1171
1170
w,
1172
1171
"{attrs}trait {name}{generics}{where_b} = {bounds};" ,
1173
- attrs = render_attributes_in_pre( it, "" , cx. tcx ( ) ) ,
1172
+ attrs = render_attributes_in_pre( it, "" , cx) ,
1174
1173
name = it. name. unwrap( ) ,
1175
1174
generics = t. generics. print( cx) ,
1176
1175
where_b = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
@@ -1198,7 +1197,7 @@ fn item_opaque_ty(
1198
1197
write ! (
1199
1198
w,
1200
1199
"{attrs}type {name}{generics}{where_clause} = impl {bounds};" ,
1201
- attrs = render_attributes_in_pre( it, "" , cx. tcx ( ) ) ,
1200
+ attrs = render_attributes_in_pre( it, "" , cx) ,
1202
1201
name = it. name. unwrap( ) ,
1203
1202
generics = t. generics. print( cx) ,
1204
1203
where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
@@ -1223,7 +1222,7 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
1223
1222
write ! (
1224
1223
w,
1225
1224
"{attrs}{vis}type {name}{generics}{where_clause} = {type_};" ,
1226
- attrs = render_attributes_in_pre( it, "" , cx. tcx ( ) ) ,
1225
+ attrs = render_attributes_in_pre( it, "" , cx) ,
1227
1226
vis = visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
1228
1227
name = it. name. unwrap( ) ,
1229
1228
generics = t. generics. print( cx) ,
@@ -1333,7 +1332,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
1333
1332
let tcx = cx. tcx ( ) ;
1334
1333
let count_variants = e. variants ( ) . count ( ) ;
1335
1334
wrap_item ( w, |mut w| {
1336
- render_attributes_in_code ( w, it, tcx ) ;
1335
+ render_attributes_in_code ( w, it, cx ) ;
1337
1336
write ! (
1338
1337
w,
1339
1338
"{}enum {}{}" ,
@@ -1538,7 +1537,7 @@ fn item_primitive(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Ite
1538
1537
fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
1539
1538
wrap_item ( w, |w| {
1540
1539
let tcx = cx. tcx ( ) ;
1541
- render_attributes_in_code ( w, it, tcx ) ;
1540
+ render_attributes_in_code ( w, it, cx ) ;
1542
1541
1543
1542
write ! (
1544
1543
w,
@@ -1587,7 +1586,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
1587
1586
1588
1587
fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1589
1588
wrap_item ( w, |w| {
1590
- render_attributes_in_code ( w, it, cx. tcx ( ) ) ;
1589
+ render_attributes_in_code ( w, it, cx) ;
1591
1590
render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
1592
1591
} ) ;
1593
1592
@@ -1637,7 +1636,7 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
1637
1636
1638
1637
fn item_static ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
1639
1638
wrap_item ( w, |buffer| {
1640
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1639
+ render_attributes_in_code ( buffer, it, cx) ;
1641
1640
write ! (
1642
1641
buffer,
1643
1642
"{vis}static {mutability}{name}: {typ}" ,
@@ -1655,7 +1654,7 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
1655
1654
fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item ) {
1656
1655
wrap_item ( w, |buffer| {
1657
1656
buffer. write_str ( "extern {\n " ) . unwrap ( ) ;
1658
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1657
+ render_attributes_in_code ( buffer, it, cx) ;
1659
1658
write ! (
1660
1659
buffer,
1661
1660
" {}type {};\n }}" ,
0 commit comments