2
2
3
3
use rustc_tools_util:: VersionInfo ;
4
4
use std:: env;
5
+ use std:: ffi:: OsString ;
5
6
use std:: path:: PathBuf ;
6
7
use std:: process:: { self , Command } ;
7
- use std:: ffi:: OsString ;
8
8
9
9
const CARGO_CLIPPY_HELP : & str = r#"Checks a package to catch common mistakes and improve your Rust code.
10
10
@@ -60,11 +60,10 @@ struct ClippyCmd {
60
60
unstable_options : bool ,
61
61
cargo_subcommand : & ' static str ,
62
62
args : Vec < String > ,
63
- clippy_args : String
63
+ clippy_args : String ,
64
64
}
65
65
66
- impl ClippyCmd
67
- {
66
+ impl ClippyCmd {
68
67
fn new < I > ( mut old_args : I ) -> Self
69
68
where
70
69
I : Iterator < Item = String > ,
@@ -98,10 +97,7 @@ impl ClippyCmd
98
97
args. insert ( 0 , "+nightly" . to_string ( ) ) ;
99
98
}
100
99
101
- let clippy_args: String =
102
- old_args
103
- . map ( |arg| format ! ( "{}__CLIPPY_HACKERY__" , arg) )
104
- . collect ( ) ;
100
+ let clippy_args: String = old_args. map ( |arg| format ! ( "{}__CLIPPY_HACKERY__" , arg) ) . collect ( ) ;
105
101
106
102
ClippyCmd {
107
103
unstable_options,
@@ -160,7 +156,6 @@ impl ClippyCmd
160
156
}
161
157
}
162
158
163
-
164
159
fn process < I > ( old_args : I ) -> Result < ( ) , i32 >
165
160
where
166
161
I : Iterator < Item = String > ,
@@ -195,7 +190,9 @@ mod tests {
195
190
196
191
#[ test]
197
192
fn fix_unstable ( ) {
198
- let args = "cargo clippy --fix -Zunstable-options" . split_whitespace ( ) . map ( ToString :: to_string) ;
193
+ let args = "cargo clippy --fix -Zunstable-options"
194
+ . split_whitespace ( )
195
+ . map ( ToString :: to_string) ;
199
196
let cmd = ClippyCmd :: new ( args) ;
200
197
assert_eq ! ( "fix" , cmd. cargo_subcommand) ;
201
198
assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
@@ -212,7 +209,9 @@ mod tests {
212
209
213
210
#[ test]
214
211
fn check_unstable ( ) {
215
- let args = "cargo clippy -Zunstable-options" . split_whitespace ( ) . map ( ToString :: to_string) ;
212
+ let args = "cargo clippy -Zunstable-options"
213
+ . split_whitespace ( )
214
+ . map ( ToString :: to_string) ;
216
215
let cmd = ClippyCmd :: new ( args) ;
217
216
assert_eq ! ( "check" , cmd. cargo_subcommand) ;
218
217
assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
0 commit comments