@@ -264,35 +264,23 @@ impl IndexPackage<'_> {
264264 fn to_summary ( & self , source_id : SourceId ) -> CargoResult < Summary > {
265265 // ****CAUTION**** Please be extremely careful with returning errors, see
266266 // `IndexSummary::parse` for details
267- let pkgid = PackageId :: new (
268- InternedString :: new ( & self . name ) ,
269- self . vers . clone ( ) ,
270- source_id,
271- ) ;
267+ let pkgid = PackageId :: new ( self . name . as_ref ( ) . into ( ) , self . vers . clone ( ) , source_id) ;
272268 let deps = self
273269 . deps
274270 . iter ( )
275271 . map ( |dep| dep. clone ( ) . into_dep ( source_id) )
276272 . collect :: < CargoResult < Vec < _ > > > ( ) ?;
277273 let mut features = self . features . clone ( ) ;
278- if let Some ( features2) = & self . features2 {
274+ if let Some ( features2) = self . features2 . clone ( ) {
279275 for ( name, values) in features2 {
280- features
281- . entry ( name. clone ( ) )
282- . or_default ( )
283- . extend ( values. iter ( ) . cloned ( ) ) ;
276+ features. entry ( name) . or_default ( ) . extend ( values) ;
284277 }
285278 }
286279 let features = features
287280 . into_iter ( )
288- . map ( |( name, values) | {
289- (
290- InternedString :: new ( & name) ,
291- values. iter ( ) . map ( |v| InternedString :: new ( & v) ) . collect ( ) ,
292- )
293- } )
281+ . map ( |( name, values) | ( name. into ( ) , values. into_iter ( ) . map ( |v| v. into ( ) ) . collect ( ) ) )
294282 . collect :: < BTreeMap < _ , _ > > ( ) ;
295- let links = self . links . as_ref ( ) . map ( |l| InternedString :: new ( & l ) ) ;
283+ let links: Option < InternedString > = self . links . as_ref ( ) . map ( |l| l . as_ref ( ) . into ( ) ) ;
296284 let mut summary = Summary :: new ( pkgid, deps, & features, links, self . rust_version . clone ( ) ) ?;
297285 summary. set_checksum ( self . cksum . clone ( ) ) ;
298286 Ok ( summary)
@@ -849,7 +837,7 @@ impl<'a> RegistryDependency<'a> {
849837 let interned_name = InternedString :: new ( package. as_ref ( ) . unwrap_or ( & name) ) ;
850838 let mut dep = Dependency :: parse ( interned_name, Some ( & req) , id) ?;
851839 if package. is_some ( ) {
852- dep. set_explicit_name_in_toml ( InternedString :: new ( & name) ) ;
840+ dep. set_explicit_name_in_toml ( name) ;
853841 }
854842 let kind = match kind. as_deref ( ) . unwrap_or ( "" ) {
855843 "dev" => DepKind :: Development ,
@@ -883,7 +871,6 @@ impl<'a> RegistryDependency<'a> {
883871 dep. set_artifact ( artifact) ;
884872 }
885873
886- let features = features. iter ( ) . map ( |f| InternedString :: new ( & f) ) ;
887874 dep. set_optional ( optional)
888875 . set_default_features ( default_features)
889876 . set_features ( features)
0 commit comments