about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWaffle Lapkin <waffle.lapkin@gmail.com>2025-04-15 14:06:51 +0200
committerWaffle Lapkin <waffle.lapkin@gmail.com>2025-04-15 21:51:33 +0200
commit90aec1367481ab05c78fefad314e03b26e84564f (patch)
tree4558818a69650721eb2f8bc605542a7d800817f2
parent8934ac575988f2c15b7910d2f683b2792e5916cb (diff)
downloadrust-90aec1367481ab05c78fefad314e03b26e84564f.tar.gz
rust-90aec1367481ab05c78fefad314e03b26e84564f.zip
commit rustfmt stump in `x t tidy` even on `check`
If checking succeeded, it's equivalent to successfully formatting.
-rw-r--r--src/bootstrap/src/core/build_steps/format.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs
index 6641c4b4e13..9da8b27a917 100644
--- a/src/bootstrap/src/core/build_steps/format.rs
+++ b/src/bootstrap/src/core/build_steps/format.rs
@@ -336,7 +336,10 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
         crate::exit!(1);
     }
 
-    if !check {
-        update_rustfmt_version(build);
-    }
+    // Update `build/.rustfmt-stamp`, allowing this code to ignore files which have not been changed
+    // since last merge.
+    //
+    // NOTE: Because of the exit above, this is only reachable if formatting / format checking
+    // succeeded. So we are not commiting the version if formatting was not good.
+    update_rustfmt_version(build);
 }