From f1eea338c32bd3dcfaac908406199d1f27c2c4d8 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Mon, 28 Dec 2015 11:13:44 -0800 Subject: [PATCH] Allow dead code, use a macro for importing days --- rust/src/day_02.rs | 1 + rust/src/lib.rs | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/rust/src/day_02.rs b/rust/src/day_02.rs index 0eccd5d..be5a315 100644 --- a/rust/src/day_02.rs +++ b/rust/src/day_02.rs @@ -23,6 +23,7 @@ struct Present { height: u32, } +#[allow(dead_code)] impl Present { fn new(input: &str) -> Self { let dimensions = input.split("x") diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 507339b..3fbf4e5 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,7 +1,12 @@ -pub use day::Day; -mod day; +macro_rules! import_day { + ( $( $d:ident ),* ) => { + $( + pub use $d::*; + mod $d; + )* + } +} -pub use day_01::Day01; -pub use day_02::Day02; -mod day_01; -mod day_02; +import_day!(day, + day_01, + day_02);