1
1
use std:: cell:: RefCell ;
2
2
use std:: collections:: BTreeMap ;
3
+ use std:: fmt:: { self , Write as _} ;
4
+ use std:: io;
3
5
use std:: path:: { Path , PathBuf } ;
4
6
use std:: sync:: mpsc:: { Receiver , channel} ;
5
- use std:: { fmt, io} ;
6
7
7
8
use rinja:: Template ;
8
9
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap , FxIndexSet } ;
@@ -270,16 +271,20 @@ impl<'tcx> Context<'tcx> {
270
271
path. push_str ( name. as_str ( ) ) ;
271
272
path. push ( '/' ) ;
272
273
}
273
- path . push_str ( & item_path ( ty, names. last ( ) . unwrap ( ) . as_str ( ) ) ) ;
274
+ let _ = write ! ( path , "{}" , item_path( ty, names. last( ) . unwrap( ) . as_str( ) ) ) ;
274
275
match self . shared . redirections {
275
276
Some ( ref redirections) => {
276
277
let mut current_path = String :: new ( ) ;
277
278
for name in & self . current {
278
279
current_path. push_str ( name. as_str ( ) ) ;
279
280
current_path. push ( '/' ) ;
280
281
}
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 ( ) ) ;
283
288
}
284
289
None => {
285
290
return layout:: redirect ( & format ! (
@@ -854,9 +859,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
854
859
if !buf. is_empty ( ) {
855
860
let name = item. name . as_ref ( ) . unwrap ( ) ;
856
861
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 ( ) ;
858
863
self . shared . ensure_dir ( & self . dst ) ?;
859
- let joint_dst = self . dst . join ( file_name) ;
864
+ let joint_dst = self . dst . join ( & file_name) ;
860
865
self . shared . fs . write ( joint_dst, buf) ?;
861
866
862
867
if !self . info . render_redirect_pages {
@@ -873,7 +878,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
873
878
format ! ( "{crate_name}/{file_name}" ) ,
874
879
) ;
875
880
} else {
876
- let v = layout:: redirect ( file_name) ;
881
+ let v = layout:: redirect ( & file_name) ;
877
882
let redir_dst = self . dst . join ( redir_name) ;
878
883
self . shared . fs . write ( redir_dst, v) ?;
879
884
}
0 commit comments