Repository: rust-lang/rust
File: src/bootstrap/src/core/build_steps/test.rs (Rust)

Code before:
    /// Once tidy passes, this step also runs `fmt --check` if tests are being run
    /// for the `dev` or `nightly` channels.
    fn run(self, builder: &Builder<'_>) {
        let mut cmd = builder.tool_cmd(Tool::Tidy);
        cmd.arg(format!("--root-path={}", &builder.src.display()));
        cmd.arg(format!("--cargo-path={}", &builder.initial_cargo.display()));
        cmd.arg(format!("--output-dir={}", &builder.out.display()));
        // Tidy is heavily IO constrained. Still respect `-j`, but use a higher limit if `jobs` hasn't been configured.
        let jobs = builder.config.jobs.unwrap_or_else(|| {
            8 * std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32
        });
        cmd.arg(format!("--concurrency={jobs}"));
        // pass the path to the yarn command used for installing js deps.
        if let Some(yarn) = &builder.config.yarn {
            cmd.arg(format!("--npm-path={}", yarn.display()));
        } else {
            cmd.arg("--npm-path=yarn");
        }
        if builder.is_verbose() {
            cmd.arg("--verbose");
        }
        if builder.config.cmd.bless() {
            cmd.arg("--bless");
        }
        if builder.config.is_running_on_ci() {
            cmd.arg("--ci");
        }
        if let Some(s) =
            builder.config.cmd.extra_checks().or(builder.config.tidy_extra_checks.as_deref())
        {
            cmd.arg(format!("--extra-checks={s}"));
        }
        let mut args = std::env::args_os();
        if args.any(|arg| arg == OsStr::new("--")) {
            cmd.arg("--");
            cmd.args(args);
        }

        if builder.config.channel == "dev" || builder.config.channel == "nightly" {
            if !builder.config.json_output {
                builder.info("fmt check");
                if builder.config.initial_rustfmt.is_none() {
                    let inferred_rustfmt_dir = builder.initial_sysroot.join("bin");
                    eprintln!(
                        "\
ERROR: no `rustfmt` binary found in {PATH}
INFO: `rust.channel` is currently set to \"{CHAN}\"
HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `bootstrap.toml` file
HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`",
                        PATH = inferred_rustfmt_dir.display(),
                        CHAN = builder.config.channel,

Review comment (suggestion):
Same as with bootstrap, it would be more flexible if it was possible to set both `--ci=true` and `--ci=false`.

Code after:
    /// Once tidy passes, this step also runs `fmt --check` if tests are being run
    /// for the `dev` or `nightly` channels.
    fn run(self, builder: &Builder<'_>) {
        let mut cmd = builder.tool_cmd(Tool::Tidy);
        cmd.arg(format!("--root-path={}", &builder.src.display()));
        cmd.arg(format!("--cargo-path={}", &builder.initial_cargo.display()));
        cmd.arg(format!("--output-dir={}", &builder.out.display()));
        // Tidy is heavily IO constrained. Still respect `-j`, but use a higher limit if `jobs` hasn't been configured.
        let jobs = builder.config.jobs.unwrap_or_else(|| {
            8 * std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32
        });
        cmd.arg(format!("--concurrency={jobs}"));
        // pass the path to the yarn command used for installing js deps.
        if let Some(yarn) = &builder.config.yarn {
            cmd.arg(format!("--npm-path={}", yarn.display()));
        } else {
            cmd.arg("--npm-path=yarn");
        }
        if builder.is_verbose() {
            cmd.arg("--verbose");
        }
        if builder.config.cmd.bless() {
            cmd.arg("--bless");
        }
        if builder.config.is_running_on_ci() {
            cmd.arg("--ci=true");
        }
        if let Some(s) =
            builder.config.cmd.extra_checks().or(builder.config.tidy_extra_checks.as_deref())
        {
            cmd.arg(format!("--extra-checks={s}"));
        }
        let mut args = std::env::args_os();
        if args.any(|arg| arg == OsStr::new("--")) {
            cmd.arg("--");
            cmd.args(args);
        }

        if builder.config.channel == "dev" || builder.config.channel == "nightly" {
            if !builder.config.json_output {
                builder.info("fmt check");
                if builder.config.initial_rustfmt.is_none() {
                    let inferred_rustfmt_dir = builder.initial_sysroot.join("bin");
                    eprintln!(
                        "\
ERROR: no `rustfmt` binary found in {PATH}
INFO: `rust.channel` is currently set to \"{CHAN}\"
HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `bootstrap.toml` file
HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`",
                        PATH = inferred_rustfmt_dir.display(),
                        CHAN = builder.config.channel,