create Builder::msg_clippy

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-03-22 18:15:18 +03:00
parent 81b7944163
commit 8a865a0fa9
3 changed files with 15 additions and 9 deletions

View File

@ -134,16 +134,11 @@ impl Step for Std {
std_cargo(builder, target, compiler.stage, &mut cargo); std_cargo(builder, target, compiler.stage, &mut cargo);
if matches!(builder.config.cmd, Subcommand::Fix { .. }) {
// By default, cargo tries to fix all targets. Tell it not to fix tests until we've added `test` to the sysroot.
cargo.arg("--lib");
}
for krate in &*self.crates { for krate in &*self.crates {
cargo.arg("-p").arg(krate); cargo.arg("-p").arg(krate);
} }
let _guard = builder.msg_check( let _guard = builder.msg_clippy(
format_args!("library artifacts{}", crate_description(&self.crates)), format_args!("library artifacts{}", crate_description(&self.crates)),
target, target,
); );
@ -213,13 +208,13 @@ impl Step for Rustc {
rustc_cargo(builder, &mut cargo, target, compiler.stage); rustc_cargo(builder, &mut cargo, target, compiler.stage);
// Explicitly pass -p for all compiler crates -- this will force cargo // Explicitly pass -p for all compiler crates -- this will force cargo
// to also check the tests/benches/examples for these crates, rather // to also lint the tests/benches/examples for these crates, rather
// than just the leaf crate. // than just the leaf crate.
for krate in &*self.crates { for krate in &*self.crates {
cargo.arg("-p").arg(krate); cargo.arg("-p").arg(krate);
} }
let _guard = builder.msg_check( let _guard = builder.msg_clippy(
format_args!("compiler artifacts{}", crate_description(&self.crates)), format_args!("compiler artifacts{}", crate_description(&self.crates)),
target, target,
); );

View File

@ -13,9 +13,9 @@ use std::process::Command;
use std::sync::OnceLock; use std::sync::OnceLock;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use crate::core::build_steps::{clippy, llvm};
use crate::core::build_steps::tool::{self, SourceType}; use crate::core::build_steps::tool::{self, SourceType};
use crate::core::build_steps::{check, clean, compile, dist, doc, install, run, setup, test}; use crate::core::build_steps::{check, clean, compile, dist, doc, install, run, setup, test};
use crate::core::build_steps::{clippy, llvm};
use crate::core::config::flags::{Color, Subcommand}; use crate::core::config::flags::{Color, Subcommand};
use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection}; use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection};
use crate::prepare_behaviour_dump_dir; use crate::prepare_behaviour_dump_dir;
@ -672,6 +672,7 @@ impl Kind {
Kind::Doc => "Documenting", Kind::Doc => "Documenting",
Kind::Run => "Running", Kind::Run => "Running",
Kind::Suggest => "Suggesting", Kind::Suggest => "Suggesting",
Kind::Clippy => "Linting",
_ => { _ => {
let title_letter = self.as_str()[0..1].to_ascii_uppercase(); let title_letter = self.as_str()[0..1].to_ascii_uppercase();
return format!("{title_letter}{}ing", &self.as_str()[1..]); return format!("{title_letter}{}ing", &self.as_str()[1..]);

View File

@ -1078,6 +1078,16 @@ impl Build {
} }
} }
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_clippy(
&self,
what: impl Display,
target: impl Into<Option<TargetSelection>>,
) -> Option<gha::Group> {
self.msg(Kind::Clippy, self.config.stage, what, self.config.build, target)
}
#[must_use = "Groups should not be dropped until the Step finishes running"] #[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller] #[track_caller]
fn msg_check( fn msg_check(