Skip to content

Commit

Permalink
clippy-driver: remove --cap-lints check
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexendoo committed Aug 15, 2024
1 parent 52192aa commit 5e37fe7
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,10 @@ pub fn main() {
.chain(vec!["--cfg".into(), "clippy".into()])
.collect::<Vec<String>>();

// We enable Clippy if one of the following conditions is met
// - IF Clippy is run on its test suite OR
// - IF Clippy is run on the main crate, not on deps (`!cap_lints_allow`) THEN
// - IF `--no-deps` is not set (`!no_deps`) OR
// - IF `--no-deps` is set and Clippy is run on the specified primary package
let cap_lints_allow = arg_value(&orig_args, "--cap-lints", |val| val == "allow").is_some()
&& arg_value(&orig_args, "--force-warn", |val| val.contains("clippy::")).is_none();
let in_primary_package = env::var("CARGO_PRIMARY_PACKAGE").is_ok();

let clippy_enabled = !cap_lints_allow && (!no_deps || in_primary_package);
// Disable Clippy if `--no-deps` is passed and we aren't in a primary package
let disabled_dep = no_deps && env::var_os("CARGO_PRIMARY_PACKAGE").is_none();

let clippy_enabled = !disabled_dep;
if clippy_enabled {
args.extend(clippy_args);
rustc_driver::RunCompiler::new(&args, &mut ClippyCallbacks { clippy_args_var })
Expand Down

0 comments on commit 5e37fe7

Please sign in to comment.