diff options
| author | mo8it <mo8it@proton.me> | 2024-10-14 15:57:44 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-10-14 15:57:44 +0200 |
| commit | 990a722852ab22b55db342f93ebe03e6ed122f7f (patch) | |
| tree | e7e2a573e57bed5ec2f076bd1bbb4b6d01626bf3 /src/dev/check.rs | |
| parent | a675cb5754309ba9997fd2344ab0a364688de430 (diff) | |
Limit the maximum number of exercises to 999
Diffstat (limited to 'src/dev/check.rs')
| -rw-r--r-- | src/dev/check.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dev/check.rs b/src/dev/check.rs index 5a7aaed..bd73ec8 100644 --- a/src/dev/check.rs +++ b/src/dev/check.rs @@ -17,6 +17,7 @@ use crate::{ CURRENT_FORMAT_VERSION, }; +const MAX_N_EXERCISES: usize = 999; const MAX_EXERCISE_NAME_LEN: usize = 32; // Find a char that isn't allowed in the exercise's `name` or `dir`. @@ -347,6 +348,10 @@ fn check_solutions( pub fn check(require_solutions: bool) -> Result<()> { let info_file = InfoFile::parse()?; + if info_file.exercises.len() > MAX_N_EXERCISES { + bail!("The maximum number of exercises is {MAX_N_EXERCISES}"); + } + if cfg!(debug_assertions) { // A hack to make `cargo run -- dev check` work when developing Rustlings. check_cargo_toml(&info_file.exercises, "dev/Cargo.toml", b"../")?; |
