11use std:: cell:: RefCell ;
22use std:: collections:: BTreeMap ;
3+ use std:: fmt:: { self , Write as _} ;
4+ use std:: io;
35use std:: path:: { Path , PathBuf } ;
46use std:: sync:: mpsc:: { Receiver , channel} ;
5- use std:: { fmt, io} ;
67
78use rinja:: Template ;
89use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap , FxIndexSet } ;
@@ -270,16 +271,20 @@ impl<'tcx> Context<'tcx> {
270271 path. push_str ( name. as_str ( ) ) ;
271272 path. push ( '/' ) ;
272273 }
273- path . push_str ( & item_path ( ty, names. last ( ) . unwrap ( ) . as_str ( ) ) ) ;
274+ let _ = write ! ( path , "{}" , item_path( ty, names. last( ) . unwrap( ) . as_str( ) ) ) ;
274275 match self . shared . redirections {
275276 Some ( ref redirections) => {
276277 let mut current_path = String :: new ( ) ;
277278 for name in & self . current {
278279 current_path. push_str ( name. as_str ( ) ) ;
279280 current_path. push ( '/' ) ;
280281 }
281- current_path. push_str ( & item_path ( ty, names. last ( ) . unwrap ( ) . as_str ( ) ) ) ;
282- redirections. borrow_mut ( ) . insert ( current_path, path) ;
282+ let _ = write ! (
283+ current_path,
284+ "{}" ,
285+ item_path( ty, names. last( ) . unwrap( ) . as_str( ) )
286+ ) ;
287+ redirections. borrow_mut ( ) . insert ( current_path, path. to_string ( ) ) ;
283288 }
284289 None => {
285290 return layout:: redirect ( & format ! (
@@ -854,9 +859,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
854859 if !buf. is_empty ( ) {
855860 let name = item. name . as_ref ( ) . unwrap ( ) ;
856861 let item_type = item. type_ ( ) ;
857- let file_name = & item_path ( item_type, name. as_str ( ) ) ;
862+ let file_name = item_path ( item_type, name. as_str ( ) ) . to_string ( ) ;
858863 self . shared . ensure_dir ( & self . dst ) ?;
859- let joint_dst = self . dst . join ( file_name) ;
864+ let joint_dst = self . dst . join ( & file_name) ;
860865 self . shared . fs . write ( joint_dst, buf) ?;
861866
862867 if !self . info . render_redirect_pages {
@@ -873,7 +878,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
873878 format ! ( "{crate_name}/{file_name}" ) ,
874879 ) ;
875880 } else {
876- let v = layout:: redirect ( file_name) ;
881+ let v = layout:: redirect ( & file_name) ;
877882 let redir_dst = self . dst . join ( redir_name) ;
878883 self . shared . fs . write ( redir_dst, v) ?;
879884 }
0 commit comments