diff --git a/2022/rust/src/solutions/day23.rs b/2022/rust/src/solutions/day23.rs index 6eb9517..624cec4 100644 --- a/2022/rust/src/solutions/day23.rs +++ b/2022/rust/src/solutions/day23.rs @@ -71,11 +71,11 @@ fn count_empty(elves: &Vec) -> usize { .count() } -fn round_iter(data: &HashSet) -> Box)>> { +fn round_iter(data: &HashSet) -> impl Iterator)> { let mut elves = Vec::from_iter(data.iter().copied()); let mut moves = VecDeque::from([move_n, move_s, move_w, move_e]); - Box::new(std::iter::repeat(()).map(move |_| { + std::iter::repeat(()).map(move |_| { let occupied = HashSet::from_iter(elves.iter().copied()); let mut planned = HashMap::>::new(); @@ -93,7 +93,7 @@ fn round_iter(data: &HashSet) -> Box)>> { moves.rotate_left(1); (changed, elves.clone()) - })) + }) } fn solve1(data: &HashSet) -> usize {