1313//! --resource-suffix flag and are emitted when --emit-type is empty (default)
1414//! or contains "invocation-specific".
1515
16+ use std:: borrow:: Cow ;
1617use std:: cell:: RefCell ;
1718use std:: ffi:: OsString ;
1819use std:: fs:: File ;
@@ -284,7 +285,7 @@ enum CrateInfoVersion {
284285#[ derive( Serialize , Deserialize , Debug , Clone ) ]
285286#[ serde( transparent) ]
286287struct PartsAndLocations < P > {
287- parts : Vec < ( PathBuf , P ) > ,
288+ parts : Vec < ( Cow < ' static , Path > , P ) > ,
288289}
289290
290291impl < P > Default for PartsAndLocations < P > {
@@ -294,12 +295,12 @@ impl<P> Default for PartsAndLocations<P> {
294295}
295296
296297impl < 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 } ) ) ;
299300 }
300301
301302 /// Singleton part, one file
302- fn with ( path : PathBuf , part : U ) -> Self {
303+ fn with ( path : impl Into < Cow < ' static , Path > > , part : U ) -> Self {
303304 let mut ret = Self :: default ( ) ;
304305 ret. push ( path, part) ;
305306 ret
@@ -452,7 +453,7 @@ impl CratesIndexPart {
452453 "<li><a href=\" {trailing_slash}index.html\" >{crate_name}</a></li>" ,
453454 trailing_slash = ensure_trailing_slash( crate_name) ,
454455 ) ;
455- ret. push ( path. to_path_buf ( ) , part) ;
456+ ret. push ( path, part) ;
456457 }
457458 Ok ( ret)
458459 }
@@ -596,7 +597,6 @@ impl TypeAliasPart {
596597 cx,
597598 } ;
598599 DocVisitor :: visit_crate ( & mut type_impl_collector, krate) ;
599- let cx = type_impl_collector. cx ;
600600 let aliased_types = type_impl_collector. aliased_types ;
601601 for aliased_type in aliased_types. values ( ) {
602602 let impls = aliased_type. impl_ . values ( ) . filter_map (
@@ -608,7 +608,7 @@ impl TypeAliasPart {
608608 for & ( type_alias_fqp, type_alias_item) in type_aliases {
609609 cx. id_map . borrow_mut ( ) . clear ( ) ;
610610 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 ( "::" ) ;
612612 if let Some ( ret) = & mut ret {
613613 ret. aliases . push ( type_alias_fqp) ;
614614 } else {
0 commit comments