@@ -445,14 +445,14 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
445445 Some ( src) => write ! (
446446 w,
447447 "<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) ,
449449 anchor( myitem. item_id. expect_def_id( ) , src, cx) ,
450450 myitem. name. unwrap( ) ,
451451 ) ,
452452 None => write ! (
453453 w,
454454 "<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) ,
456456 anchor( myitem. item_id. expect_def_id( ) , myitem. name. unwrap( ) , cx) ,
457457 ) ,
458458 }
@@ -491,7 +491,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
491491 <code>{vis}{imp}</code>\
492492 </div>\
493493 {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) ,
495495 imp = import. print( cx) ,
496496 ) ;
497497 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
631631 let unsafety = header. unsafety . print_with_space ( ) ;
632632 let abi = print_abi_with_space ( header. abi ) . to_string ( ) ;
633633 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 ( ) ;
635635 let name = it. name . unwrap ( ) ;
636636
637637 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:
688688 w,
689689 "{attrs}{vis}{unsafety}{is_auto}trait {name}{generics}{bounds}" ,
690690 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) ,
692692 unsafety = t. unsafety( tcx) . print_with_space( ) ,
693693 is_auto = if t. is_auto( tcx) { "auto " } else { "" } ,
694694 name = it. name. unwrap( ) ,
@@ -1243,7 +1243,7 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
12431243 w,
12441244 "{attrs}{vis}type {name}{generics}{where_clause} = {type_};" ,
12451245 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) ,
12471247 name = it. name. unwrap( ) ,
12481248 generics = t. generics. print( cx) ,
12491249 where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
@@ -1522,14 +1522,13 @@ fn print_tuple_struct_fields<'a, 'cx: 'a>(
15221522}
15231523
15241524fn item_enum ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , e : & clean:: Enum ) {
1525- let tcx = cx. tcx ( ) ;
15261525 let count_variants = e. variants ( ) . count ( ) ;
15271526 wrap_item ( w, |w| {
15281527 render_attributes_in_code ( w, it, cx) ;
15291528 write ! (
15301529 w,
15311530 "{}enum {}{}" ,
1532- visibility_print_with_space( it. visibility ( tcx ) , it . item_id , cx) ,
1531+ visibility_print_with_space( it, cx) ,
15331532 it. name. unwrap( ) ,
15341533 e. generics. print( cx) ,
15351534 ) ;
@@ -1860,7 +1859,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
18601859 write ! (
18611860 w,
18621861 "{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) ,
18641863 name = it. name. unwrap( ) ,
18651864 generics = c. generics. print( cx) ,
18661865 typ = c. type_. print( cx) ,
@@ -1964,7 +1963,7 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
19641963 write ! (
19651964 buffer,
19661965 "{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) ,
19681967 mutability = s. mutability. print_with_space( ) ,
19691968 name = it. name. unwrap( ) ,
19701969 typ = s. type_. print( cx)
@@ -1982,7 +1981,7 @@ fn item_foreign_type(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::
19821981 write ! (
19831982 buffer,
19841983 " {}type {};\n }}" ,
1985- visibility_print_with_space( it. visibility ( cx . tcx ( ) ) , it . item_id , cx) ,
1984+ visibility_print_with_space( it, cx) ,
19861985 it. name. unwrap( ) ,
19871986 )
19881987 . unwrap ( ) ;
@@ -2139,13 +2138,7 @@ fn render_union<'a, 'cx: 'a>(
21392138 cx : & ' a Context < ' cx > ,
21402139) -> impl fmt:: Display + ' a + Captures < ' cx > {
21412140 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( ) , ) ?;
21492142
21502143 let where_displayed = g
21512144 . map ( |g| {
@@ -2175,7 +2168,7 @@ fn render_union<'a, 'cx: 'a>(
21752168 write ! (
21762169 f,
21772170 " {}{}: {},\n " ,
2178- visibility_print_with_space( field. visibility ( tcx ) , field . item_id , cx) ,
2171+ visibility_print_with_space( field, cx) ,
21792172 field. name. unwrap( ) ,
21802173 ty. print( cx)
21812174 ) ?;
@@ -2203,11 +2196,10 @@ fn render_struct(
22032196 structhead : bool ,
22042197 cx : & Context < ' _ > ,
22052198) {
2206- let tcx = cx. tcx ( ) ;
22072199 write ! (
22082200 w,
22092201 "{}{}{}" ,
2210- visibility_print_with_space( it. visibility ( tcx ) , it . item_id , cx) ,
2202+ visibility_print_with_space( it, cx) ,
22112203 if structhead { "struct " } else { "" } ,
22122204 it. name. unwrap( )
22132205 ) ;
@@ -2236,7 +2228,6 @@ fn render_struct_fields(
22362228 has_stripped_entries : bool ,
22372229 cx : & Context < ' _ > ,
22382230) {
2239- let tcx = cx. tcx ( ) ;
22402231 match ty {
22412232 None => {
22422233 let where_displayed =
@@ -2260,7 +2251,7 @@ fn render_struct_fields(
22602251 write ! (
22612252 w,
22622253 "\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) ,
22642255 name = field. name. unwrap( ) ,
22652256 ty = ty. print( cx) ,
22662257 ) ;
@@ -2296,16 +2287,7 @@ fn render_struct_fields(
22962287 match * field. kind {
22972288 clean:: StrippedItem ( box clean:: StructFieldItem ( ..) ) => write ! ( w, "_" ) ,
22982289 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) , )
23092291 }
23102292 _ => unreachable ! ( ) ,
23112293 }
0 commit comments