11use std:: cell:: RefCell ;
22use std:: collections:: BTreeMap ;
3+ use std:: fmt:: Write as _;
34use std:: io;
45use std:: path:: { Path , PathBuf } ;
56use std:: sync:: mpsc:: { Receiver , channel} ;
@@ -267,16 +268,20 @@ impl<'tcx> Context<'tcx> {
267268 path. push_str ( name. as_str ( ) ) ;
268269 path. push ( '/' ) ;
269270 }
270- path . push_str ( & item_path ( ty, names. last ( ) . unwrap ( ) . as_str ( ) ) ) ;
271+ let _ = write ! ( path , "{}" , item_path( ty, names. last( ) . unwrap( ) . as_str( ) ) ) ;
271272 match self . shared . redirections {
272273 Some ( ref redirections) => {
273274 let mut current_path = String :: new ( ) ;
274275 for name in & self . current {
275276 current_path. push_str ( name. as_str ( ) ) ;
276277 current_path. push ( '/' ) ;
277278 }
278- current_path. push_str ( & item_path ( ty, names. last ( ) . unwrap ( ) . as_str ( ) ) ) ;
279- redirections. borrow_mut ( ) . insert ( current_path, path) ;
279+ let _ = write ! (
280+ current_path,
281+ "{}" ,
282+ item_path( ty, names. last( ) . unwrap( ) . as_str( ) )
283+ ) ;
284+ redirections. borrow_mut ( ) . insert ( current_path, path. to_string ( ) ) ;
280285 }
281286 None => {
282287 return layout:: redirect ( & format ! (
@@ -851,9 +856,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
851856 if !buf. is_empty ( ) {
852857 let name = item. name . as_ref ( ) . unwrap ( ) ;
853858 let item_type = item. type_ ( ) ;
854- let file_name = & item_path ( item_type, name. as_str ( ) ) ;
859+ let file_name = item_path ( item_type, name. as_str ( ) ) . to_string ( ) ;
855860 self . shared . ensure_dir ( & self . dst ) ?;
856- let joint_dst = self . dst . join ( file_name) ;
861+ let joint_dst = self . dst . join ( & file_name) ;
857862 self . shared . fs . write ( joint_dst, buf) ?;
858863
859864 if !self . info . render_redirect_pages {
@@ -870,7 +875,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
870875 format ! ( "{crate_name}/{file_name}" ) ,
871876 ) ;
872877 } else {
873- let v = layout:: redirect ( file_name) ;
878+ let v = layout:: redirect ( & file_name) ;
874879 let redir_dst = self . dst . join ( redir_name) ;
875880 self . shared . fs . write ( redir_dst, v) ?;
876881 }
0 commit comments