diff --git a/src/template/commands/time.rs b/src/template/commands/time.rs index fc6e42f..e3236f2 100644 --- a/src/template/commands/time.rs +++ b/src/template/commands/time.rs @@ -7,21 +7,14 @@ use crate::template::{all_days, readme_benchmarks, Day}; pub fn handle(day: Option, recreate_all: bool) { let stored_timings = Timings::read_from_file(); - let mut days_to_run = HashSet::new(); - - match day { - Some(day) => { - days_to_run.insert(day); + let days_to_run = day.map(|day| HashSet::from([day])).unwrap_or_else(|| { + if recreate_all { + all_days().collect() + } else { + // when the `--all` flag is not set, filter out days that are fully benched. + all_days().filter(|day| !stored_timings.is_day_complete(&day)).collect() } - None => { - all_days().for_each(|day| { - // when the `--all` flag is not set, filter out days that are fully benched. - if recreate_all || !stored_timings.is_day_complete(&day) { - days_to_run.insert(day); - } - }); - } - }; + }); let timings = run_multi(days_to_run, true, true).unwrap();