File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ use crate::{
17
17
CURRENT_FORMAT_VERSION ,
18
18
} ;
19
19
20
+ const MAX_N_EXERCISES : usize = 999 ;
20
21
const MAX_EXERCISE_NAME_LEN : usize = 32 ;
21
22
22
23
// Find a char that isn't allowed in the exercise's `name` or `dir`.
@@ -347,6 +348,10 @@ fn check_solutions(
347
348
pub fn check ( require_solutions : bool ) -> Result < ( ) > {
348
349
let info_file = InfoFile :: parse ( ) ?;
349
350
351
+ if info_file. exercises . len ( ) > MAX_N_EXERCISES {
352
+ bail ! ( "The maximum number of exercises is {MAX_N_EXERCISES}" ) ;
353
+ }
354
+
350
355
if cfg ! ( debug_assertions) {
351
356
// A hack to make `cargo run -- dev check` work when developing Rustlings.
352
357
check_cargo_toml ( & info_file. exercises , "dev/Cargo.toml" , b"../" ) ?;
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ pub fn progress_bar<'a>(
166
166
total : u16 ,
167
167
term_width : u16 ,
168
168
) -> io:: Result < ( ) > {
169
- debug_assert ! ( total < 1000 ) ;
169
+ debug_assert ! ( total <= 999 ) ;
170
170
debug_assert ! ( progress <= total) ;
171
171
172
172
const PREFIX : & [ u8 ] = b"Progress: [" ;
You can’t perform that action at this time.
0 commit comments