Skip to content

Commit b47d36d

Browse files
committed
Remove override_build_kind
It doesn't seem to be needed, we can just use `Kind::Check` explicitly.
1 parent 6f935a0 commit b47d36d

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,6 @@ pub struct Rustc {
199199
///
200200
/// [`compile::Rustc`]: crate::core::build_steps::compile::Rustc
201201
crates: Vec<String>,
202-
/// Override `Builder::kind` on cargo invocations.
203-
///
204-
/// By default, `Builder::kind` is propagated as the subcommand to the cargo invocations.
205-
/// However, there are cases when this is not desirable. For example, when running `x clippy $tool_name`,
206-
/// passing `Builder::kind` to cargo invocations would run clippy on the entire compiler and library,
207-
/// which is not useful if we only want to lint a few crates with specific rules.
208-
override_build_kind: Option<Kind>,
209202
}
210203

211204
impl Rustc {
@@ -215,12 +208,7 @@ impl Rustc {
215208
.into_iter()
216209
.map(|krate| krate.name.to_string())
217210
.collect();
218-
Self { target, crates, override_build_kind: None }
219-
}
220-
221-
pub fn build_kind(mut self, build_kind: Option<Kind>) -> Self {
222-
self.override_build_kind = build_kind;
223-
self
211+
Self { target, crates }
224212
}
225213
}
226214

@@ -235,7 +223,7 @@ impl Step for Rustc {
235223

236224
fn make_run(run: RunConfig<'_>) {
237225
let crates = run.make_run_crates(Alias::Compiler);
238-
run.builder.ensure(Rustc { target: run.target, crates, override_build_kind: None });
226+
run.builder.ensure(Rustc { target: run.target, crates });
239227
}
240228

241229
/// Builds the compiler.
@@ -256,7 +244,7 @@ impl Step for Rustc {
256244
builder.ensure(crate::core::build_steps::compile::Std::new(compiler, compiler.host));
257245
builder.ensure(crate::core::build_steps::compile::Std::new(compiler, target));
258246
} else {
259-
builder.ensure(Std::new(target).build_kind(self.override_build_kind));
247+
builder.ensure(Std::new(target));
260248
}
261249

262250
let mut cargo = builder::Cargo::new(
@@ -265,17 +253,11 @@ impl Step for Rustc {
265253
Mode::Rustc,
266254
SourceType::InTree,
267255
target,
268-
self.override_build_kind.unwrap_or(builder.kind),
256+
Kind::Check,
269257
);
270258

271259
rustc_cargo(builder, &mut cargo, target, &compiler, &self.crates);
272260

273-
// For ./x.py clippy, don't run with --all-targets because
274-
// linting tests and benchmarks can produce very noisy results
275-
if builder.kind != Kind::Clippy {
276-
cargo.arg("--all-targets");
277-
}
278-
279261
// Explicitly pass -p for all compiler crates -- this will force cargo
280262
// to also check the tests/benches/examples for these crates, rather
281263
// than just the leaf crate.

src/bootstrap/src/core/build_steps/clippy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ macro_rules! lint_any {
289289
let target = self.target;
290290

291291
if !builder.download_rustc() {
292-
builder.ensure(check::Rustc::new(target, builder).build_kind(Some(Kind::Check)));
292+
builder.ensure(check::Rustc::new(target, builder));
293293
};
294294

295295
let cargo = prepare_tool_cargo(

0 commit comments

Comments
 (0)