@@ -58,7 +58,7 @@ pub fn main() {
58
58
59
59
struct ClippyCmd {
60
60
unstable_options : bool ,
61
- cmd : & ' static str ,
61
+ cargo_subcommand : & ' static str ,
62
62
args : Vec < String > ,
63
63
clippy_args : String
64
64
}
@@ -69,14 +69,14 @@ impl ClippyCmd
69
69
where
70
70
I : Iterator < Item = String > ,
71
71
{
72
- let mut cmd = "check" ;
72
+ let mut cargo_subcommand = "check" ;
73
73
let mut unstable_options = false ;
74
74
let mut args = vec ! [ ] ;
75
75
76
76
for arg in old_args. by_ref ( ) {
77
77
match arg. as_str ( ) {
78
78
"--fix" => {
79
- cmd = "fix" ;
79
+ cargo_subcommand = "fix" ;
80
80
continue ;
81
81
}
82
82
"--" => break ,
@@ -88,7 +88,7 @@ impl ClippyCmd
88
88
args. push ( arg) ;
89
89
}
90
90
91
- if cmd == "fix" && !unstable_options {
91
+ if cargo_subcommand == "fix" && !unstable_options {
92
92
panic ! ( "Usage of `--fix` requires `-Z unstable-options`" ) ;
93
93
}
94
94
@@ -105,7 +105,7 @@ impl ClippyCmd
105
105
106
106
ClippyCmd {
107
107
unstable_options,
108
- cmd ,
108
+ cargo_subcommand ,
109
109
args,
110
110
clippy_args,
111
111
}
@@ -153,7 +153,7 @@ impl ClippyCmd
153
153
cmd. env ( self . path_env ( ) , self . path ( ) )
154
154
. envs ( ClippyCmd :: target_dir ( ) )
155
155
. env ( "CLIPPY_ARGS" , self . clippy_args )
156
- . arg ( self . cmd )
156
+ . arg ( self . cargo_subcommand )
157
157
. args ( & self . args ) ;
158
158
159
159
cmd
@@ -197,7 +197,7 @@ mod tests {
197
197
fn fix_unstable ( ) {
198
198
let args = "cargo clippy --fix -Zunstable-options" . split_whitespace ( ) . map ( ToString :: to_string) ;
199
199
let cmd = ClippyCmd :: new ( args) ;
200
- assert_eq ! ( "fix" , cmd. cmd ) ;
200
+ assert_eq ! ( "fix" , cmd. cargo_subcommand ) ;
201
201
assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
202
202
assert ! ( cmd. args. iter( ) . find( |arg| arg. ends_with( "unstable-options" ) ) . is_some( ) ) ;
203
203
}
@@ -206,15 +206,15 @@ mod tests {
206
206
fn check ( ) {
207
207
let args = "cargo clippy" . split_whitespace ( ) . map ( ToString :: to_string) ;
208
208
let cmd = ClippyCmd :: new ( args) ;
209
- assert_eq ! ( "check" , cmd. cmd ) ;
209
+ assert_eq ! ( "check" , cmd. cargo_subcommand ) ;
210
210
assert_eq ! ( "RUSTC_WRAPPER" , cmd. path_env( ) ) ;
211
211
}
212
212
213
213
#[ test]
214
214
fn check_unstable ( ) {
215
215
let args = "cargo clippy -Zunstable-options" . split_whitespace ( ) . map ( ToString :: to_string) ;
216
216
let cmd = ClippyCmd :: new ( args) ;
217
- assert_eq ! ( "check" , cmd. cmd ) ;
217
+ assert_eq ! ( "check" , cmd. cargo_subcommand ) ;
218
218
assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
219
219
}
220
220
}
0 commit comments