Skip to content

Commit 8ec9b1e

Browse files
committed
refactor(resolver): Clarify which dep spec is used for alternatives
1 parent b45ca32 commit 8ec9b1e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cargo/core/resolver/errors.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ pub(super) fn activation_error(
222222
// Maybe the user mistyped the ver_req? Like `dep="2"` when `dep="0.2"`
223223
// was meant. So we re-query the registry with `dep="*"` so we can
224224
// list a few versions that were actually found.
225-
let mut new_dep = dep.clone();
226-
new_dep.set_version_req(OptVersionReq::Any);
225+
let mut wild_dep = dep.clone();
226+
wild_dep.set_version_req(OptVersionReq::Any);
227227

228228
let candidates = loop {
229-
match registry.query_vec(&new_dep, QueryKind::Exact) {
229+
match registry.query_vec(&wild_dep, QueryKind::Exact) {
230230
Poll::Ready(Ok(candidates)) => break candidates,
231231
Poll::Ready(Err(e)) => return to_resolve_err(e),
232232
Poll::Pending => match registry.block_until_ready() {
@@ -305,7 +305,7 @@ pub(super) fn activation_error(
305305
} else {
306306
// Maybe something is wrong with the available versions
307307
let mut version_candidates = loop {
308-
match registry.query_vec(&new_dep, QueryKind::RejectedVersions) {
308+
match registry.query_vec(&wild_dep, QueryKind::RejectedVersions) {
309309
Poll::Ready(Ok(candidates)) => break candidates,
310310
Poll::Ready(Err(e)) => return to_resolve_err(e),
311311
Poll::Pending => match registry.block_until_ready() {
@@ -319,7 +319,7 @@ pub(super) fn activation_error(
319319
// Maybe the user mistyped the name? Like `dep-thing` when `Dep_Thing`
320320
// was meant. So we try asking the registry for a `fuzzy` search for suggestions.
321321
let name_candidates = loop {
322-
match registry.query_vec(&new_dep, QueryKind::AlternativeNames) {
322+
match registry.query_vec(&wild_dep, QueryKind::AlternativeNames) {
323323
Poll::Ready(Ok(candidates)) => break candidates,
324324
Poll::Ready(Err(e)) => return to_resolve_err(e),
325325
Poll::Pending => match registry.block_until_ready() {
@@ -336,7 +336,7 @@ pub(super) fn activation_error(
336336
name_candidates.dedup_by(|a, b| a.name() == b.name());
337337
let mut name_candidates: Vec<_> = name_candidates
338338
.iter()
339-
.filter_map(|n| Some((edit_distance(&*new_dep.package_name(), &*n.name(), 3)?, n)))
339+
.filter_map(|n| Some((edit_distance(&*wild_dep.package_name(), &*n.name(), 3)?, n)))
340340
.collect();
341341
name_candidates.sort_by_key(|o| o.0);
342342

0 commit comments

Comments
 (0)