@@ -29,36 +29,30 @@ _rustc_opts_switches=(
29
29
--target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
30
30
--target-feature'[Target specific attributes (llc -mattr=help for detail)]'
31
31
--android-cross-path'[The path to the Android NDK]'
32
- {-W,--warn}'[Set lint warnings]'
33
- {-A,--allow}'[Set lint allowed]'
34
- {-D,--deny}'[Set lint denied]'
35
- {-F,--forbid}'[Set lint forbidden]'
36
- -Z'[Set internal debugging options]'
37
32
{-v,--version}'[Print version info and exit]'
38
33
)
39
-
40
34
_rustc_opts_lint=(
41
- 'path-statement: path statements with no effect'
42
- 'deprecated-pattern: warn about deprecated uses of pattern bindings'
43
- 'non-implicitly-copyable-typarams: passing non implicitly copyable types as copy type params'
44
- 'missing-trait-doc: detects missing documentation for traits'
45
- 'missing-struct-doc: detects missing documentation for structs'
46
- 'ctypes: proper use of core::libc types in foreign modules'
47
- 'implicit-copies: implicit copies of non implicitly copyable data'
48
- "unused-mut: detect mut variables which don't need to be mutable"
49
- 'unused-imports: imports that are never used'
50
- 'heap-memory: use of any (~ type or @ type) heap memory'
51
- 'default-methods: allow default methods'
52
- 'unused-variable: detect variables which are not used in any way'
53
- 'dead-assignment: detect assignments that will never be read'
54
- 'unrecognized-lint: unrecognized lint attribute'
55
- 'type-limits: comparisons made useless by limits of the types involved'
56
- 'unused-unsafe: unnecessary use of an `unsafe` block'
57
- 'while-true: suggest using loop { } instead of while(true) { }'
58
- 'non-camel-case-types: types, variants and traits should have camel case names'
59
- 'managed-heap-memory: use of managed (@ type) heap memory'
60
- 'unnecessary-allocation: detects unnecessary allocations that can be eliminated'
61
- 'owned-heap-memory: use of owned (~ type) heap memory'
35
+ 'path-statement[ path statements with no effect] '
36
+ 'deprecated-pattern[ warn about deprecated uses of pattern bindings] '
37
+ 'non-implicitly-copyable-typarams[ passing non implicitly copyable types as copy type params] '
38
+ 'missing-trait-doc[ detects missing documentation for traits] '
39
+ 'missing-struct-doc[ detects missing documentation for structs] '
40
+ 'ctypes[ proper use of core::libc types in foreign modules] '
41
+ 'implicit-copies[ implicit copies of non implicitly copyable data] '
42
+ "unused-mut[ detect mut variables which don't need to be mutable] "
43
+ 'unused-imports[ imports that are never used] '
44
+ 'heap-memory[ use of any (~ type or @ type) heap memory] '
45
+ 'default-methods[ allow default methods] '
46
+ 'unused-variable[ detect variables which are not used in any way] '
47
+ 'dead-assignment[ detect assignments that will never be read] '
48
+ 'unrecognized-lint[ unrecognized lint attribute] '
49
+ 'type-limits[ comparisons made useless by limits of the types involved] '
50
+ 'unused-unsafe[ unnecessary use of an `unsafe` block] '
51
+ 'while-true[ suggest using loop { } instead of while(true) { }] '
52
+ 'non-camel-case-types[ types, variants and traits should have camel case names] '
53
+ 'managed-heap-memory[ use of managed (@ type) heap memory] '
54
+ 'unnecessary-allocation[ detects unnecessary allocations that can be eliminated] '
55
+ 'owned-heap-memory[ use of owned (~ type) heap memory] '
62
56
)
63
57
64
58
_rustc_opts_debug=(
@@ -90,13 +84,20 @@ _rustc_opts_debug=(
90
84
'lint-llvm:Run the LLVM lint pass on the pre-optimization IR'
91
85
)
92
86
93
- _rustc() {
94
- case $words[2] in
95
- -[WADF]) _describe 'options' _rustc_opts_lint ;;
96
- -Z) _describe 'options' _rustc_opts_debug ;;
97
- -) _arguments -s -w : "$_rustc_opts_switches[@]" ;;
98
- *) _files -g "*.rs" ;;
99
- esac
87
+ _rustc_opts_fun_lint() {
88
+ _values -s , 'options' \
89
+ "$_rustc_opts_lint[@]"
90
+ }
91
+
92
+ _rustc_opts_fun_debug(){
93
+ _describe 'options' _rustc_opts_debug
100
94
}
101
95
102
- _rustc "$@"
96
+ _arguments -s : \
97
+ '(-W --warn)'{-W,--warn}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \
98
+ '(-A --allow)'{-A,--allow}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \
99
+ '(-D --deny)'{-D,--deny}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \
100
+ '(-F --forbid)'{-F,--forbid}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \
101
+ '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \
102
+ "$_rustc_opts_switches[@]" \
103
+ '*::files:_files -g "*.rs"'
0 commit comments