Skip to content

Commit 990a722

Browse files
committed
Limit the maximum number of exercises to 999
1 parent a675cb5 commit 990a722

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/dev/check.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::{
1717
CURRENT_FORMAT_VERSION,
1818
};
1919

20+
const MAX_N_EXERCISES: usize = 999;
2021
const MAX_EXERCISE_NAME_LEN: usize = 32;
2122

2223
// Find a char that isn't allowed in the exercise's `name` or `dir`.
@@ -347,6 +348,10 @@ fn check_solutions(
347348
pub fn check(require_solutions: bool) -> Result<()> {
348349
let info_file = InfoFile::parse()?;
349350

351+
if info_file.exercises.len() > MAX_N_EXERCISES {
352+
bail!("The maximum number of exercises is {MAX_N_EXERCISES}");
353+
}
354+
350355
if cfg!(debug_assertions) {
351356
// A hack to make `cargo run -- dev check` work when developing Rustlings.
352357
check_cargo_toml(&info_file.exercises, "dev/Cargo.toml", b"../")?;

src/term.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub fn progress_bar<'a>(
166166
total: u16,
167167
term_width: u16,
168168
) -> io::Result<()> {
169-
debug_assert!(total < 1000);
169+
debug_assert!(total <= 999);
170170
debug_assert!(progress <= total);
171171

172172
const PREFIX: &[u8] = b"Progress: [";

0 commit comments

Comments
 (0)