2020: day23: remove TODOs

std::cmp::Ord::clamp can't really help in this situation, not sure what
I had in mind
This commit is contained in:
Antoine Martin 2021-12-03 16:36:25 +01:00
parent d54bddde27
commit e8a36de2b4

View file

@ -71,8 +71,6 @@ impl CupCircle {
// keep subtracting one until it finds a cup that wasn't just picked up. If at any point in // keep subtracting one until it finds a cup that wasn't just picked up. If at any point in
// this process the value goes below the lowest value on any cup's label, it wraps around to // this process the value goes below the lowest value on any cup's label, it wraps around to
// the highest value on any cup's label instead. // the highest value on any cup's label instead.
//
// TODO: use std::cmp::Ord::clamp when stabilized (Rust 1.50)
let mut destination = if current > 1 { current - 1 } else { self.max() }; let mut destination = if current > 1 { current - 1 } else { self.max() };
while removed_cups.contains(&destination) { while removed_cups.contains(&destination) {
destination = if destination > 1 { destination = if destination > 1 {
@ -193,8 +191,6 @@ impl FastCupCircle {
// keep subtracting one until it finds a cup that wasn't just picked up. If at any point in // keep subtracting one until it finds a cup that wasn't just picked up. If at any point in
// this process the value goes below the lowest value on any cup's label, it wraps around to // this process the value goes below the lowest value on any cup's label, it wraps around to
// the highest value on any cup's label instead. // the highest value on any cup's label instead.
//
// TODO: use std::cmp::Ord::clamp when stabilized (Rust 1.50)
let mut destination = if self.current > 1 { let mut destination = if self.current > 1 {
self.current - 1 self.current - 1
} else { } else {