day10: part2 refactor

master
Avril 4 years ago
parent 3713a81fdd
commit 16906160e0
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -92,9 +92,6 @@ impl Deffered
fn rec_part2(map: Arc<Adaptors>, cache: Arc<Cache>, lock: Semaphore<()>, max: u8, f: u8) -> usize fn rec_part2(map: Arc<Adaptors>, cache: Arc<Cache>, lock: Semaphore<()>, max: u8, f: u8) -> usize
{ {
if f == max {
return 1;
}
debug_assert!(f < max); debug_assert!(f < max);
match iterate_adaptor_chain(&map, None, f).map(|next| { match iterate_adaptor_chain(&map, None, f).map(|next| {
@ -121,7 +118,7 @@ fn rec_part2(map: Arc<Adaptors>, cache: Arc<Cache>, lock: Semaphore<()>, max: u8
} }
}).map(Deffered::into_value) }).map(Deffered::into_value)
.sum::<usize>() { .sum::<usize>() {
#[cold] 0 => panic!("eh"), #[cold] 0 => unreachable!(),
x => x, x => x,
} }
} }

Loading…
Cancel
Save