1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-28 08:58:48 +02:00

The number of exercises can't be zero, but still

This commit is contained in:
mo8it 2024-08-29 00:32:58 +02:00
parent afc320bed4
commit 789492d1a9

View File

@ -301,7 +301,7 @@ impl AppState {
// Return the index of the next pending exercise or `None` if all exercises are done.
fn next_pending_exercise_ind(&self) -> Option<usize> {
if self.current_exercise_ind == self.exercises.len() - 1 {
if self.current_exercise_ind + 1 == self.exercises.len() {
// The last exercise is done.
// Search for exercises not done from the start.
return self.exercises[..self.current_exercise_ind]