diff --git a/share/completions/rustc.fish b/share/completions/rustc.fish index e6ab59085..d35c3b02d 100644 --- a/share/completions/rustc.fish +++ b/share/completions/rustc.fish @@ -28,17 +28,7 @@ complete -c rustc -f -l extern complete -c rustc -f -l sysroot complete -c rustc -x -l color -a 'auto always never' -set -l rust_docs (rustc -C help 2>/dev/null \ - | string replace -r -i '(\s+)-C(.+)(\s+)--(\s+)([^\n]+)' '$2 $5' \ - | string trim \ - | string match -r '^.*[^:]$') - -for line in $rust_docs - set -l docs (string split -m 1 ' ' -- $line) - set -l flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \ - $docs[1]) - complete -c rustc -x -s C -l codegen -a (string escape -- "$flag") -d "$docs[2]" -end +complete -c rustc -s C -l codegen -xa "(rustc -C help 2>/dev/null | string match -rv 'option is deprecated' | string replace -rf -i '(\s+)-C\s*(.+)=val(\s+)--(\s+)([^\n]+)' '\$2='\t'\$5')" # rustc -Z is only available with the nightly toolchain, which may not be installed if rustc +nightly >/dev/null 2>&1