diff --git a/src/template/commands/scaffold.rs b/src/template/commands/scaffold.rs index 382283d..2a992bc 100644 --- a/src/template/commands/scaffold.rs +++ b/src/template/commands/scaffold.rs @@ -6,7 +6,9 @@ use std::{ use crate::Day; -const MODULE_TEMPLATE: &str = r#"pub fn part_one(input: &str) -> Option { +const MODULE_TEMPLATE: &str = r#"advent_of_code::solution!(DAY_NUMBER); + +pub fn part_one(input: &str) -> Option { None } @@ -14,8 +16,6 @@ pub fn part_two(input: &str) -> Option { None } -advent_of_code::main!(DAY_NUMBER); - #[cfg(test)] mod tests { use super::*; diff --git a/src/template/mod.rs b/src/template/mod.rs index 215f039..4403b95 100644 --- a/src/template/mod.rs +++ b/src/template/mod.rs @@ -19,9 +19,9 @@ pub fn read_file(folder: &str, day: Day) -> String { f.expect("could not open input file") } -/// main! produces a block setting up the input and runner for each part. +/// Creates the constant `DAY` and sets up the input and runner for each part. #[macro_export] -macro_rules! main { +macro_rules! solution { ($day:expr) => { /// The current day. const DAY: advent_of_code::Day = advent_of_code::day!($day);