about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-05-25 13:33:43 -0500
committerjyn <github@jyn.dev>2023-05-29 13:26:44 -0500
commitcb4b7f631980e6f78a486be46ec653ad322ce12e (patch)
treea460cef0837d7b1922ba30c3de1b50b914f3b8f3
parent20372f1817e9498f00100c149b4f47fc8ba00329 (diff)
downloadrust-cb4b7f631980e6f78a486be46ec653ad322ce12e.tar.gz
rust-cb4b7f631980e6f78a486be46ec653ad322ce12e.zip
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`).
-rw-r--r--src/bootstrap/builder.rs8
-rw-r--r--src/bootstrap/lib.rs4
-rw-r--r--src/bootstrap/test.rs2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index caab40fcd9d..b2e9ba144d6 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -644,12 +644,16 @@ impl Kind {
         }
     }
 
-    pub fn test_description(&self) -> &'static str {
+    pub fn description(&self) -> String {
         match self {
             Kind::Test => "Testing",
             Kind::Bench => "Benchmarking",
-            _ => panic!("not a test command: {}!", self.as_str()),
+            Kind::Doc => "Documenting",
+            Kind::Run => "Running",
+            Kind::Suggest => "Suggesting",
+            _ => return format!("{self:?}"),
         }
+        .to_owned()
     }
 }
 
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index fb76dffd071..f7d30de67eb 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1020,8 +1020,8 @@ impl Build {
         host: impl Into<Option<TargetSelection>>,
         target: impl Into<Option<TargetSelection>>,
     ) -> Option<gha::Group> {
-        let action = action.into();
-        let msg = |fmt| format!("{action:?}ing stage{stage} {what}{fmt}");
+        let action = action.into().description();
+        let msg = |fmt| format!("{action} stage{stage} {what}{fmt}");
         let msg = if let Some(target) = target.into() {
             let host = host.into().unwrap();
             if host == target {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 44cd84be705..25941fc64c5 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -101,7 +101,7 @@ impl Step for CrateBootstrap {
         );
         builder.info(&format!(
             "{} {} stage0 ({})",
-            builder.kind.test_description(),
+            builder.kind.description(),
             path,
             bootstrap_host,
         ));