22
33use rustc_tools_util:: VersionInfo ;
44use std:: env;
5+ use std:: ffi:: OsString ;
56use std:: path:: PathBuf ;
67use std:: process:: { self , Command } ;
7- use std:: ffi:: OsString ;
88
99const CARGO_CLIPPY_HELP : & str = r#"Checks a package to catch common mistakes and improve your Rust code.
1010
@@ -60,11 +60,10 @@ struct ClippyCmd {
6060 unstable_options : bool ,
6161 cargo_subcommand : & ' static str ,
6262 args : Vec < String > ,
63- clippy_args : String
63+ clippy_args : String ,
6464}
6565
66- impl ClippyCmd
67- {
66+ impl ClippyCmd {
6867 fn new < I > ( mut old_args : I ) -> Self
6968 where
7069 I : Iterator < Item = String > ,
@@ -98,10 +97,7 @@ impl ClippyCmd
9897 args. insert ( 0 , "+nightly" . to_string ( ) ) ;
9998 }
10099
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 ( ) ;
105101
106102 ClippyCmd {
107103 unstable_options,
@@ -160,7 +156,6 @@ impl ClippyCmd
160156 }
161157}
162158
163-
164159fn process < I > ( old_args : I ) -> Result < ( ) , i32 >
165160where
166161 I : Iterator < Item = String > ,
@@ -195,7 +190,9 @@ mod tests {
195190
196191 #[ test]
197192 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) ;
199196 let cmd = ClippyCmd :: new ( args) ;
200197 assert_eq ! ( "fix" , cmd. cargo_subcommand) ;
201198 assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
@@ -212,7 +209,9 @@ mod tests {
212209
213210 #[ test]
214211 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) ;
216215 let cmd = ClippyCmd :: new ( args) ;
217216 assert_eq ! ( "check" , cmd. cargo_subcommand) ;
218217 assert_eq ! ( "RUSTC_WORKSPACE_WRAPPER" , cmd. path_env( ) ) ;
0 commit comments