diff options
| author | mo8it <mo8it@proton.me> | 2024-08-20 14:32:47 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-08-20 14:32:47 +0200 |
| commit | 8854f0a5ed2a0a3cd26ba1959ee8d0ec41798143 (patch) | |
| tree | 08253948984dcfbb4602678fc1a5926a82a5a727 | |
| parent | 13cc3acdfdcff91c059f4153c694464750a67b82 (diff) | |
Use anyhow!
| -rw-r--r-- | src/dev/check.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/dev/check.rs b/src/dev/check.rs index 6f16e0b..6ad1981 100644 --- a/src/dev/check.rs +++ b/src/dev/check.rs @@ -229,7 +229,6 @@ fn check_exercises(info_file: &InfoFile, cmd_runner: &CmdRunner) -> Result<()> { enum SolutionCheck { Success { sol_path: String }, - MissingRequired, MissingOptional, RunFailure { output: Vec<u8> }, Err(Error), @@ -252,7 +251,10 @@ fn check_solutions( let sol_path = exercise_info.sol_path(); if !Path::new(&sol_path).exists() { if require_solutions { - return SolutionCheck::MissingRequired; + return SolutionCheck::Err(anyhow!( + "The solution of the exercise {} is missing", + exercise_info.name, + )); } return SolutionCheck::MissingOptional; @@ -296,12 +298,6 @@ fn check_solutions( fmt_cmd.arg(&sol_path); sol_paths.insert(PathBuf::from(sol_path)); } - SolutionCheck::MissingRequired => { - bail!( - "The solution of the exercise {} is missing", - exercise_info.name, - ); - } SolutionCheck::MissingOptional => (), SolutionCheck::RunFailure { output } => { stdout.write_all(b"\n\n")?; |
