13
13
//! --resource-suffix flag and are emitted when --emit-type is empty (default)
14
14
//! or contains "invocation-specific".
15
15
16
+ use std:: borrow:: Cow ;
16
17
use std:: cell:: RefCell ;
17
18
use std:: ffi:: OsString ;
18
19
use std:: fs:: File ;
@@ -284,7 +285,7 @@ enum CrateInfoVersion {
284
285
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
285
286
#[ serde( transparent) ]
286
287
struct PartsAndLocations < P > {
287
- parts : Vec < ( PathBuf , P ) > ,
288
+ parts : Vec < ( Cow < ' static , Path > , P ) > ,
288
289
}
289
290
290
291
impl < P > Default for PartsAndLocations < P > {
@@ -294,12 +295,12 @@ impl<P> Default for PartsAndLocations<P> {
294
295
}
295
296
296
297
impl < T , U > PartsAndLocations < Part < T , U > > {
297
- fn push ( & mut self , path : PathBuf , item : U ) {
298
- self . parts . push ( ( path, Part { _artifact : PhantomData , item } ) ) ;
298
+ fn push ( & mut self , path : impl Into < Cow < ' static , Path > > , item : U ) {
299
+ self . parts . push ( ( path. into ( ) , Part { _artifact : PhantomData , item } ) ) ;
299
300
}
300
301
301
302
/// Singleton part, one file
302
- fn with ( path : PathBuf , part : U ) -> Self {
303
+ fn with ( path : impl Into < Cow < ' static , Path > > , part : U ) -> Self {
303
304
let mut ret = Self :: default ( ) ;
304
305
ret. push ( path, part) ;
305
306
ret
@@ -452,7 +453,7 @@ impl CratesIndexPart {
452
453
"<li><a href=\" {trailing_slash}index.html\" >{crate_name}</a></li>" ,
453
454
trailing_slash = ensure_trailing_slash( crate_name) ,
454
455
) ;
455
- ret. push ( path. to_path_buf ( ) , part) ;
456
+ ret. push ( path, part) ;
456
457
}
457
458
Ok ( ret)
458
459
}
@@ -596,7 +597,6 @@ impl TypeAliasPart {
596
597
cx,
597
598
} ;
598
599
DocVisitor :: visit_crate ( & mut type_impl_collector, krate) ;
599
- let cx = type_impl_collector. cx ;
600
600
let aliased_types = type_impl_collector. aliased_types ;
601
601
for aliased_type in aliased_types. values ( ) {
602
602
let impls = aliased_type. impl_ . values ( ) . filter_map (
@@ -608,7 +608,7 @@ impl TypeAliasPart {
608
608
for & ( type_alias_fqp, type_alias_item) in type_aliases {
609
609
cx. id_map . borrow_mut ( ) . clear ( ) ;
610
610
cx. deref_id_map . borrow_mut ( ) . clear ( ) ;
611
- let type_alias_fqp = ( * type_alias_fqp) . iter ( ) . join ( "::" ) ;
611
+ let type_alias_fqp = type_alias_fqp. iter ( ) . join ( "::" ) ;
612
612
if let Some ( ret) = & mut ret {
613
613
ret. aliases . push ( type_alias_fqp) ;
614
614
} else {
0 commit comments