@@ -2,7 +2,6 @@ use std::cmp::Ordering;
2
2
use std:: fmt;
3
3
use std:: fmt:: { Display , Write } ;
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 ;
@@ -499,11 +498,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
499
498
class = myitem. type_( ) ,
500
499
unsafety_flag = unsafety_flag,
501
500
href = item_path( myitem. type_( ) , myitem. name. unwrap( ) . as_str( ) ) ,
502
- title = [ myitem. type_( ) . to_string( ) , full_path( cx, myitem) ]
503
- . iter( )
504
- . filter_map( |s| if !s. is_empty( ) { Some ( s. as_str( ) ) } else { None } )
505
- . collect:: <Vec <_>>( )
506
- . join( " " ) ,
501
+ title = format_args!( "{} {}" , myitem. type_( ) , full_path( cx, myitem) ) ,
507
502
) ;
508
503
}
509
504
}
@@ -883,7 +878,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
883
878
write ! (
884
879
w,
885
880
"<div class=\" stab must_implement\" >At least one of the `{}` methods is required.</div>" ,
886
- list. iter( ) . join ( "`, `" )
881
+ fmt :: from_fn ( |f| list. iter( ) . joined ( "`, `" , f ) )
887
882
) ;
888
883
}
889
884
@@ -1129,18 +1124,15 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
1129
1124
js_src_path. extend ( cx. current . iter ( ) . copied ( ) ) ;
1130
1125
js_src_path. push_fmt ( format_args ! ( "{}.{}.js" , it. type_( ) , it. name. unwrap( ) ) ) ;
1131
1126
}
1132
- let extern_crates = extern_crates
1133
- . into_iter ( )
1134
- . map ( |cnum| tcx. crate_name ( cnum) . to_string ( ) )
1135
- . collect :: < Vec < _ > > ( )
1136
- . join ( "," ) ;
1137
- let ( extern_before, extern_after) =
1138
- if extern_crates. is_empty ( ) { ( "" , "" ) } else { ( " data-ignore-extern-crates=\" " , "\" " ) } ;
1139
- write ! (
1140
- w,
1141
- "<script src=\" {src}\" {extern_before}{extern_crates}{extern_after} async></script>" ,
1142
- src = js_src_path. finish( ) ,
1143
- ) ;
1127
+ let extern_crates = fmt:: from_fn ( |f| {
1128
+ if !extern_crates. is_empty ( ) {
1129
+ f. write_str ( " data-ignore-extern-crates=\" " ) ?;
1130
+ extern_crates. iter ( ) . map ( |& cnum| tcx. crate_name ( cnum) ) . joined ( "," , f) ?;
1131
+ f. write_str ( "\" " ) ?;
1132
+ }
1133
+ Ok ( ( ) )
1134
+ } ) ;
1135
+ write ! ( w, "<script src=\" {src}\" {extern_crates} async></script>" , src = js_src_path. finish( ) , ) ;
1144
1136
}
1145
1137
1146
1138
fn item_trait_alias (
@@ -1351,7 +1343,7 @@ fn item_type_alias(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean
1351
1343
. collect ( ) ;
1352
1344
js_src_path. extend ( target_fqp[ ..target_fqp. len ( ) - 1 ] . iter ( ) . copied ( ) ) ;
1353
1345
js_src_path. push_fmt ( format_args ! ( "{target_type}.{}.js" , target_fqp. last( ) . unwrap( ) ) ) ;
1354
- let self_path = self_fqp. iter ( ) . map ( Symbol :: as_str ) . collect :: < Vec < & str > > ( ) . join ( "::" ) ;
1346
+ let self_path = fmt :: from_fn ( |f| self_fqp. iter ( ) . joined ( "::" , f ) ) ;
1355
1347
write ! (
1356
1348
w,
1357
1349
"<script src=\" {src}\" data-self-path=\" {self_path}\" async></script>" ,
@@ -2290,18 +2282,29 @@ fn render_struct_fields(
2290
2282
{
2291
2283
write ! ( w, "<span class=\" comment\" >/* private fields */</span>" ) ;
2292
2284
} else {
2293
- for ( i, field) in fields. iter ( ) . enumerate ( ) {
2294
- if i > 0 {
2295
- w. write_str ( ", " ) ;
2296
- }
2297
- match field. kind {
2298
- clean:: StrippedItem ( box clean:: StructFieldItem ( ..) ) => write ! ( w, "_" ) ,
2299
- clean:: StructFieldItem ( ref ty) => {
2300
- write ! ( w, "{}{}" , visibility_print_with_space( field, cx) , ty. print( cx) , )
2301
- }
2302
- _ => unreachable ! ( ) ,
2303
- }
2304
- }
2285
+ write ! (
2286
+ w,
2287
+ "{}" ,
2288
+ fmt:: from_fn( |f| fields
2289
+ . iter( )
2290
+ . map( |field| {
2291
+ fmt:: from_fn( |f| match field. kind {
2292
+ clean:: StrippedItem ( box clean:: StructFieldItem ( ..) ) => {
2293
+ write!( f, "_" )
2294
+ }
2295
+ clean:: StructFieldItem ( ref ty) => {
2296
+ write!(
2297
+ f,
2298
+ "{}{}" ,
2299
+ visibility_print_with_space( field, cx) ,
2300
+ ty. print( cx)
2301
+ )
2302
+ }
2303
+ _ => unreachable!( ) ,
2304
+ } )
2305
+ } )
2306
+ . joined( ", " , f) )
2307
+ ) ;
2305
2308
}
2306
2309
w. write_str ( ")" ) ;
2307
2310
if let Some ( g) = g {
0 commit comments