Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #113732

Merged
merged 17 commits into from
Jul 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unnecessary Builder::new_standalone function
  • Loading branch information
jyn514 committed Jul 13, 2023
commit 79c670037617df68097d68d9f81708b1c96bab75
15 changes: 0 additions & 15 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
@@ -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);
}
17 changes: 9 additions & 8 deletions src/bootstrap/suggest.rs
Original file line number Diff line number Diff line change
@@ -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");