fix(add): Don't select yanked versions when normalizing names

Fixes #14893
This commit is contained in:
Ed Page 2024-12-05 09:48:21 -06:00
parent 737a5e8325
commit 5df493ecd9
4 changed files with 16 additions and 6 deletions

View File

@ -856,7 +856,13 @@ impl<'gctx> Source for RegistrySource<'gctx> {
}
any_pending |= self
.index
.query_inner(name_permutation, &req, &mut *self.ops, f)?
.query_inner(name_permutation, &req, &mut *self.ops, &mut |s| {
if !s.is_yanked() {
f(s);
} else if kind == QueryKind::Alternatives {
f(s);
}
})?
.is_pending();
}
}

View File

@ -23,7 +23,7 @@ fn case() {
.arg_line("linked_hash_map")
.current_dir(cwd)
.assert()
.failure()
.success()
.stdout_eq(str![""])
.stderr_eq(file!["stderr.term.svg"]);

View File

@ -4,3 +4,6 @@
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"
[dependencies]
linked-hash-map = "0.5.4"

View File

@ -1,9 +1,8 @@
<svg width="740px" height="92px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.fg-green { fill: #00AA00 }
.fg-red { fill: #AA0000 }
.fg-yellow { fill: #AA5500 }
.container {
padding: 0 10px;
@ -24,9 +23,11 @@
</tspan>
<tspan x="10px" y="46px"><tspan class="fg-yellow bold">warning</tspan><tspan class="bold">:</tspan><tspan> translating `linked_hash_map` to `linked-hash-map`</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> the crate `linked-hash-map@0.6.0` could not be found in registry index.</tspan>
<tspan x="10px" y="64px"><tspan class="fg-green bold"> Adding</tspan><tspan> linked-hash-map v0.5.4 to dependencies</tspan>
</tspan>
<tspan x="10px" y="82px">
<tspan x="10px" y="82px"><tspan class="fg-green bold"> Locking</tspan><tspan> 1 package to latest compatible version</tspan>
</tspan>
<tspan x="10px" y="100px">
</tspan>
</text>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB