Skip to content

Commit

Permalink
refactor(source): Be consistent with Registry::query_vec
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 20, 2022
1 parent 233ecba commit 617ab8d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/future_incompat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ fn get_updates(ws: &Workspace<'_>, package_ids: &BTreeSet<PackageId>) -> Option<
Ok(dep) => dep,
Err(_) => return false,
};
match source.query_vec(&dep) {
match source.query_vec(&dep, false) {
Poll::Ready(Ok(sum)) => {
summaries.push((pkg_id, sum));
false
Expand Down
8 changes: 4 additions & 4 deletions src/cargo/core/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl<'cfg> PackageRegistry<'cfg> {
.get_mut(dep.source_id())
.expect("loaded source not present");

let summaries = match source.query_vec(dep)? {
let summaries = match source.query_vec(dep, false)? {
Poll::Ready(deps) => deps,
Poll::Pending => {
deps_pending.push(dep_remaining);
Expand Down Expand Up @@ -483,7 +483,7 @@ impl<'cfg> PackageRegistry<'cfg> {
for &s in self.overrides.iter() {
let src = self.sources.get_mut(s).unwrap();
let dep = Dependency::new_override(dep.package_name(), s);
let mut results = match src.query_vec(&dep) {
let mut results = match src.query_vec(&dep, false) {
Poll::Ready(results) => results?,
Poll::Pending => return Poll::Pending,
};
Expand Down Expand Up @@ -881,7 +881,7 @@ fn summary_for_patch(
// No summaries found, try to help the user figure out what is wrong.
if let Some(locked) = locked {
// Since the locked patch did not match anything, try the unlocked one.
let orig_matches = match source.query_vec(orig_patch) {
let orig_matches = match source.query_vec(orig_patch, false) {
Poll::Pending => return Poll::Pending,
Poll::Ready(deps) => deps,
}
Expand All @@ -906,7 +906,7 @@ fn summary_for_patch(
// Try checking if there are *any* packages that match this by name.
let name_only_dep = Dependency::new_override(orig_patch.package_name(), orig_patch.source_id());

let name_summaries = match source.query_vec(&name_only_dep) {
let name_summaries = match source.query_vec(&name_only_dep, false) {
Poll::Pending => return Poll::Pending,
Poll::Ready(deps) => deps,
}
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/core/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ pub trait Source {
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>>;

fn query_vec(&mut self, dep: &Dependency) -> Poll<CargoResult<Vec<Summary>>> {
fn query_vec(&mut self, dep: &Dependency, fuzzy: bool) -> Poll<CargoResult<Vec<Summary>>> {
let mut ret = Vec::new();
self.query(dep, false, &mut |s| ret.push(s)).map_ok(|_| ret)
self.query(dep, fuzzy, &mut |s| ret.push(s)).map_ok(|_| ret)
}

/// Ensure that the source is fully up-to-date for the current session on the next query.
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/common_for_install_and_uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ where
}

let deps = loop {
match source.query_vec(&dep)? {
match source.query_vec(&dep, false)? {
Poll::Ready(deps) => break deps,
Poll::Pending => source.block_until_ready()?,
}
Expand Down

0 comments on commit 617ab8d

Please sign in to comment.