@@ -2,7 +2,6 @@ use std::cmp::Ordering;
2
2
use std:: fmt;
3
3
use std:: fmt:: Display ;
4
4
5
- use itertools:: Itertools ;
6
5
use rinja:: Template ;
7
6
use rustc_abi:: VariantIdx ;
8
7
use rustc_data_structures:: captures:: Captures ;
@@ -514,11 +513,7 @@ fn item_module(w: &mut String, cx: &Context<'_>, item: &clean::Item, items: &[cl
514
513
class = myitem. type_( ) ,
515
514
unsafety_flag = unsafety_flag,
516
515
href = item_path( myitem. type_( ) , myitem. name. unwrap( ) . as_str( ) ) ,
517
- title = [ myitem. type_( ) . to_string( ) , full_path( cx, myitem) ]
518
- . iter( )
519
- . filter_map( |s| if !s. is_empty( ) { Some ( s. as_str( ) ) } else { None } )
520
- . collect:: <Vec <_>>( )
521
- . join( " " ) ,
516
+ title = format_args!( "{} {}" , myitem. type_( ) , full_path( cx, myitem) ) ,
522
517
) ,
523
518
) ;
524
519
}
@@ -915,7 +910,7 @@ fn item_trait(w: &mut String, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
915
910
w,
916
911
format_args ! (
917
912
"<div class=\" stab must_implement\" >At least one of the `{}` methods is required.</div>" ,
918
- list. iter( ) . join ( "`, `" )
913
+ fmt :: from_fn ( |f| list. iter( ) . joined ( "`, `" , f ) )
919
914
) ,
920
915
) ;
921
916
}
@@ -1168,17 +1163,18 @@ fn item_trait(w: &mut String, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
1168
1163
js_src_path. extend ( cx. current . iter ( ) . copied ( ) ) ;
1169
1164
js_src_path. push_fmt ( format_args ! ( "{}.{}.js" , it. type_( ) , it. name. unwrap( ) ) ) ;
1170
1165
}
1171
- let extern_crates = extern_crates
1172
- . into_iter ( )
1173
- . map ( |cnum| tcx. crate_name ( cnum) . to_string ( ) )
1174
- . collect :: < Vec < _ > > ( )
1175
- . join ( "," ) ;
1176
- let ( extern_before, extern_after) =
1177
- if extern_crates. is_empty ( ) { ( "" , "" ) } else { ( " data-ignore-extern-crates=\" " , "\" " ) } ;
1166
+ let extern_crates = fmt:: from_fn ( |f| {
1167
+ if !extern_crates. is_empty ( ) {
1168
+ f. write_str ( " data-ignore-extern-crates=\" " ) ?;
1169
+ extern_crates. iter ( ) . map ( |& cnum| tcx. crate_name ( cnum) ) . joined ( "," , f) ?;
1170
+ f. write_str ( "\" " ) ?;
1171
+ }
1172
+ Ok ( ( ) )
1173
+ } ) ;
1178
1174
write_str (
1179
1175
w,
1180
1176
format_args ! (
1181
- "<script src=\" {src}\" {extern_before}{ extern_crates}{extern_after } async></script>" ,
1177
+ "<script src=\" {src}\" {extern_crates} async></script>" ,
1182
1178
src = js_src_path. finish( )
1183
1179
) ,
1184
1180
) ;
@@ -1400,7 +1396,7 @@ fn item_type_alias(w: &mut String, cx: &Context<'_>, it: &clean::Item, t: &clean
1400
1396
. collect ( ) ;
1401
1397
js_src_path. extend ( target_fqp[ ..target_fqp. len ( ) - 1 ] . iter ( ) . copied ( ) ) ;
1402
1398
js_src_path. push_fmt ( format_args ! ( "{target_type}.{}.js" , target_fqp. last( ) . unwrap( ) ) ) ;
1403
- let self_path = self_fqp. iter ( ) . map ( Symbol :: as_str ) . collect :: < Vec < & str > > ( ) . join ( "::" ) ;
1399
+ let self_path = fmt :: from_fn ( |f| self_fqp. iter ( ) . joined ( "::" , f ) ) ;
1404
1400
write_str (
1405
1401
w,
1406
1402
format_args ! (
@@ -2369,27 +2365,31 @@ fn render_struct_fields(
2369
2365
{
2370
2366
write_str ( w, format_args ! ( "<span class=\" comment\" >/* private fields */</span>" ) ) ;
2371
2367
} else {
2372
- for ( i, field) in fields. iter ( ) . enumerate ( ) {
2373
- if i > 0 {
2374
- w. push_str ( ", " ) ;
2375
- }
2376
- match field. kind {
2377
- clean:: StrippedItem ( box clean:: StructFieldItem ( ..) ) => {
2378
- write_str ( w, format_args ! ( "_" ) ) ;
2379
- }
2380
- clean:: StructFieldItem ( ref ty) => {
2381
- write_str (
2382
- w,
2383
- format_args ! (
2384
- "{}{}" ,
2385
- visibility_print_with_space( field, cx) ,
2386
- ty. print( cx)
2387
- ) ,
2388
- ) ;
2389
- }
2390
- _ => unreachable ! ( ) ,
2391
- }
2392
- }
2368
+ write_str (
2369
+ w,
2370
+ format_args ! (
2371
+ "{}" ,
2372
+ fmt:: from_fn( |f| fields
2373
+ . iter( )
2374
+ . map( |field| {
2375
+ fmt:: from_fn( |f| match field. kind {
2376
+ clean:: StrippedItem ( box clean:: StructFieldItem ( ..) ) => {
2377
+ write!( f, "_" )
2378
+ }
2379
+ clean:: StructFieldItem ( ref ty) => {
2380
+ write!(
2381
+ f,
2382
+ "{}{}" ,
2383
+ visibility_print_with_space( field, cx) ,
2384
+ ty. print( cx)
2385
+ )
2386
+ }
2387
+ _ => unreachable!( ) ,
2388
+ } )
2389
+ } )
2390
+ . joined( ", " , f) )
2391
+ ) ,
2392
+ ) ;
2393
2393
}
2394
2394
w. push_str ( ")" ) ;
2395
2395
if let Some ( g) = g {
0 commit comments