summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2025-06-28 01:19:44 +0200
committermo8it <mo8it@proton.me>2025-06-28 01:43:41 +0200
commite8da6869f8e0a051e8768135b57950e9f8ed27b9 (patch)
treec9e42730e8b2fd81d5098210a39eaefdf936cbb0
parent57b3727b3e69d50c0b72aa41d79b8d16d47d58fa (diff)
Don't run rustfmt during `dev check` if there are no solutions
-rw-r--r--src/dev/check.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dev/check.rs b/src/dev/check.rs
index 9cde7f2..6ea8d89 100644
--- a/src/dev/check.rs
+++ b/src/dev/check.rs
@@ -354,16 +354,18 @@ fn check_solutions(
}
stdout.write_all(b"\n")?;
+ let n_solutions = sol_paths.len();
let handle = thread::Builder::new()
.spawn(move || check_unexpected_files("solutions", &sol_paths))
.context(
"Failed to spawn a thread to check for unexpected files in the solutions directory",
)?;
- if !fmt_cmd
- .status()
- .context("Failed to run `rustfmt` on all solution files")?
- .success()
+ if n_solutions > 0
+ && !fmt_cmd
+ .status()
+ .context("Failed to run `rustfmt` on all solution files")?
+ .success()
{
bail!("Some solutions aren't formatted. Run `rustfmt` on them");
}