From 79c670037617df68097d68d9f81708b1c96bab75 Mon Sep 17 00:00:00 2001 From: jyn Date: Thu, 13 Jul 2023 03:05:09 -0500 Subject: [PATCH] Remove unnecessary `Builder::new_standalone` function --- src/bootstrap/builder.rs | 15 --------------- src/bootstrap/suggest.rs | 17 +++++++++-------- 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 @@ pub fn new(build: &Build) -> Builder<'_> { 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, - stage: Option, - ) -> 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::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");