From bd2bf0b92964706a449defd3a905a35845f3d7d2 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Sat, 30 Dec 2023 14:10:54 -0600 Subject: fix: fix error in days macro --- src/lib.rs | 14 +++++--------- src/main.rs | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 54ce211..ce7331a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,6 @@ array_windows, iter_intersperse, impl_trait_in_assoc_type, - macro_metavar_expr, slice_group_by )] @@ -33,24 +32,21 @@ pub use printer::Printer; pub type Result> = std::result::Result; -#[macro_export] -macro_rules! get_days { - // `()` indicates that the macro takes no argument. +macro_rules! days { ($($day:path),*) => { - pub fn get_days() -> [(&'static str, [Box anyhow::Result>; 2]); ${count(day)}] { - [ + pub fn days() -> Vec<(&'static str, [Box anyhow::Result>; 2])> { + vec![ $((<$day>::INPUT, [ Box::new(<$day>::part_1), Box::new(<$day>::part_2), - ]) - ,)* + ]),)* ] } }; } -get_days!( +days!( day_01::Day01, day_02::Day02, day_03::Day03, diff --git a/src/main.rs b/src/main.rs index 0883c66..acee1df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ fn main() -> Result<(), Box> { let mut args = std::env::args().skip(1); - let days = aoc_2023::get_days(); + let days = aoc_2023::days(); let days_n = if let Some(first) = args.next() { if "all".contains(first.as_str()) { -- cgit v1.2.3-70-g09d2