completions/cargo: Uncouple from rustup completions

We could technically extract this into a function, but it's a trivial
one-liner.

This allows rustup completions to be independently overridden.

Fixes #12357
This commit is contained in:
Fabian Boehm
2026-01-20 16:43:54 +01:00
parent a454d53c28
commit 2df1fa90f1

View File

@@ -34,8 +34,7 @@ end
# have an easy way to do that in the `complete` machinery at this time.
function __fish_cargo_targets
if command -q rustup
functions -q __rustup_installed_targets || complete -C"rustup " &>/dev/null
__rustup_installed_targets
rustup target list | string replace -rf "^(\S+) \(installed\)" '$1'
else
rustc --print target-list
end