-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
It's not possible to run x clippy
only on certain paths. When running x clippy $tool
, clippy starts giving warnings on the entire compiler and library tree as well. Therefore we are unable to run clippy with different set of rules indivudually for each tool/path.
The root cause of this problem is that bootstrap overrides all the commands before invocations with clippy as seen here:
rust/src/bootstrap/src/core/builder.rs
Lines 1291 to 1300 in df8ac8f
/// Like `cargo`, but only passes flags that are valid for all commands. | |
pub fn bare_cargo( | |
&self, | |
compiler: Compiler, | |
mode: Mode, | |
target: TargetSelection, | |
cmd: &str, | |
) -> Command { | |
let mut cargo = if cmd == "clippy" { | |
self.cargo_clippy_cmd(compiler) |
And that is because clippy is sharing the same logic with x check
:
rust/src/bootstrap/src/core/builder.rs
Lines 770 to 783 in df8ac8f
Kind::Check | Kind::Clippy | Kind::Fix => describe!( | |
check::Std, | |
check::Rustc, | |
check::Rustdoc, | |
check::CodegenBackend, | |
check::Clippy, | |
check::Miri, | |
check::CargoMiri, | |
check::MiroptTestTools, | |
check::Rls, | |
check::Rustfmt, | |
check::RustAnalyzer, | |
check::Bootstrap, | |
), |
To prevent this problem we can create a new build step for clippy and then remove clippy-specific conditions from the core bootstrap flow.