Skip to content

Commit cb4b7f6

Browse files
committed
Extend msg and description to work with any subcommand
Previously `description` only supported `Testing` and `Benchmarking`, and `msg` gave weird results for `doc` (it would say `Docing`).
1 parent 20372f1 commit cb4b7f6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/bootstrap/builder.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,16 @@ impl Kind {
644644
}
645645
}
646646

647-
pub fn test_description(&self) -> &'static str {
647+
pub fn description(&self) -> String {
648648
match self {
649649
Kind::Test => "Testing",
650650
Kind::Bench => "Benchmarking",
651-
_ => panic!("not a test command: {}!", self.as_str()),
651+
Kind::Doc => "Documenting",
652+
Kind::Run => "Running",
653+
Kind::Suggest => "Suggesting",
654+
_ => return format!("{self:?}"),
652655
}
656+
.to_owned()
653657
}
654658
}
655659

src/bootstrap/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,8 @@ impl Build {
10201020
host: impl Into<Option<TargetSelection>>,
10211021
target: impl Into<Option<TargetSelection>>,
10221022
) -> Option<gha::Group> {
1023-
let action = action.into();
1024-
let msg = |fmt| format!("{action:?}ing stage{stage} {what}{fmt}");
1023+
let action = action.into().description();
1024+
let msg = |fmt| format!("{action} stage{stage} {what}{fmt}");
10251025
let msg = if let Some(target) = target.into() {
10261026
let host = host.into().unwrap();
10271027
if host == target {

src/bootstrap/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl Step for CrateBootstrap {
101101
);
102102
builder.info(&format!(
103103
"{} {} stage0 ({})",
104-
builder.kind.test_description(),
104+
builder.kind.description(),
105105
path,
106106
bootstrap_host,
107107
));

0 commit comments

Comments
 (0)