Remove unnecessary Builder::new_standalone
function
This commit is contained in:
parent
441972d18b
commit
79c6700376
@ -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<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);
|
||||
}
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user