Skip to content

Commit 015e980

Browse files
committed
refactor(registry): Pass along original IndexSummary state for overrides
1 parent e48a008 commit 015e980

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/cargo/core/registry.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,10 @@ impl<'gctx> Registry for PackageRegistry<'gctx> {
674674
let patch = patches.remove(0);
675675
match override_summary {
676676
Some(override_summary) => {
677-
let override_summary = override_summary.into_summary();
678-
self.warn_bad_override(&override_summary, &patch)?;
679-
f(IndexSummary::Candidate(self.lock(override_summary)));
677+
self.warn_bad_override(override_summary.as_summary(), &patch)?;
678+
let override_summary =
679+
override_summary.map_summary(|summary| self.lock(summary));
680+
f(override_summary);
680681
}
681682
None => f(IndexSummary::Candidate(patch)),
682683
}
@@ -760,11 +761,11 @@ impl<'gctx> Registry for PackageRegistry<'gctx> {
760761
"found an override with a non-locked list"
761762
)));
762763
}
763-
let override_summary = override_summary.into_summary();
764764
if let Some(to_warn) = to_warn {
765-
self.warn_bad_override(&override_summary, to_warn.as_summary())?;
765+
self.warn_bad_override(override_summary.as_summary(), to_warn.as_summary())?;
766766
}
767-
f(IndexSummary::Candidate(self.lock(override_summary)));
767+
let override_summary = override_summary.map_summary(|summary| self.lock(summary));
768+
f(override_summary);
768769
}
769770
}
770771

0 commit comments

Comments
 (0)