From 85d01d6f4f0a9e4c6b70843ce90f1fb5a6103a41 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 2 Dec 2022 15:30:36 -0500 Subject: [PATCH] use super for macro --- 2022/src/day_2.rs | 2 -- advent_of_code_macro/src/lib.rs | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/2022/src/day_2.rs b/2022/src/day_2.rs index 46d8a98..bfd69de 100644 --- a/2022/src/day_2.rs +++ b/2022/src/day_2.rs @@ -55,11 +55,9 @@ advent_of_code_macro::solve_problem!( input.lines().map(|line| line.split(' ').map(|s| s.chars().next().unwrap()).collect()).collect() }, part one |data: Input| { - use super::Shape; data.iter().map(|round| Shape::from_char(round[1]).result(&Shape::from_char(round[0]))).sum() }, part two |data: Input| { - use super::Shape; data.iter().map(|round| match round[1] { 'X' => Shape::from_char(round[0]).wins_to().as_int(), 'Y' => Shape::from_char(round[0]).as_int() + 3, diff --git a/advent_of_code_macro/src/lib.rs b/advent_of_code_macro/src/lib.rs index 0e0a7f9..6d24e29 100644 --- a/advent_of_code_macro/src/lib.rs +++ b/advent_of_code_macro/src/lib.rs @@ -10,6 +10,7 @@ macro_rules! solve_problem { #[cfg(test)] paste::paste! { mod [] { + use super::*; type Input = $input_type; fn parse_input(s: &str) -> Input { $parse_input(s)