@@ -2,7 +2,6 @@ use std::cmp::Ordering;
22use std:: fmt;
33use std:: fmt:: Display ;
44
5- use itertools:: Itertools ;
65use rinja:: Template ;
76use rustc_abi:: VariantIdx ;
87use rustc_data_structures:: captures:: Captures ;
@@ -514,11 +513,7 @@ fn item_module(w: &mut String, cx: &Context<'_>, item: &clean::Item, items: &[cl
514513 class = myitem. type_( ) ,
515514 unsafety_flag = unsafety_flag,
516515 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) ) ,
522517 ) ,
523518 ) ;
524519 }
@@ -915,7 +910,7 @@ fn item_trait(w: &mut String, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
915910 w,
916911 format_args ! (
917912 "<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 ) )
919914 ) ,
920915 ) ;
921916 }
@@ -1168,17 +1163,18 @@ fn item_trait(w: &mut String, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
11681163 js_src_path. extend ( cx. current . iter ( ) . copied ( ) ) ;
11691164 js_src_path. push_fmt ( format_args ! ( "{}.{}.js" , it. type_( ) , it. name. unwrap( ) ) ) ;
11701165 }
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+ } ) ;
11781174 write_str (
11791175 w,
11801176 format_args ! (
1181- "<script src=\" {src}\" {extern_before}{ extern_crates}{extern_after } async></script>" ,
1177+ "<script src=\" {src}\" {extern_crates} async></script>" ,
11821178 src = js_src_path. finish( )
11831179 ) ,
11841180 ) ;
@@ -1400,7 +1396,7 @@ fn item_type_alias(w: &mut String, cx: &Context<'_>, it: &clean::Item, t: &clean
14001396 . collect ( ) ;
14011397 js_src_path. extend ( target_fqp[ ..target_fqp. len ( ) - 1 ] . iter ( ) . copied ( ) ) ;
14021398 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 ) ) ;
14041400 write_str (
14051401 w,
14061402 format_args ! (
@@ -2369,27 +2365,31 @@ fn render_struct_fields(
23692365 {
23702366 write_str ( w, format_args ! ( "<span class=\" comment\" >/* private fields */</span>" ) ) ;
23712367 } 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+ ) ;
23932393 }
23942394 w. push_str ( ")" ) ;
23952395 if let Some ( g) = g {
0 commit comments