File tree 2 files changed +13
-10
lines changed
2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -186,10 +186,13 @@ pub fn main() {
186
186
let clippy_enabled = env:: var ( "CLIPPY_TESTS" )
187
187
. ok ( )
188
188
. map_or ( false , |val| val == "true" )
189
- || orig_args. iter ( ) . any ( |s| s == "--emit=metadata" ) ;
189
+ || orig_args. iter ( ) . any ( |s| s == "--emit=dep-info, metadata" ) ;
190
190
191
191
if clippy_enabled {
192
192
args. extend_from_slice ( & [ "--cfg" . to_owned ( ) , r#"feature="cargo-clippy""# . to_owned ( ) ] ) ;
193
+ if let Ok ( extra_args) = env:: var ( "CLIPPY_ARGS" ) {
194
+ args. extend ( extra_args. split ( "__CLIPPY_HACKERY__" ) . filter ( |s| !s. is_empty ( ) ) . map ( str:: to_owned) ) ;
195
+ }
193
196
}
194
197
195
198
let mut ccc = ClippyCompilerCalls :: new ( clippy_enabled) ;
Original file line number Diff line number Diff line change @@ -175,23 +175,22 @@ pub fn main() {
175
175
}
176
176
}
177
177
178
- fn process < I > ( old_args : I ) -> Result < ( ) , i32 >
178
+ fn process < I > ( mut old_args : I ) -> Result < ( ) , i32 >
179
179
where
180
180
I : Iterator < Item = String > ,
181
181
{
182
- let mut args = vec ! [ "rustc " . to_owned( ) ] ;
182
+ let mut args = vec ! [ "check " . to_owned( ) ] ;
183
183
184
184
let mut found_dashes = false ;
185
- for arg in old_args {
185
+ for arg in old_args. by_ref ( ) {
186
186
found_dashes |= arg == "--" ;
187
+ if found_dashes {
188
+ break ;
189
+ }
187
190
args. push ( arg) ;
188
191
}
189
- if !found_dashes {
190
- args. push ( "--" . to_owned ( ) ) ;
191
- }
192
- args. push ( "--emit=metadata" . to_owned ( ) ) ;
193
- args. push ( "--cfg" . to_owned ( ) ) ;
194
- args. push ( r#"feature="cargo-clippy""# . to_owned ( ) ) ;
192
+
193
+ let clippy_args: String = old_args. map ( |arg| format ! ( "{}__CLIPPY_HACKERY__" , arg) ) . collect ( ) ;
195
194
196
195
let mut path = std:: env:: current_exe ( )
197
196
. expect ( "current executable path invalid" )
@@ -202,6 +201,7 @@ where
202
201
let exit_status = std:: process:: Command :: new ( "cargo" )
203
202
. args ( & args)
204
203
. env ( "RUSTC_WRAPPER" , path)
204
+ . env ( "CLIPPY_ARGS" , clippy_args)
205
205
. spawn ( )
206
206
. expect ( "could not run cargo" )
207
207
. wait ( )
You can’t perform that action at this time.
0 commit comments