Skip to content

Commit 3c78eb7

Browse files
committed
skip formatting when --json-output is used
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent ae3703c commit 3c78eb7

File tree

1 file changed

+21
-11
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+21
-11
lines changed

Diff for: src/bootstrap/src/core/build_steps/test.rs

+21-11
Original file line numberDiff line numberDiff line change
@@ -1070,23 +1070,33 @@ impl Step for Tidy {
10701070
}
10711071

10721072
if builder.config.channel == "dev" || builder.config.channel == "nightly" {
1073-
builder.info("fmt check");
1074-
if builder.initial_rustfmt().is_none() {
1075-
let inferred_rustfmt_dir = builder.initial_sysroot.join("bin");
1076-
eprintln!(
1077-
"\
1073+
if !builder.config.json_output {
1074+
builder.info("fmt check");
1075+
if builder.initial_rustfmt().is_none() {
1076+
let inferred_rustfmt_dir = builder.initial_sysroot.join("bin");
1077+
eprintln!(
1078+
"\
10781079
ERROR: no `rustfmt` binary found in {PATH}
10791080
INFO: `rust.channel` is currently set to \"{CHAN}\"
10801081
HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `config.toml` file
10811082
HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`",
1082-
PATH = inferred_rustfmt_dir.display(),
1083-
CHAN = builder.config.channel,
1083+
PATH = inferred_rustfmt_dir.display(),
1084+
CHAN = builder.config.channel,
1085+
);
1086+
crate::exit!(1);
1087+
}
1088+
let all = false;
1089+
crate::core::build_steps::format::format(
1090+
builder,
1091+
!builder.config.cmd.bless(),
1092+
all,
1093+
&[],
1094+
);
1095+
} else {
1096+
println!(
1097+
"WARNING: `--json-output` is not supported on rustfmt, formatting will be skipped"
10841098
);
1085-
crate::exit!(1);
10861099
}
1087-
let all = false;
1088-
crate::core::build_steps::format::format(builder, !builder.config.cmd.bless(), all, &[
1089-
]);
10901100
}
10911101

10921102
builder.info("tidy check");

0 commit comments

Comments
 (0)