Skip to content

Commit bd6409d

Browse files
committed
Simplify handling of initial_rustfmt
1 parent 27b9501 commit bd6409d

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/bootstrap/config.rs

+5-13
Original file line numberDiff line numberDiff line change
@@ -859,9 +859,6 @@ impl Config {
859859
set(&mut config.full_bootstrap, build.full_bootstrap);
860860
set(&mut config.extended, build.extended);
861861
config.tools = build.tools;
862-
if build.rustfmt.is_some() {
863-
config.initial_rustfmt = build.rustfmt;
864-
}
865862
set(&mut config.verbose, build.verbose);
866863
set(&mut config.sanitizers, build.sanitizers);
867864
set(&mut config.profiler, build.profiler);
@@ -1154,17 +1151,12 @@ impl Config {
11541151
set(&mut config.missing_tools, t.missing_tools);
11551152
}
11561153

1157-
config.initial_rustfmt = config.initial_rustfmt.or_else({
1158-
let build = config.build;
1159-
let initial_rustc = &config.initial_rustc;
1160-
1161-
move || {
1162-
// Cargo does not provide a RUSTFMT environment variable, so we
1163-
// synthesize it manually.
1164-
let rustfmt = initial_rustc.with_file_name(exe("rustfmt", build));
1154+
config.initial_rustfmt = build.rustfmt.or_else(|| {
1155+
// Cargo does not provide a RUSTFMT environment variable, so we
1156+
// synthesize it manually.
1157+
let rustfmt = config.initial_rustc.with_file_name(exe("rustfmt", config.build));
11651158

1166-
if rustfmt.exists() { Some(rustfmt) } else { None }
1167-
}
1159+
if rustfmt.exists() { Some(rustfmt) } else { None }
11681160
});
11691161

11701162
// Now that we've reached the end of our configuration, infer the

0 commit comments

Comments
 (0)