From a40e84a759d063226ef1394df39e75bdaaa449a8 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Tue, 17 Dec 2024 16:39:39 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20`solution!`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/template/mod.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/template/mod.rs b/src/template/mod.rs index a83b35f..54f7ec1 100644 --- a/src/template/mod.rs +++ b/src/template/mod.rs @@ -41,16 +41,6 @@ pub fn read_file_part(folder: &str, day: Day, part: u8) -> String { /// The optional, second parameter (1 or 2) allows you to only run a single part of the solution. #[macro_export] macro_rules! solution { - ($day:expr) => { - $crate::solution!(@impl $crate::day!($day), [part_one, 1] [part_two, 2]); - }; - ($day:expr, 1) => { - $crate::solution!(@impl $crate::day!($day), [part_one, 1]); - }; - ($day:expr, 2) => { - $crate::solution!(@impl $crate::day!($day), [part_two, 2]); - }; - () => { $crate::solution!(@impl $crate::day_from_file_name!(), [part_one, 1] [part_two, 2]); }; @@ -64,6 +54,16 @@ macro_rules! solution { $crate::solution!(@impl $crate::day_from_file_name!(), [part_two, 2]); }; + ($day:expr) => { + $crate::solution!(@impl $crate::day!($day), [part_one, 1] [part_two, 2]); + }; + ($day:expr, 1) => { + $crate::solution!(@impl $crate::day!($day), [part_one, 1]); + }; + ($day:expr, 2) => { + $crate::solution!(@impl $crate::day!($day), [part_two, 2]); + }; + (@impl $day:expr, $( [$func:expr, $part:expr] )*) => { /// The current day. const DAY: $crate::template::Day = $day;