1
1
use std:: cell:: RefCell ;
2
2
use std:: collections:: BTreeMap ;
3
+ use std:: fmt:: Write as _;
3
4
use std:: io;
4
5
use std:: path:: { Path , PathBuf } ;
5
6
use std:: sync:: mpsc:: { Receiver , channel} ;
@@ -267,16 +268,20 @@ impl<'tcx> Context<'tcx> {
267
268
path. push_str ( name. as_str ( ) ) ;
268
269
path. push ( '/' ) ;
269
270
}
270
- path . push_str ( & item_path ( ty, names. last ( ) . unwrap ( ) . as_str ( ) ) ) ;
271
+ let _ = write ! ( path , "{}" , item_path( ty, names. last( ) . unwrap( ) . as_str( ) ) ) ;
271
272
match self . shared . redirections {
272
273
Some ( ref redirections) => {
273
274
let mut current_path = String :: new ( ) ;
274
275
for name in & self . current {
275
276
current_path. push_str ( name. as_str ( ) ) ;
276
277
current_path. push ( '/' ) ;
277
278
}
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 ( ) ) ;
280
285
}
281
286
None => {
282
287
return layout:: redirect ( & format ! (
@@ -851,9 +856,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
851
856
if !buf. is_empty ( ) {
852
857
let name = item. name . as_ref ( ) . unwrap ( ) ;
853
858
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 ( ) ;
855
860
self . shared . ensure_dir ( & self . dst ) ?;
856
- let joint_dst = self . dst . join ( file_name) ;
861
+ let joint_dst = self . dst . join ( & file_name) ;
857
862
self . shared . fs . write ( joint_dst, buf) ?;
858
863
859
864
if !self . info . render_redirect_pages {
@@ -870,7 +875,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
870
875
format ! ( "{crate_name}/{file_name}" ) ,
871
876
) ;
872
877
} else {
873
- let v = layout:: redirect ( file_name) ;
878
+ let v = layout:: redirect ( & file_name) ;
874
879
let redir_dst = self . dst . join ( redir_name) ;
875
880
self . shared . fs . write ( redir_dst, v) ?;
876
881
}
0 commit comments