@@ -60,6 +60,7 @@ fn test_arg_value() {
60
60
assert_eq ! ( arg_value( args, "--bar" , |p| p == "foo" ) , None ) ;
61
61
assert_eq ! ( arg_value( args, "--foobar" , |p| p == "foo" ) , None ) ;
62
62
assert_eq ! ( arg_value( args, "--foobar" , |p| p == "123" ) , Some ( "123" ) ) ;
63
+ assert_eq ! ( arg_value( args, "--foobar" , |p| p. contains( "12" ) ) , Some ( "123" ) ) ;
63
64
assert_eq ! ( arg_value( args, "--foo" , |_| true ) , None ) ;
64
65
}
65
66
@@ -334,15 +335,13 @@ pub fn main() {
334
335
// - IF Clippy is run on the main crate, not on deps (`!cap_lints_allow`) THEN
335
336
// - IF `--no-deps` is not set (`!no_deps`) OR
336
337
// - IF `--no-deps` is set and Clippy is run on the specified primary package
337
- let cap_lints_allow = arg_value ( & orig_args, "--cap-lints" , |val| val == "allow" ) . is_some ( ) ;
338
+ let cap_lints_allow = arg_value ( & orig_args, "--cap-lints" , |val| val == "allow" ) . is_some ( )
339
+ && arg_value ( & orig_args, "--force-warn" , |val| val. contains ( "clippy::" ) ) . is_none ( ) ;
338
340
let in_primary_package = env:: var ( "CARGO_PRIMARY_PACKAGE" ) . is_ok ( ) ;
339
341
340
342
let clippy_enabled = !cap_lints_allow && ( !no_deps || in_primary_package) ;
341
343
if clippy_enabled {
342
344
args. extend ( clippy_args) ;
343
- }
344
-
345
- if clippy_enabled {
346
345
rustc_driver:: RunCompiler :: new ( & args, & mut ClippyCallbacks { clippy_args_var } ) . run ( )
347
346
} else {
348
347
rustc_driver:: RunCompiler :: new ( & args, & mut RustcCallbacks { clippy_args_var } ) . run ( )
0 commit comments