From 36d76018ba2a02535ef94a88d4e7d180430fce3a Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Thu, 6 Jan 2022 23:34:13 +0100 Subject: [PATCH] Correct width calculation The original worked by accident --- 2021/src/day05.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/2021/src/day05.rs b/2021/src/day05.rs index 73286a6..007fba3 100644 --- a/2021/src/day05.rs +++ b/2021/src/day05.rs @@ -48,7 +48,11 @@ fn stripe( fn part_common(input: &mut dyn Read, diagonals: bool) -> String { let lines = read_input(input, parse_input); - let width = lines.iter().map(|&((_, x_max), _)| x_max).max().unwrap() as usize + 1; + let width = lines + .iter() + .map(|&(_, (x, _))| x as usize + 1) + .max() + .unwrap(); let mut once_map = BitSet::new(); let mut twice_map = BitSet::new();