Skip to content

Commit c58f2d2

Browse files
committed
create Builder::msg_clippy
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 6b846cc commit c58f2d2

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,11 @@ impl Step for Std {
134134

135135
std_cargo(builder, target, compiler.stage, &mut cargo);
136136

137-
if matches!(builder.config.cmd, Subcommand::Fix { .. }) {
138-
// By default, cargo tries to fix all targets. Tell it not to fix tests until we've added `test` to the sysroot.
139-
cargo.arg("--lib");
140-
}
141-
142137
for krate in &*self.crates {
143138
cargo.arg("-p").arg(krate);
144139
}
145140

146-
let _guard = builder.msg_check(
141+
let _guard = builder.msg_clippy(
147142
format_args!("library artifacts{}", crate_description(&self.crates)),
148143
target,
149144
);
@@ -213,13 +208,13 @@ impl Step for Rustc {
213208
rustc_cargo(builder, &mut cargo, target, compiler.stage);
214209

215210
// Explicitly pass -p for all compiler crates -- this will force cargo
216-
// to also check the tests/benches/examples for these crates, rather
211+
// to also lint the tests/benches/examples for these crates, rather
217212
// than just the leaf crate.
218213
for krate in &*self.crates {
219214
cargo.arg("-p").arg(krate);
220215
}
221216

222-
let _guard = builder.msg_check(
217+
let _guard = builder.msg_clippy(
223218
format_args!("compiler artifacts{}", crate_description(&self.crates)),
224219
target,
225220
);

src/bootstrap/src/core/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use std::process::Command;
1313
use std::sync::OnceLock;
1414
use std::time::{Duration, Instant};
1515

16-
use crate::core::build_steps::{clippy, llvm};
1716
use crate::core::build_steps::tool::{self, SourceType};
1817
use crate::core::build_steps::{check, clean, compile, dist, doc, install, run, setup, test};
18+
use crate::core::build_steps::{clippy, llvm};
1919
use crate::core::config::flags::{Color, Subcommand};
2020
use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection};
2121
use crate::prepare_behaviour_dump_dir;
@@ -713,6 +713,7 @@ impl Kind {
713713
Kind::Doc => "Documenting",
714714
Kind::Run => "Running",
715715
Kind::Suggest => "Suggesting",
716+
Kind::Clippy => "Linting",
716717
_ => {
717718
let title_letter = self.as_str()[0..1].to_ascii_uppercase();
718719
return format!("{title_letter}{}ing", &self.as_str()[1..]);

src/bootstrap/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,16 @@ impl Build {
10671067
}
10681068
}
10691069

1070+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1071+
#[track_caller]
1072+
fn msg_clippy(
1073+
&self,
1074+
what: impl Display,
1075+
target: impl Into<Option<TargetSelection>>,
1076+
) -> Option<gha::Group> {
1077+
self.msg(Kind::Clippy, self.config.stage, what, self.config.build, target)
1078+
}
1079+
10701080
#[must_use = "Groups should not be dropped until the Step finishes running"]
10711081
#[track_caller]
10721082
fn msg_check(

0 commit comments

Comments
 (0)