@@ -65,9 +65,9 @@ use crate::docfs::{DocFS, ErrorStorage, PathError};
65
65
use crate :: doctree;
66
66
use crate :: fold:: DocFolder ;
67
67
use crate :: html:: escape:: Escape ;
68
- use crate :: html:: format:: { Buffer , AsyncSpace , ConstnessSpace } ;
69
- use crate :: html:: format:: { print_generic_bounds, WhereClause , href, AbiSpace , DefaultSpace } ;
70
- use crate :: html:: format:: { VisSpace , Function , UnsafetySpace , MutableSpace } ;
68
+ use crate :: html:: format:: { Buffer , PrintWithSpace , print_abi_with_space } ;
69
+ use crate :: html:: format:: { print_generic_bounds, WhereClause , href, print_default_space } ;
70
+ use crate :: html:: format:: { Function } ;
71
71
use crate :: html:: format:: fmt_impl_for_trait_page;
72
72
use crate :: html:: item_type:: ItemType ;
73
73
use crate :: html:: markdown:: { self , Markdown , MarkdownHtml , MarkdownSummaryLine , ErrorCodes , IdMap } ;
@@ -2573,13 +2573,13 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
2573
2573
match * src {
2574
2574
Some ( ref src) => {
2575
2575
write ! ( w, "<tr><td><code>{}extern crate {} as {};" ,
2576
- VisSpace ( & myitem. visibility) ,
2576
+ myitem. visibility. print_with_space ( ) ,
2577
2577
anchor( myitem. def_id, src) ,
2578
2578
name)
2579
2579
}
2580
2580
None => {
2581
2581
write ! ( w, "<tr><td><code>{}extern crate {};" ,
2582
- VisSpace ( & myitem. visibility) ,
2582
+ myitem. visibility. print_with_space ( ) ,
2583
2583
anchor( myitem. def_id, name) )
2584
2584
}
2585
2585
}
@@ -2588,7 +2588,7 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
2588
2588
2589
2589
clean:: ImportItem ( ref import) => {
2590
2590
write ! ( w, "<tr><td><code>{}{}</code></td></tr>" ,
2591
- VisSpace ( & myitem. visibility) , import. print( ) ) ;
2591
+ myitem. visibility. print_with_space ( ) , import. print( ) ) ;
2592
2592
}
2593
2593
2594
2594
_ => {
@@ -2794,7 +2794,7 @@ fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Cons
2794
2794
render_attributes ( w, it, false ) ;
2795
2795
write ! ( w, "{vis}const \
2796
2796
{name}: {typ}</pre>",
2797
- vis = VisSpace ( & it. visibility) ,
2797
+ vis = it. visibility. print_with_space ( ) ,
2798
2798
name = it. name. as_ref( ) . unwrap( ) ,
2799
2799
typ = c. type_. print( ) ) ;
2800
2800
document ( w, cx, it)
@@ -2805,8 +2805,8 @@ fn item_static(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Static
2805
2805
render_attributes ( w, it, false ) ;
2806
2806
write ! ( w, "{vis}static {mutability}\
2807
2807
{name}: {typ}</pre>",
2808
- vis = VisSpace ( & it. visibility) ,
2809
- mutability = MutableSpace ( s. mutability) ,
2808
+ vis = it. visibility. print_with_space ( ) ,
2809
+ mutability = s. mutability. print_with_space ( ) ,
2810
2810
name = it. name. as_ref( ) . unwrap( ) ,
2811
2811
typ = s. type_. print( ) ) ;
2812
2812
document ( w, cx, it)
@@ -2815,11 +2815,11 @@ fn item_static(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Static
2815
2815
fn item_function ( w : & mut Buffer , cx : & Context , it : & clean:: Item , f : & clean:: Function ) {
2816
2816
let header_len = format ! (
2817
2817
"{}{}{}{}{:#}fn {}{:#}" ,
2818
- VisSpace ( & it. visibility) ,
2819
- ConstnessSpace ( f. header. constness) ,
2820
- UnsafetySpace ( f. header. unsafety) ,
2821
- AsyncSpace ( f. header. asyncness) ,
2822
- AbiSpace ( f. header. abi) ,
2818
+ it. visibility. print_with_space ( ) ,
2819
+ f. header. constness. print_with_space ( ) ,
2820
+ f. header. unsafety. print_with_space ( ) ,
2821
+ f. header. asyncness. print_with_space ( ) ,
2822
+ print_abi_with_space ( f. header. abi) ,
2823
2823
it. name. as_ref( ) . unwrap( ) ,
2824
2824
f. generics. print( )
2825
2825
) . len ( ) ;
@@ -2828,11 +2828,11 @@ fn item_function(w: &mut Buffer, cx: &Context, it: &clean::Item, f: &clean::Func
2828
2828
write ! ( w,
2829
2829
"{vis}{constness}{unsafety}{asyncness}{abi}fn \
2830
2830
{name}{generics}{decl}{where_clause}</pre>",
2831
- vis = VisSpace ( & it. visibility) ,
2832
- constness = ConstnessSpace ( f. header. constness) ,
2833
- unsafety = UnsafetySpace ( f. header. unsafety) ,
2834
- asyncness = AsyncSpace ( f. header. asyncness) ,
2835
- abi = AbiSpace ( f. header. abi) ,
2831
+ vis = it. visibility. print_with_space ( ) ,
2832
+ constness = f. header. constness. print_with_space ( ) ,
2833
+ unsafety = f. header. unsafety. print_with_space ( ) ,
2834
+ asyncness = f. header. asyncness. print_with_space ( ) ,
2835
+ abi = print_abi_with_space ( f. header. abi) ,
2836
2836
name = it. name. as_ref( ) . unwrap( ) ,
2837
2837
generics = f. generics. print( ) ,
2838
2838
where_clause = WhereClause { gens: & f. generics, indent: 0 , end_newline: true } ,
@@ -2913,8 +2913,8 @@ fn item_trait(
2913
2913
write ! ( w, "<pre class='rust trait'>" ) ;
2914
2914
render_attributes ( w, it, true ) ;
2915
2915
write ! ( w, "{}{}{}trait {}{}{}" ,
2916
- VisSpace ( & it. visibility) ,
2917
- UnsafetySpace ( t. unsafety) ,
2916
+ it. visibility. print_with_space ( ) ,
2917
+ t. unsafety. print_with_space ( ) ,
2918
2918
if t. is_auto { "auto " } else { "" } ,
2919
2919
it. name. as_ref( ) . unwrap( ) ,
2920
2920
t. generics. print( ) ,
@@ -3175,7 +3175,7 @@ fn assoc_const(w: &mut Buffer,
3175
3175
extra : & str ) {
3176
3176
write ! ( w, "{}{}const <a href='{}' class=\" constant\" ><b>{}</b></a>: {}" ,
3177
3177
extra,
3178
- VisSpace ( & it. visibility) ,
3178
+ it. visibility. print_with_space ( ) ,
3179
3179
naive_assoc_href( it, link) ,
3180
3180
it. name. as_ref( ) . unwrap( ) ,
3181
3181
ty. print( ) ) ;
@@ -3240,12 +3240,12 @@ fn render_assoc_item(w: &mut Buffer,
3240
3240
} ;
3241
3241
let mut header_len = format ! (
3242
3242
"{}{}{}{}{}{:#}fn {}{:#}" ,
3243
- VisSpace ( & meth. visibility) ,
3244
- ConstnessSpace ( header. constness) ,
3245
- UnsafetySpace ( header. unsafety) ,
3246
- AsyncSpace ( header. asyncness) ,
3247
- DefaultSpace ( meth. is_default( ) ) ,
3248
- AbiSpace ( header. abi) ,
3243
+ meth. visibility. print_with_space ( ) ,
3244
+ header. constness. print_with_space ( ) ,
3245
+ header. unsafety. print_with_space ( ) ,
3246
+ header. asyncness. print_with_space ( ) ,
3247
+ print_default_space ( meth. is_default( ) ) ,
3248
+ print_abi_with_space ( header. abi) ,
3249
3249
name,
3250
3250
g. print( )
3251
3251
) . len ( ) ;
@@ -3259,12 +3259,12 @@ fn render_assoc_item(w: &mut Buffer,
3259
3259
write ! ( w, "{}{}{}{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
3260
3260
{generics}{decl}{where_clause}",
3261
3261
if parent == ItemType :: Trait { " " } else { "" } ,
3262
- VisSpace ( & meth. visibility) ,
3263
- ConstnessSpace ( header. constness) ,
3264
- UnsafetySpace ( header. unsafety) ,
3265
- AsyncSpace ( header. asyncness) ,
3266
- DefaultSpace ( meth. is_default( ) ) ,
3267
- AbiSpace ( header. abi) ,
3262
+ meth. visibility. print_with_space ( ) ,
3263
+ header. constness. print_with_space ( ) ,
3264
+ header. unsafety. print_with_space ( ) ,
3265
+ header. asyncness. print_with_space ( ) ,
3266
+ print_default_space ( meth. is_default( ) ) ,
3267
+ print_abi_with_space ( header. abi) ,
3268
3268
href = href,
3269
3269
name = name,
3270
3270
generics = g. print( ) ,
@@ -3399,7 +3399,7 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum) {
3399
3399
write ! ( w, "<pre class='rust enum'>" ) ;
3400
3400
render_attributes ( w, it, true ) ;
3401
3401
write ! ( w, "{}enum {}{}{}" ,
3402
- VisSpace ( & it. visibility) ,
3402
+ it. visibility. print_with_space ( ) ,
3403
3403
it. name. as_ref( ) . unwrap( ) ,
3404
3404
e. generics. print( ) ,
3405
3405
WhereClause { gens: & e. generics, indent: 0 , end_newline: true } ) ;
@@ -3588,7 +3588,7 @@ fn render_struct(w: &mut Buffer, it: &clean::Item,
3588
3588
tab : & str ,
3589
3589
structhead : bool ) {
3590
3590
write ! ( w, "{}{}{}" ,
3591
- VisSpace ( & it. visibility) ,
3591
+ it. visibility. print_with_space ( ) ,
3592
3592
if structhead { "struct " } else { "" } ,
3593
3593
it. name. as_ref( ) . unwrap( ) ) ;
3594
3594
if let Some ( g) = g {
@@ -3605,7 +3605,7 @@ fn render_struct(w: &mut Buffer, it: &clean::Item,
3605
3605
if let clean:: StructFieldItem ( ref ty) = field. inner {
3606
3606
write ! ( w, "\n {} {}{}: {}," ,
3607
3607
tab,
3608
- VisSpace ( & field. visibility) ,
3608
+ field. visibility. print_with_space ( ) ,
3609
3609
field. name. as_ref( ) . unwrap( ) ,
3610
3610
ty. print( ) ) ;
3611
3611
has_visible_fields = true ;
@@ -3635,7 +3635,7 @@ fn render_struct(w: &mut Buffer, it: &clean::Item,
3635
3635
write ! ( w, "_" )
3636
3636
}
3637
3637
clean:: StructFieldItem ( ref ty) => {
3638
- write ! ( w, "{}{}" , VisSpace ( & field. visibility) , ty. print( ) )
3638
+ write ! ( w, "{}{}" , field. visibility. print_with_space ( ) , ty. print( ) )
3639
3639
}
3640
3640
_ => unreachable ! ( )
3641
3641
}
@@ -3662,7 +3662,7 @@ fn render_union(w: &mut Buffer, it: &clean::Item,
3662
3662
tab : & str ,
3663
3663
structhead : bool ) {
3664
3664
write ! ( w, "{}{}{}" ,
3665
- VisSpace ( & it. visibility) ,
3665
+ it. visibility. print_with_space ( ) ,
3666
3666
if structhead { "union " } else { "" } ,
3667
3667
it. name. as_ref( ) . unwrap( ) ) ;
3668
3668
if let Some ( g) = g {
@@ -3674,7 +3674,7 @@ fn render_union(w: &mut Buffer, it: &clean::Item,
3674
3674
for field in fields {
3675
3675
if let clean:: StructFieldItem ( ref ty) = field. inner {
3676
3676
write ! ( w, " {}{}: {},\n {}" ,
3677
- VisSpace ( & field. visibility) ,
3677
+ field. visibility. print_with_space ( ) ,
3678
3678
field. name. as_ref( ) . unwrap( ) ,
3679
3679
ty. print( ) ,
3680
3680
tab) ;
@@ -4186,7 +4186,7 @@ fn item_foreign_type(w: &mut Buffer, cx: &Context, it: &clean::Item) {
4186
4186
write ! (
4187
4187
w,
4188
4188
" {}type {};\n }}</pre>" ,
4189
- VisSpace ( & it. visibility) ,
4189
+ it. visibility. print_with_space ( ) ,
4190
4190
it. name. as_ref( ) . unwrap( ) ,
4191
4191
) ;
4192
4192
0 commit comments