fix(review): address review feedback

Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com>
This commit is contained in:
Felix Spöttel 2023-12-10 13:51:22 +01:00
parent 00435287c9
commit c4b176de50

View file

@ -7,21 +7,14 @@ use crate::template::{all_days, readme_benchmarks, Day};
pub fn handle(day: Option<Day>, 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();