diff options
| author | mo8it <mo8it@proton.me> | 2024-04-25 03:25:45 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-04-25 03:25:45 +0200 |
| commit | 2af0cd9ccef07edf27abf7046dbe15e32d1b476d (patch) | |
| tree | f47e1c3e0232144910150759e768e5d346e53c09 /src/info_file.rs | |
| parent | f92d45fa685e308c009cdf09d341bda41fcf9c52 (diff) | |
Replace `mode` by `test` and `strict_clippy`
Diffstat (limited to 'src/info_file.rs')
| -rw-r--r-- | src/info_file.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/info_file.rs b/src/info_file.rs index 6938cd0..dbe4f08 100644 --- a/src/info_file.rs +++ b/src/info_file.rs @@ -2,18 +2,6 @@ use anyhow::{bail, Context, Error, Result}; use serde::Deserialize; use std::{fs, io::ErrorKind}; -// The mode of the exercise. -#[derive(Deserialize, Copy, Clone)] -#[serde(rename_all = "lowercase")] -pub enum Mode { - // The exercise should be compiled as a binary - Run, - // The exercise should be compiled as a test harness - Test, - // The exercise should be linted with clippy - Clippy, -} - // Deserialized from the `info.toml` file. #[derive(Deserialize)] pub struct ExerciseInfo { @@ -21,11 +9,17 @@ pub struct ExerciseInfo { pub name: String, // The exercise's directory inside the `exercises` directory pub dir: Option<String>, - // The mode of the exercise - pub mode: Mode, + #[serde(default = "default_true")] + pub test: bool, + #[serde(default)] + pub strict_clippy: bool, // The hint text associated with the exercise pub hint: String, } +#[inline] +const fn default_true() -> bool { + true +} impl ExerciseInfo { pub fn path(&self) -> String { |
