about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-05-27 18:05:32 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-06-07 09:24:14 -0500
commitbd6409ddef6ae0be42e91c8c36ddbce984311773 (patch)
tree045f2c840c023d95a2cb217e35950d602f385701 /src/bootstrap
parent27b95016d45cd1c0dcaef014373d4bb04d5d30ef (diff)
downloadrust-bd6409ddef6ae0be42e91c8c36ddbce984311773.tar.gz
rust-bd6409ddef6ae0be42e91c8c36ddbce984311773.zip
Simplify handling of `initial_rustfmt`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/config.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 147a4a38c9c..2a6b54ce055 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -859,9 +859,6 @@ impl Config {
         set(&mut config.full_bootstrap, build.full_bootstrap);
         set(&mut config.extended, build.extended);
         config.tools = build.tools;
-        if build.rustfmt.is_some() {
-            config.initial_rustfmt = build.rustfmt;
-        }
         set(&mut config.verbose, build.verbose);
         set(&mut config.sanitizers, build.sanitizers);
         set(&mut config.profiler, build.profiler);
@@ -1154,17 +1151,12 @@ impl Config {
             set(&mut config.missing_tools, t.missing_tools);
         }
 
-        config.initial_rustfmt = config.initial_rustfmt.or_else({
-            let build = config.build;
-            let initial_rustc = &config.initial_rustc;
-
-            move || {
-                // Cargo does not provide a RUSTFMT environment variable, so we
-                // synthesize it manually.
-                let rustfmt = initial_rustc.with_file_name(exe("rustfmt", build));
+        config.initial_rustfmt = build.rustfmt.or_else(|| {
+            // Cargo does not provide a RUSTFMT environment variable, so we
+            // synthesize it manually.
+            let rustfmt = config.initial_rustc.with_file_name(exe("rustfmt", config.build));
 
-                if rustfmt.exists() { Some(rustfmt) } else { None }
-            }
+            if rustfmt.exists() { Some(rustfmt) } else { None }
         });
 
         // Now that we've reached the end of our configuration, infer the