From d998cb02aa89e93dbad8371b0ed32834dec27bea Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 24 Dec 2020 02:06:29 +0100 Subject: [PATCH] 2020: day23: use rotate_left from VecDeque --- aoc2020/src/day23.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aoc2020/src/day23.rs b/aoc2020/src/day23.rs index ff6ac4f..cd27a66 100644 --- a/aoc2020/src/day23.rs +++ b/aoc2020/src/day23.rs @@ -53,8 +53,7 @@ impl CupCircle { /// This doesn't change anything to the cup circle layout, except that the new first cup is /// considered the "current" cup at the end of a step in our implementation fn shift(&mut self) { - let front = self.0.pop_front().unwrap(); - self.0.push_back(front); + self.0.rotate_left(1); } /// Executes one step of the game