@@ -445,14 +445,14 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
445
445
Some ( src) => write ! (
446
446
w,
447
447
"<div class=\" item-name\" ><code>{}extern crate {} as {};" ,
448
- visibility_print_with_space( myitem. visibility ( tcx ) , myitem . item_id , cx) ,
448
+ visibility_print_with_space( myitem, cx) ,
449
449
anchor( myitem. item_id. expect_def_id( ) , src, cx) ,
450
450
myitem. name. unwrap( ) ,
451
451
) ,
452
452
None => write ! (
453
453
w,
454
454
"<div class=\" item-name\" ><code>{}extern crate {};" ,
455
- visibility_print_with_space( myitem. visibility ( tcx ) , myitem . item_id , cx) ,
455
+ visibility_print_with_space( myitem, cx) ,
456
456
anchor( myitem. item_id. expect_def_id( ) , myitem. name. unwrap( ) , cx) ,
457
457
) ,
458
458
}
@@ -491,7 +491,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
491
491
<code>{vis}{imp}</code>\
492
492
</div>\
493
493
{stab_tags_before}{stab_tags}{stab_tags_after}",
494
- vis = visibility_print_with_space( myitem. visibility ( tcx ) , myitem . item_id , cx) ,
494
+ vis = visibility_print_with_space( myitem, cx) ,
495
495
imp = import. print( cx) ,
496
496
) ;
497
497
w. write_str ( ITEM_TABLE_ROW_CLOSE ) ;
@@ -631,7 +631,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
631
631
let unsafety = header. unsafety . print_with_space ( ) ;
632
632
let abi = print_abi_with_space ( header. abi ) . to_string ( ) ;
633
633
let asyncness = header. asyncness . print_with_space ( ) ;
634
- let visibility = visibility_print_with_space ( it. visibility ( tcx ) , it . item_id , cx) . to_string ( ) ;
634
+ let visibility = visibility_print_with_space ( it, cx) . to_string ( ) ;
635
635
let name = it. name . unwrap ( ) ;
636
636
637
637
let generics_len = format ! ( "{:#}" , f. generics. print( cx) ) . len ( ) ;
@@ -688,7 +688,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
688
688
w,
689
689
"{attrs}{vis}{unsafety}{is_auto}trait {name}{generics}{bounds}" ,
690
690
attrs = render_attributes_in_pre( it, "" , cx) ,
691
- vis = visibility_print_with_space( it. visibility ( tcx ) , it . item_id , cx) ,
691
+ vis = visibility_print_with_space( it, cx) ,
692
692
unsafety = t. unsafety( tcx) . print_with_space( ) ,
693
693
is_auto = if t. is_auto( tcx) { "auto " } else { "" } ,
694
694
name = it. name. unwrap( ) ,
@@ -1243,7 +1243,7 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
1243
1243
w,
1244
1244
"{attrs}{vis}type {name}{generics}{where_clause} = {type_};" ,
1245
1245
attrs = render_attributes_in_pre( it, "" , cx) ,
1246
- vis = visibility_print_with_space( it. visibility ( cx . tcx ( ) ) , it . item_id , cx) ,
1246
+ vis = visibility_print_with_space( it, cx) ,
1247
1247
name = it. name. unwrap( ) ,
1248
1248
generics = t. generics. print( cx) ,
1249
1249
where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
@@ -1522,14 +1522,13 @@ fn print_tuple_struct_fields<'a, 'cx: 'a>(
1522
1522
}
1523
1523
1524
1524
fn item_enum ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , e : & clean:: Enum ) {
1525
- let tcx = cx. tcx ( ) ;
1526
1525
let count_variants = e. variants ( ) . count ( ) ;
1527
1526
wrap_item ( w, |w| {
1528
1527
render_attributes_in_code ( w, it, cx) ;
1529
1528
write ! (
1530
1529
w,
1531
1530
"{}enum {}{}" ,
1532
- visibility_print_with_space( it. visibility ( tcx ) , it . item_id , cx) ,
1531
+ visibility_print_with_space( it, cx) ,
1533
1532
it. name. unwrap( ) ,
1534
1533
e. generics. print( cx) ,
1535
1534
) ;
@@ -1860,7 +1859,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
1860
1859
write ! (
1861
1860
w,
1862
1861
"{vis}const {name}{generics}: {typ}{where_clause}" ,
1863
- vis = visibility_print_with_space( it. visibility ( tcx ) , it . item_id , cx) ,
1862
+ vis = visibility_print_with_space( it, cx) ,
1864
1863
name = it. name. unwrap( ) ,
1865
1864
generics = c. generics. print( cx) ,
1866
1865
typ = c. type_. print( cx) ,
@@ -1964,7 +1963,7 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
1964
1963
write ! (
1965
1964
buffer,
1966
1965
"{vis}static {mutability}{name}: {typ}" ,
1967
- vis = visibility_print_with_space( it. visibility ( cx . tcx ( ) ) , it . item_id , cx) ,
1966
+ vis = visibility_print_with_space( it, cx) ,
1968
1967
mutability = s. mutability. print_with_space( ) ,
1969
1968
name = it. name. unwrap( ) ,
1970
1969
typ = s. type_. print( cx)
@@ -1982,7 +1981,7 @@ fn item_foreign_type(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::
1982
1981
write ! (
1983
1982
buffer,
1984
1983
" {}type {};\n }}" ,
1985
- visibility_print_with_space( it. visibility ( cx . tcx ( ) ) , it . item_id , cx) ,
1984
+ visibility_print_with_space( it, cx) ,
1986
1985
it. name. unwrap( ) ,
1987
1986
)
1988
1987
. unwrap ( ) ;
@@ -2139,13 +2138,7 @@ fn render_union<'a, 'cx: 'a>(
2139
2138
cx : & ' a Context < ' cx > ,
2140
2139
) -> impl fmt:: Display + ' a + Captures < ' cx > {
2141
2140
display_fn ( move |mut f| {
2142
- let tcx = cx. tcx ( ) ;
2143
- write ! (
2144
- f,
2145
- "{}union {}" ,
2146
- visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
2147
- it. name. unwrap( ) ,
2148
- ) ?;
2141
+ write ! ( f, "{}union {}" , visibility_print_with_space( it, cx) , it. name. unwrap( ) , ) ?;
2149
2142
2150
2143
let where_displayed = g
2151
2144
. map ( |g| {
@@ -2175,7 +2168,7 @@ fn render_union<'a, 'cx: 'a>(
2175
2168
write ! (
2176
2169
f,
2177
2170
" {}{}: {},\n " ,
2178
- visibility_print_with_space( field. visibility ( tcx ) , field . item_id , cx) ,
2171
+ visibility_print_with_space( field, cx) ,
2179
2172
field. name. unwrap( ) ,
2180
2173
ty. print( cx)
2181
2174
) ?;
@@ -2203,11 +2196,10 @@ fn render_struct(
2203
2196
structhead : bool ,
2204
2197
cx : & Context < ' _ > ,
2205
2198
) {
2206
- let tcx = cx. tcx ( ) ;
2207
2199
write ! (
2208
2200
w,
2209
2201
"{}{}{}" ,
2210
- visibility_print_with_space( it. visibility ( tcx ) , it . item_id , cx) ,
2202
+ visibility_print_with_space( it, cx) ,
2211
2203
if structhead { "struct " } else { "" } ,
2212
2204
it. name. unwrap( )
2213
2205
) ;
@@ -2236,7 +2228,6 @@ fn render_struct_fields(
2236
2228
has_stripped_entries : bool ,
2237
2229
cx : & Context < ' _ > ,
2238
2230
) {
2239
- let tcx = cx. tcx ( ) ;
2240
2231
match ty {
2241
2232
None => {
2242
2233
let where_displayed =
@@ -2260,7 +2251,7 @@ fn render_struct_fields(
2260
2251
write ! (
2261
2252
w,
2262
2253
"\n {tab} {vis}{name}: {ty}," ,
2263
- vis = visibility_print_with_space( field. visibility ( tcx ) , field . item_id , cx) ,
2254
+ vis = visibility_print_with_space( field, cx) ,
2264
2255
name = field. name. unwrap( ) ,
2265
2256
ty = ty. print( cx) ,
2266
2257
) ;
@@ -2296,16 +2287,7 @@ fn render_struct_fields(
2296
2287
match * field. kind {
2297
2288
clean:: StrippedItem ( box clean:: StructFieldItem ( ..) ) => write ! ( w, "_" ) ,
2298
2289
clean:: StructFieldItem ( ref ty) => {
2299
- write ! (
2300
- w,
2301
- "{}{}" ,
2302
- visibility_print_with_space(
2303
- field. visibility( tcx) ,
2304
- field. item_id,
2305
- cx
2306
- ) ,
2307
- ty. print( cx) ,
2308
- )
2290
+ write ! ( w, "{}{}" , visibility_print_with_space( field, cx) , ty. print( cx) , )
2309
2291
}
2310
2292
_ => unreachable ! ( ) ,
2311
2293
}
0 commit comments