From 617ab8d21770337cc7ad113fe43255455cfc6a51 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 19 Jul 2022 17:09:29 -0500 Subject: [PATCH] refactor(source): Be consistent with Registry::query_vec --- src/cargo/core/compiler/future_incompat.rs | 2 +- src/cargo/core/registry.rs | 8 ++++---- src/cargo/core/source/mod.rs | 4 ++-- src/cargo/ops/common_for_install_and_uninstall.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cargo/core/compiler/future_incompat.rs b/src/cargo/core/compiler/future_incompat.rs index c814842dff7..4ff99079009 100644 --- a/src/cargo/core/compiler/future_incompat.rs +++ b/src/cargo/core/compiler/future_incompat.rs @@ -293,7 +293,7 @@ fn get_updates(ws: &Workspace<'_>, package_ids: &BTreeSet) -> 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 diff --git a/src/cargo/core/registry.rs b/src/cargo/core/registry.rs index eaf4089a668..4bb8e8aec3d 100644 --- a/src/cargo/core/registry.rs +++ b/src/cargo/core/registry.rs @@ -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); @@ -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, }; @@ -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, } @@ -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, } diff --git a/src/cargo/core/source/mod.rs b/src/cargo/core/source/mod.rs index 4b789e65f29..9e6f161aec5 100644 --- a/src/cargo/core/source/mod.rs +++ b/src/cargo/core/source/mod.rs @@ -40,9 +40,9 @@ pub trait Source { f: &mut dyn FnMut(Summary), ) -> Poll>; - fn query_vec(&mut self, dep: &Dependency) -> Poll>> { + fn query_vec(&mut self, dep: &Dependency, fuzzy: bool) -> Poll>> { 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. diff --git a/src/cargo/ops/common_for_install_and_uninstall.rs b/src/cargo/ops/common_for_install_and_uninstall.rs index 362a2d96450..5e9282d716c 100644 --- a/src/cargo/ops/common_for_install_and_uninstall.rs +++ b/src/cargo/ops/common_for_install_and_uninstall.rs @@ -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()?, }