diff --git a/src/tasks/day03.rs b/src/tasks/day03.rs index 0413044..8e8c02c 100644 --- a/src/tasks/day03.rs +++ b/src/tasks/day03.rs @@ -102,11 +102,9 @@ fn task2(p1: &Vec<&str>, p2: &Vec<&str>) { } fn get_points(path: &Vec<&str>) -> HashMap<(i32, i32), usize> { - let mut directions = HashMap::new(); - directions.insert('U', (0, 1)); - directions.insert('D', (0, -1)); - directions.insert('L', (-1, 0)); - directions.insert('R', (1, 0)); + let directions = vec![('U', (0, 1)), ('D', (0, -1)), ('L', (-1, 0)), ('R', (1, 0))] + .into_iter() + .collect::>(); path.iter() .map(|it| { let direction = it.chars().next().unwrap();