@@ -210,12 +210,10 @@ enum MaybeIndexSummary {
210
210
211
211
/// A parsed representation of a summary from the index.
212
212
///
213
- /// In addition to a full `Summary` we have a few auxiliary pieces of
214
- /// information liked `yanked` and what the checksum hash is.
213
+ /// In addition to a full `Summary` we have information on whether it is `yanked`.
215
214
pub struct IndexSummary {
216
215
pub summary : Summary ,
217
216
pub yanked : bool ,
218
- pub hash : String ,
219
217
}
220
218
221
219
/// A representation of the cache on disk that Cargo maintains of summaries.
@@ -242,13 +240,16 @@ impl<'cfg> RegistryIndex<'cfg> {
242
240
}
243
241
244
242
/// Returns the hash listed for a specified `PackageId`.
245
- pub fn hash ( & mut self , pkg : PackageId , load : & mut dyn RegistryData ) -> CargoResult < String > {
243
+ pub fn hash ( & mut self , pkg : PackageId , load : & mut dyn RegistryData ) -> CargoResult < & str > {
246
244
let req = VersionReq :: exact ( pkg. version ( ) ) ;
247
245
let summary = self
248
246
. summaries ( pkg. name ( ) , & req, load) ?
249
247
. next ( )
250
248
. ok_or_else ( || internal ( format ! ( "no hash listed for {}" , pkg) ) ) ?;
251
- Ok ( summary. hash . clone ( ) )
249
+ summary
250
+ . summary
251
+ . checksum ( )
252
+ . ok_or_else ( || internal ( format ! ( "no hash listed for {}" , pkg) ) )
252
253
}
253
254
254
255
/// Load a list of summaries for `name` package in this registry which
@@ -722,11 +723,10 @@ impl IndexSummary {
722
723
. map ( |dep| dep. into_dep ( source_id) )
723
724
. collect :: < CargoResult < Vec < _ > > > ( ) ?;
724
725
let mut summary = Summary :: new ( pkgid, deps, & features, links, false ) ?;
725
- summary. set_checksum ( cksum. clone ( ) ) ;
726
+ summary. set_checksum ( cksum) ;
726
727
Ok ( IndexSummary {
727
728
summary,
728
729
yanked : yanked. unwrap_or ( false ) ,
729
- hash : cksum,
730
730
} )
731
731
}
732
732
}
0 commit comments