@@ -120,8 +120,7 @@ macro_rules! item_template_methods {
120
120
fn render_attributes_in_pre<' b>( & ' b self ) -> impl fmt:: Display + Captures <' a> + ' b + Captures <' cx> {
121
121
display_fn( move |f| {
122
122
let ( item, cx) = self . item_and_mut_cx( ) ;
123
- let tcx = cx. tcx( ) ;
124
- let v = render_attributes_in_pre( item, "" , tcx) ;
123
+ let v = render_attributes_in_pre( item, "" , & cx) ;
125
124
write!( f, "{v}" )
126
125
} )
127
126
}
@@ -659,7 +658,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
659
658
w,
660
659
"{attrs}{vis}{constness}{asyncness}{unsafety}{abi}fn \
661
660
{name}{generics}{decl}{notable_traits}{where_clause}",
662
- attrs = render_attributes_in_pre( it, "" , tcx ) ,
661
+ attrs = render_attributes_in_pre( it, "" , cx ) ,
663
662
vis = visibility,
664
663
constness = constness,
665
664
asyncness = asyncness,
@@ -694,7 +693,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
694
693
write ! (
695
694
w,
696
695
"{attrs}{vis}{unsafety}{is_auto}trait {name}{generics}{bounds}" ,
697
- attrs = render_attributes_in_pre( it, "" , tcx ) ,
696
+ attrs = render_attributes_in_pre( it, "" , cx ) ,
698
697
vis = visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
699
698
unsafety = t. unsafety( tcx) . print_with_space( ) ,
700
699
is_auto = if t. is_auto( tcx) { "auto " } else { "" } ,
@@ -1173,7 +1172,7 @@ fn item_trait_alias(
1173
1172
write ! (
1174
1173
w,
1175
1174
"{attrs}trait {name}{generics}{where_b} = {bounds};" ,
1176
- attrs = render_attributes_in_pre( it, "" , cx. tcx ( ) ) ,
1175
+ attrs = render_attributes_in_pre( it, "" , cx) ,
1177
1176
name = it. name. unwrap( ) ,
1178
1177
generics = t. generics. print( cx) ,
1179
1178
where_b = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
@@ -1201,7 +1200,7 @@ fn item_opaque_ty(
1201
1200
write ! (
1202
1201
w,
1203
1202
"{attrs}type {name}{generics}{where_clause} = impl {bounds};" ,
1204
- attrs = render_attributes_in_pre( it, "" , cx. tcx ( ) ) ,
1203
+ attrs = render_attributes_in_pre( it, "" , cx) ,
1205
1204
name = it. name. unwrap( ) ,
1206
1205
generics = t. generics. print( cx) ,
1207
1206
where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
@@ -1226,7 +1225,7 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
1226
1225
write ! (
1227
1226
w,
1228
1227
"{attrs}{vis}type {name}{generics}{where_clause} = {type_};" ,
1229
- attrs = render_attributes_in_pre( it, "" , cx. tcx ( ) ) ,
1228
+ attrs = render_attributes_in_pre( it, "" , cx) ,
1230
1229
vis = visibility_print_with_space( it. visibility( cx. tcx( ) ) , it. item_id, cx) ,
1231
1230
name = it. name. unwrap( ) ,
1232
1231
generics = t. generics. print( cx) ,
@@ -1415,7 +1414,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
1415
1414
let tcx = cx. tcx ( ) ;
1416
1415
let count_variants = e. variants ( ) . count ( ) ;
1417
1416
wrap_item ( w, |w| {
1418
- render_attributes_in_code ( w, it, tcx ) ;
1417
+ render_attributes_in_code ( w, it, cx ) ;
1419
1418
write ! (
1420
1419
w,
1421
1420
"{}enum {}{}" ,
@@ -1734,7 +1733,7 @@ fn item_primitive(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Ite
1734
1733
fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
1735
1734
wrap_item ( w, |w| {
1736
1735
let tcx = cx. tcx ( ) ;
1737
- render_attributes_in_code ( w, it, tcx ) ;
1736
+ render_attributes_in_code ( w, it, cx ) ;
1738
1737
1739
1738
write ! (
1740
1739
w,
@@ -1783,7 +1782,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
1783
1782
1784
1783
fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1785
1784
wrap_item ( w, |w| {
1786
- render_attributes_in_code ( w, it, cx. tcx ( ) ) ;
1785
+ render_attributes_in_code ( w, it, cx) ;
1787
1786
render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
1788
1787
} ) ;
1789
1788
@@ -1843,7 +1842,7 @@ fn item_fields(
1843
1842
1844
1843
fn item_static ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
1845
1844
wrap_item ( w, |buffer| {
1846
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1845
+ render_attributes_in_code ( buffer, it, cx) ;
1847
1846
write ! (
1848
1847
buffer,
1849
1848
"{vis}static {mutability}{name}: {typ}" ,
@@ -1861,7 +1860,7 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
1861
1860
fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & mut Context < ' _ > , it : & clean:: Item ) {
1862
1861
wrap_item ( w, |buffer| {
1863
1862
buffer. write_str ( "extern {\n " ) . unwrap ( ) ;
1864
- render_attributes_in_code ( buffer, it, cx. tcx ( ) ) ;
1863
+ render_attributes_in_code ( buffer, it, cx) ;
1865
1864
write ! (
1866
1865
buffer,
1867
1866
" {}type {};\n }}" ,
0 commit comments