From 9209659a5a16ba8faab250c42be8e59c71e005fb Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sat, 4 Dec 2021 15:22:35 +0100 Subject: [PATCH] 2021: day04: remove useless Grid field --- aoc2021/src/day04.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/aoc2021/src/day04.rs b/aoc2021/src/day04.rs index 2b0394e..2a39388 100644 --- a/aoc2021/src/day04.rs +++ b/aoc2021/src/day04.rs @@ -99,7 +99,6 @@ fn part2(input: &str) -> Result { #[derive(Debug, Clone)] struct Grid { number_to_pos: HashMap, - pos_to_number: HashMap<(usize, usize), u8>, grid: [bool; GRID_SIZE], rows: [u8; GRID_HEIGHT], cols: [u8; GRID_WIDTH], @@ -141,7 +140,6 @@ impl std::str::FromStr for Grid { fn from_str(s: &str) -> Result { let mut numbers = s.split_whitespace().map(str::parse); let mut number_to_pos = HashMap::new(); - let mut pos_to_number = HashMap::new(); for y in 0..GRID_HEIGHT { for x in 0..GRID_WIDTH { @@ -151,13 +149,11 @@ impl std::str::FromStr for Grid { .context("not enough numbers for grid")? .context("couldn't parse number:")?; number_to_pos.insert(number, pos); - pos_to_number.insert(pos, number); } } Ok(Grid { number_to_pos, - pos_to_number, grid: [false; GRID_SIZE], rows: [0; GRID_HEIGHT], cols: [0; GRID_WIDTH],