@@ -109,6 +109,10 @@ impl Buffer {
109
109
self . buffer
110
110
}
111
111
112
+ pub ( crate ) fn push ( & mut self , c : char ) {
113
+ self . buffer . push ( c) ;
114
+ }
115
+
112
116
pub ( crate ) fn push_str ( & mut self , s : & str ) {
113
117
self . buffer . push_str ( s) ;
114
118
}
@@ -451,9 +455,9 @@ impl clean::GenericBound {
451
455
hir:: TraitBoundModifier :: MaybeConst => "" ,
452
456
} ;
453
457
if f. alternate ( ) {
454
- write ! ( f, "{modifier_str}{:#}" , ty. print( cx) )
458
+ write ! ( f, "{modifier_str}{ty :#}" , ty = ty. print( cx) )
455
459
} else {
456
- write ! ( f, "{modifier_str}{}" , ty. print( cx) )
460
+ write ! ( f, "{modifier_str}{ty }" , ty = ty. print( cx) )
457
461
}
458
462
}
459
463
} )
@@ -631,14 +635,14 @@ fn generate_macro_def_id_path(
631
635
let url = match cache. extern_locations [ & def_id. krate ] {
632
636
ExternalLocation :: Remote ( ref s) => {
633
637
// `ExternalLocation::Remote` always end with a `/`.
634
- format ! ( "{s}{}" , path. iter( ) . map( |p| p. as_str( ) ) . join( "/" ) )
638
+ format ! ( "{s}{path }" , path = path. iter( ) . map( |p| p. as_str( ) ) . join( "/" ) )
635
639
}
636
640
ExternalLocation :: Local => {
637
641
// `root_path` always end with a `/`.
638
642
format ! (
639
- "{}{crate_name}/{}" ,
640
- root_path. unwrap_or( "" ) ,
641
- path. iter( ) . map( |p| p. as_str( ) ) . join( "/" )
643
+ "{root_path }{crate_name}/{path }" ,
644
+ root_path = root_path . unwrap_or( "" ) ,
645
+ path = path . iter( ) . map( |p| p. as_str( ) ) . join( "/" )
642
646
)
643
647
}
644
648
ExternalLocation :: Unknown => {
@@ -827,17 +831,17 @@ fn resolved_path<'cx>(
827
831
let path = if use_absolute {
828
832
if let Ok ( ( _, _, fqp) ) = href ( did, cx) {
829
833
format ! (
830
- "{}::{}" ,
831
- join_with_double_colon( & fqp[ ..fqp. len( ) - 1 ] ) ,
832
- anchor( did, * fqp. last( ) . unwrap( ) , cx)
834
+ "{path }::{anchor }" ,
835
+ path = join_with_double_colon( & fqp[ ..fqp. len( ) - 1 ] ) ,
836
+ anchor = anchor ( did, * fqp. last( ) . unwrap( ) , cx)
833
837
)
834
838
} else {
835
839
last. name . to_string ( )
836
840
}
837
841
} else {
838
842
anchor ( did, last. name , cx) . to_string ( )
839
843
} ;
840
- write ! ( w, "{path}{}" , last. args. print( cx) ) ?;
844
+ write ! ( w, "{path}{args }" , args = last. args. print( cx) ) ?;
841
845
}
842
846
Ok ( ( ) )
843
847
}
@@ -945,8 +949,8 @@ pub(crate) fn anchor<'a, 'cx: 'a>(
945
949
if let Ok ( ( url, short_ty, fqp) ) = parts {
946
950
write ! (
947
951
f,
948
- r#"<a class="{short_ty}" href="{url}" title="{short_ty} {}">{text}</a>"# ,
949
- join_with_double_colon( & fqp) ,
952
+ r#"<a class="{short_ty}" href="{url}" title="{short_ty} {path }">{text}</a>"# ,
953
+ path = join_with_double_colon( & fqp) ,
950
954
)
951
955
} else {
952
956
f. write_str ( text. as_str ( ) )
@@ -1080,9 +1084,9 @@ fn fmt_type<'cx>(
1080
1084
1081
1085
if matches ! ( * * t, clean:: Generic ( _) ) || t. is_assoc_ty ( ) {
1082
1086
let text = if f. alternate ( ) {
1083
- format ! ( "*{m} {:#}" , t. print( cx) )
1087
+ format ! ( "*{m} {ty :#}" , ty = t. print( cx) )
1084
1088
} else {
1085
- format ! ( "*{m} {}" , t. print( cx) )
1089
+ format ! ( "*{m} {ty }" , ty = t. print( cx) )
1086
1090
} ;
1087
1091
primitive_link ( f, clean:: PrimitiveType :: RawPointer , & text, cx)
1088
1092
} else {
@@ -1440,11 +1444,20 @@ impl clean::FnDecl {
1440
1444
clean:: SelfValue => {
1441
1445
write ! ( f, "self" ) ?;
1442
1446
}
1443
- clean:: SelfBorrowed ( Some ( ref lt) , mtbl) => {
1444
- write ! ( f, "{amp}{} {}self" , lt. print( ) , mtbl. print_with_space( ) ) ?;
1447
+ clean:: SelfBorrowed ( Some ( ref lt) , mutability) => {
1448
+ write ! (
1449
+ f,
1450
+ "{amp}{lifetime} {mutability}self" ,
1451
+ lifetime = lt. print( ) ,
1452
+ mutability = mutability. print_with_space( ) ,
1453
+ ) ?;
1445
1454
}
1446
- clean:: SelfBorrowed ( None , mtbl) => {
1447
- write ! ( f, "{amp}{}self" , mtbl. print_with_space( ) ) ?;
1455
+ clean:: SelfBorrowed ( None , mutability) => {
1456
+ write ! (
1457
+ f,
1458
+ "{amp}{mutability}self" ,
1459
+ mutability = mutability. print_with_space( ) ,
1460
+ ) ?;
1448
1461
}
1449
1462
clean:: SelfExplicit ( ref typ) => {
1450
1463
write ! ( f, "self: " ) ?;
@@ -1627,7 +1640,7 @@ impl clean::Import {
1627
1640
if name == self . source . path . last ( ) {
1628
1641
write ! ( f, "use {};" , self . source. print( cx) )
1629
1642
} else {
1630
- write ! ( f, "use {} as {name};" , self . source. print( cx) )
1643
+ write ! ( f, "use {source } as {name};" , source = self . source. print( cx) )
1631
1644
}
1632
1645
}
1633
1646
clean:: ImportKind :: Glob => {
0 commit comments