Skip to content

Commit

Permalink
Remove unneeded closure
Browse files Browse the repository at this point in the history
  • Loading branch information
mo8it committed Mar 26, 2024
1 parent e890285 commit a610fc1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,14 @@ fn watch(

clear_screen();

let to_owned_hint = |t: &Exercise| t.hint.to_owned();
let failed_exercise_hint = match verify(
exercises.iter(),
(0, exercises.len()),
verbose,
success_hints,
) {
Ok(_) => return Ok(WatchStatus::Finished),
Err(exercise) => Arc::new(Mutex::new(Some(to_owned_hint(exercise)))),
Err(exercise) => Arc::new(Mutex::new(Some(exercise.hint.clone()))),
};
spawn_watch_shell(&failed_exercise_hint, Arc::clone(&should_quit));
loop {
Expand Down Expand Up @@ -380,7 +379,7 @@ fn watch(
Err(exercise) => {
let mut failed_exercise_hint =
failed_exercise_hint.lock().unwrap();
*failed_exercise_hint = Some(to_owned_hint(exercise));
*failed_exercise_hint = Some(exercise.hint.clone());
}
}
}
Expand Down

0 comments on commit a610fc1

Please sign in to comment.