aoc: fix clippy warnings
This commit is contained in:
parent
899f9c193d
commit
fa32903fdc
|
@ -16,15 +16,14 @@ pub fn run(days: &[DayFunc]) -> Result<()> {
|
||||||
match args.next() {
|
match args.next() {
|
||||||
Some(arg) => {
|
Some(arg) => {
|
||||||
let day: usize = arg.parse().expect("Please provide a day number");
|
let day: usize = arg.parse().expect("Please provide a day number");
|
||||||
let res =
|
let res = days[day - 1]().map_err(|e| err!("error running day specified: {}", e))?;
|
||||||
days[day - 1]().or_else(|e| Err(err!("error running day specified: {}", e)))?;
|
|
||||||
println!("{}", res);
|
println!("{}", res);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
for (i, day) in days.iter().enumerate() {
|
for (i, day) in days.iter().enumerate() {
|
||||||
let i = i + 1;
|
let i = i + 1;
|
||||||
println!("day{}: ", i);
|
println!("day{}: ", i);
|
||||||
let res = day().or_else(|e| Err(err!("error running day {}: {}", i, e)))?;
|
let res = day().map_err(|e| err!("error running day {}: {}", i, e))?;
|
||||||
println!("{}", res);
|
println!("{}", res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue