about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-07-13 03:05:09 -0500
committerjyn <github@jyn.dev>2023-07-13 03:24:08 -0500
commit79c670037617df68097d68d9f81708b1c96bab75 (patch)
tree6d6025ac739d9e82d8b1a2c80769eea7c0dd2fa2
parent441972d18b05f8bd1bb2f05c0aad4f242ebe77a5 (diff)
downloadrust-79c670037617df68097d68d9f81708b1c96bab75.tar.gz
rust-79c670037617df68097d68d9f81708b1c96bab75.zip
Remove unnecessary `Builder::new_standalone` function
-rw-r--r--src/bootstrap/builder.rs15
-rw-r--r--src/bootstrap/suggest.rs17
2 files changed, 9 insertions, 23 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 68f73c0a853..bcac952c7a6 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -902,21 +902,6 @@ impl<'a> Builder<'a> {
         Self::new_internal(build, kind, paths.to_owned())
     }
 
-    /// Creates a new standalone builder for use outside of the normal process
-    pub fn new_standalone(
-        build: &mut Build,
-        kind: Kind,
-        paths: Vec<PathBuf>,
-        stage: Option<u32>,
-    ) -> Builder<'_> {
-        // FIXME: don't mutate `build`
-        if let Some(stage) = stage {
-            build.config.stage = stage;
-        }
-
-        Self::new_internal(build, kind, paths.to_owned())
-    }
-
     pub fn execute_cli(&self) {
         self.run_step_descriptions(&Builder::get_step_descriptions(self.kind), &self.paths);
     }
diff --git a/src/bootstrap/suggest.rs b/src/bootstrap/suggest.rs
index ff20ebec267..85278c70c94 100644
--- a/src/bootstrap/suggest.rs
+++ b/src/bootstrap/suggest.rs
@@ -4,10 +4,9 @@ use std::str::FromStr;
 
 use std::path::PathBuf;
 
-use crate::{
-    builder::{Builder, Kind},
-    tool::Tool,
-};
+use clap::Parser;
+
+use crate::{builder::Builder, tool::Tool};
 
 #[cfg(feature = "build-metrics")]
 pub fn suggest(builder: &Builder<'_>, run: bool) {
@@ -68,11 +67,13 @@ pub fn suggest(builder: &Builder<'_>, run: bool) {
     if run {
         for sug in suggestions {
             let mut build = builder.build.clone();
+            build.config.paths = sug.2;
+            build.config.cmd = crate::flags::Flags::parse_from([sug.0]).cmd;
+            if let Some(stage) = sug.1 {
+                build.config.stage = stage;
+            }
 
-            let builder =
-                Builder::new_standalone(&mut build, Kind::parse(&sug.0).unwrap(), sug.2, sug.1);
-
-            builder.execute_cli()
+            Builder::new(&build).execute_cli()
         }
     } else {
         println!("help: consider using the `--run` flag to automatically run suggested tests");