Remove `override_build_kind`
It doesn't seem to be needed, we can just use `Kind::Check` explicitly.
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index f478735..f5dae62 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -199,13 +199,6 @@ pub struct Rustc {
///
/// [`compile::Rustc`]: crate::core::build_steps::compile::Rustc
crates: Vec<String>,
- /// Override `Builder::kind` on cargo invocations.
- ///
- /// By default, `Builder::kind` is propagated as the subcommand to the cargo invocations.
- /// However, there are cases when this is not desirable. For example, when running `x clippy $tool_name`,
- /// passing `Builder::kind` to cargo invocations would run clippy on the entire compiler and library,
- /// which is not useful if we only want to lint a few crates with specific rules.
- override_build_kind: Option<Kind>,
}
impl Rustc {
@@ -215,12 +208,7 @@ pub fn new(target: TargetSelection, builder: &Builder<'_>) -> Self {
.into_iter()
.map(|krate| krate.name.to_string())
.collect();
- Self { target, crates, override_build_kind: None }
- }
-
- pub fn build_kind(mut self, build_kind: Option<Kind>) -> Self {
- self.override_build_kind = build_kind;
- self
+ Self { target, crates }
}
}
@@ -235,7 +223,7 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
fn make_run(run: RunConfig<'_>) {
let crates = run.make_run_crates(Alias::Compiler);
- run.builder.ensure(Rustc { target: run.target, crates, override_build_kind: None });
+ run.builder.ensure(Rustc { target: run.target, crates });
}
/// Builds the compiler.
@@ -256,7 +244,7 @@ fn run(self, builder: &Builder<'_>) {
builder.ensure(crate::core::build_steps::compile::Std::new(compiler, compiler.host));
builder.ensure(crate::core::build_steps::compile::Std::new(compiler, target));
} else {
- builder.ensure(Std::new(target).build_kind(self.override_build_kind));
+ builder.ensure(Std::new(target));
}
let mut cargo = builder::Cargo::new(
@@ -265,17 +253,11 @@ fn run(self, builder: &Builder<'_>) {
Mode::Rustc,
SourceType::InTree,
target,
- self.override_build_kind.unwrap_or(builder.kind),
+ Kind::Check,
);
rustc_cargo(builder, &mut cargo, target, &compiler, &self.crates);
- // For ./x.py clippy, don't run with --all-targets because
- // linting tests and benchmarks can produce very noisy results
- if builder.kind != Kind::Clippy {
- cargo.arg("--all-targets");
- }
-
// Explicitly pass -p for all compiler crates -- this will force cargo
// to also check the tests/benches/examples for these crates, rather
// than just the leaf crate.
diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs
index 788a3b9..f193247 100644
--- a/src/bootstrap/src/core/build_steps/clippy.rs
+++ b/src/bootstrap/src/core/build_steps/clippy.rs
@@ -289,7 +289,7 @@ fn run(self, builder: &Builder<'_>) -> Self::Output {
let target = self.target;
if !builder.download_rustc() {
- builder.ensure(check::Rustc::new(target, builder).build_kind(Some(Kind::Check)));
+ builder.ensure(check::Rustc::new(target, builder));
};
let cargo = prepare_tool_cargo(