@@ -198,7 +198,7 @@ impl IndexSummary {
198198#[ derive( Deserialize , Serialize ) ]
199199pub struct IndexPackage < ' a > {
200200 /// Name of the package.
201- pub name : InternedString ,
201+ pub name : Cow < ' a , str > ,
202202 /// The version of this dependency.
203203 pub vers : Version ,
204204 /// All kinds of direct dependencies of the package, including dev and
@@ -263,7 +263,11 @@ impl IndexPackage<'_> {
263263 fn to_summary ( & self , source_id : SourceId ) -> CargoResult < Summary > {
264264 // ****CAUTION**** Please be extremely careful with returning errors, see
265265 // `IndexSummary::parse` for details
266- let pkgid = PackageId :: new ( self . name . into ( ) , self . vers . clone ( ) , source_id) ;
266+ let pkgid = PackageId :: new (
267+ InternedString :: new ( & self . name ) ,
268+ self . vers . clone ( ) ,
269+ source_id,
270+ ) ;
267271 let deps = self
268272 . deps
269273 . iter ( )
@@ -288,8 +292,8 @@ impl IndexPackage<'_> {
288292}
289293
290294#[ derive( Deserialize , Serialize ) ]
291- struct IndexPackageMinimum {
292- name : InternedString ,
295+ struct IndexPackageMinimum < ' a > {
296+ name : Cow < ' a , str > ,
293297 vers : Version ,
294298}
295299
@@ -759,7 +763,7 @@ impl IndexSummary {
759763 Ok ( ( index, summary) ) => ( index, summary, true ) ,
760764 Err ( err) => {
761765 let Ok ( IndexPackageMinimum { name, vers } ) =
762- serde_json:: from_slice :: < IndexPackageMinimum > ( line)
766+ serde_json:: from_slice :: < IndexPackageMinimum < ' _ > > ( line)
763767 else {
764768 // If we can't recover, prefer the original error
765769 return Err ( err) ;
0 commit comments