11use std:: ffi:: OsStr ;
2+ use std:: fmt;
23use std:: fs:: { self , File } ;
34use std:: io:: prelude:: * ;
45use std:: io:: { self , BufReader } ;
@@ -563,7 +564,7 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
563564 }
564565
565566 impl Implementor {
566- fn to_js_string ( & self ) -> String {
567+ fn to_js_string ( & self ) -> impl fmt :: Display + ' _ {
567568 fn single_quote_string ( s : & str ) -> String {
568569 let mut result = String :: with_capacity ( s. len ( ) + 2 ) ;
569570 result. push_str ( "'" ) ;
@@ -577,16 +578,21 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
577578 result. push_str ( "'" ) ;
578579 result
579580 }
580- let text_esc = single_quote_string ( & self . text ) ;
581- if self . synthetic {
582- let types = self . types . iter ( ) . map ( |type_| single_quote_string ( type_) ) . join ( "," ) ;
583- // use `1` to represent a synthetic, because it's fewer bytes than `true`
584- format ! ( "[{text_esc},1,[{types}]]" )
585- } else {
586- // The types list is only used for synthetic impls.
587- // If this changes, `main.js` and `write_shared.rs` both need changed.
588- format ! ( "[{text_esc}]" )
589- }
581+ crate :: html:: format:: display_fn ( |f| {
582+ let text_esc = single_quote_string ( & self . text ) ;
583+ if self . synthetic {
584+ let types = crate :: html:: format:: comma_sep (
585+ self . types . iter ( ) . map ( |type_| single_quote_string ( type_) ) ,
586+ false ,
587+ ) ;
588+ // use `1` to represent a synthetic, because it's fewer bytes than `true`
589+ write ! ( f, "[{text_esc},1,[{types}]]" )
590+ } else {
591+ // The types list is only used for synthetic impls.
592+ // If this changes, `main.js` and `write_shared.rs` both need changed.
593+ write ! ( f, "[{text_esc}]" )
594+ }
595+ } )
590596 }
591597 }
592598
@@ -622,7 +628,10 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
622628 let implementors = format ! (
623629 r#""{}":[{}]"# ,
624630 krate. name( cx. tcx( ) ) ,
625- implementors. iter( ) . map( Implementor :: to_js_string) . join( "," )
631+ crate :: html:: format:: comma_sep(
632+ implementors. iter( ) . map( Implementor :: to_js_string) ,
633+ false
634+ )
626635 ) ;
627636
628637 let mut mydst = dst. clone ( ) ;
0 commit comments