@@ -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) ,
@@ -1408,7 +1407,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
1408
1407
let tcx = cx. tcx ( ) ;
1409
1408
let count_variants = e. variants ( ) . count ( ) ;
1410
1409
wrap_item ( w, |w| {
1411
- render_attributes_in_code ( w, it, tcx ) ;
1410
+ render_attributes_in_code ( w, it, cx ) ;
1412
1411
write ! (
1413
1412
w,
1414
1413
"{}enum {}{}" ,
@@ -1644,7 +1643,7 @@ fn item_primitive(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Ite
1644
1643
fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
1645
1644
wrap_item ( w, |w| {
1646
1645
let tcx = cx. tcx ( ) ;
1647
- render_attributes_in_code ( w, it, tcx ) ;
1646
+ render_attributes_in_code ( w, it, cx ) ;
1648
1647
1649
1648
write ! (
1650
1649
w,
@@ -1693,7 +1692,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
1693
1692
1694
1693
fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1695
1694
wrap_item ( w, |w| {
1696
- render_attributes_in_code ( w, it, cx. tcx ( ) ) ;
1695
+ render_attributes_in_code ( w, it, cx) ;
1697
1696
render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
1698
1697
} ) ;
1699
1698
@@ -1753,7 +1752,7 @@ fn item_fields(
1753
1752
1754
1753
fn item_static ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
1755
1754
wrap_item ( w, |buffer| {
1756
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1755
+ render_attributes_in_code ( buffer, it, cx) ;
1757
1756
write ! (
1758
1757
buffer,
1759
1758
"{vis}static {mutability}{name}: {typ}" ,
@@ -1771,7 +1770,7 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
1771
1770
fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item ) {
1772
1771
wrap_item ( w, |buffer| {
1773
1772
buffer. write_str ( "extern {\n " ) . unwrap ( ) ;
1774
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1773
+ render_attributes_in_code ( buffer, it, cx) ;
1775
1774
write ! (
1776
1775
buffer,
1777
1776
" {}type {};\n }}" ,
0 commit comments