Skip to content

Commit e8da686

Browse files
committed
Don't run rustfmt during dev check if there are no solutions
1 parent 57b3727 commit e8da686

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/dev/check.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,18 @@ fn check_solutions(
354354
}
355355
stdout.write_all(b"\n")?;
356356

357+
let n_solutions = sol_paths.len();
357358
let handle = thread::Builder::new()
358359
.spawn(move || check_unexpected_files("solutions", &sol_paths))
359360
.context(
360361
"Failed to spawn a thread to check for unexpected files in the solutions directory",
361362
)?;
362363

363-
if !fmt_cmd
364-
.status()
365-
.context("Failed to run `rustfmt` on all solution files")?
366-
.success()
364+
if n_solutions > 0
365+
&& !fmt_cmd
366+
.status()
367+
.context("Failed to run `rustfmt` on all solution files")?
368+
.success()
367369
{
368370
bail!("Some solutions aren't formatted. Run `rustfmt` on them");
369371
}

0 commit comments

Comments
 (0)