@@ -58,7 +58,7 @@ pub fn main() {
5858
5959struct ClippyCmd {
6060 unstable_options : bool ,
61- cmd : & ' static str ,
61+ cargo_subcommand : & ' static str ,
6262 args : Vec < String > ,
6363 clippy_args : String
6464}
@@ -69,14 +69,14 @@ impl ClippyCmd
6969 where
7070 I : Iterator < Item = String > ,
7171 {
72- let mut cmd = "check" ;
72+ let mut cargo_subcommand = "check" ;
7373 let mut unstable_options = false ;
7474 let mut args = vec ! [ ] ;
7575
7676 for arg in old_args. by_ref ( ) {
7777 match arg. as_str ( ) {
7878 "--fix" => {
79- cmd = "fix" ;
79+ cargo_subcommand = "fix" ;
8080 continue ;
8181 }
8282 "--" => break ,
@@ -88,7 +88,7 @@ impl ClippyCmd
8888 args. push ( arg) ;
8989 }
9090
91- if cmd == "fix" && !unstable_options {
91+ if cargo_subcommand == "fix" && !unstable_options {
9292 panic ! ( "Usage of `--fix` requires `-Z unstable-options`" ) ;
9393 }
9494
@@ -105,7 +105,7 @@ impl ClippyCmd
105105
106106 ClippyCmd {
107107 unstable_options,
108- cmd ,
108+ cargo_subcommand ,
109109 args,
110110 clippy_args,
111111 }
@@ -153,7 +153,7 @@ impl ClippyCmd
153153 cmd. env ( self . path_env ( ) , self . path ( ) )
154154 . envs ( ClippyCmd :: target_dir ( ) )
155155 . env ( "CLIPPY_ARGS" , self . clippy_args )
156- . arg ( self . cmd )
156+ . arg ( self . cargo_subcommand )
157157 . args ( & self . args ) ;
158158
159159 cmd
@@ -197,7 +197,7 @@ mod tests {
197197 fn fix_unstable ( ) {
198198 let args = "cargo clippy --fix -Zunstable-options" . split_whitespace ( ) . map ( ToString :: to_string) ;
199199 let cmd = ClippyCmd :: new ( args) ;
200- assert_eq ! ( "fix" , cmd. cmd ) ;
200+ assert_eq ! ( "fix" , cmd. cargo_subcommand ) ;
201201 assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
202202 assert ! ( cmd. args. iter( ) . find( |arg| arg. ends_with( "unstable-options" ) ) . is_some( ) ) ;
203203 }
@@ -206,15 +206,15 @@ mod tests {
206206 fn check ( ) {
207207 let args = "cargo clippy" . split_whitespace ( ) . map ( ToString :: to_string) ;
208208 let cmd = ClippyCmd :: new ( args) ;
209- assert_eq ! ( "check" , cmd. cmd ) ;
209+ assert_eq ! ( "check" , cmd. cargo_subcommand ) ;
210210 assert_eq ! ( "RUSTC_WRAPPER" , cmd. path_env( ) ) ;
211211 }
212212
213213 #[ test]
214214 fn check_unstable ( ) {
215215 let args = "cargo clippy -Zunstable-options" . split_whitespace ( ) . map ( ToString :: to_string) ;
216216 let cmd = ClippyCmd :: new ( args) ;
217- assert_eq ! ( "check" , cmd. cmd ) ;
217+ assert_eq ! ( "check" , cmd. cargo_subcommand ) ;
218218 assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
219219 }
220220}
0 commit comments