Skip to content

Commit ad87e92

Browse files
committed
no argument solves all days
1 parent 83aab40 commit ad87e92

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/helpers.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Helpers for AoC. Includes macros, reading functions, etc
22
33
use {
4-
crate::solutions,
54
std::fs::File,
65
std::io::{self, BufRead},
76
std::path::Path,
@@ -14,12 +13,13 @@ pub fn solve_day(day: u8) {
1413
/// macro takes a `dayXX` module and displays its `dayXX::pt1` and `dayXX::pt2` solutions
1514
macro_rules! solve {
1615
($dayXX:ident) => {{
17-
let (answer1, time1) = solutions::$dayXX::pt1(&filename);
18-
let (answer2, time2) = solutions::$dayXX::pt2(&filename);
16+
let (answer1, time1) = crate::solutions::$dayXX::pt1(&filename);
17+
let (answer2, time2) = crate::solutions::$dayXX::pt2(&filename);
1918

2019
println!("Day {day:02}");
2120
println!(" part 1: {answer1}, elapsed time: {time1} ms");
2221
println!(" part 2: {answer2}, elapsed time: {time2} ms");
22+
println!("");
2323
}};
2424
}
2525

@@ -50,7 +50,7 @@ pub fn solve_day(day: u8) {
5050
// 23 => solve!(day23),
5151
// 24 => solve!(day24),
5252
// 25 => solve!(day25),
53-
_ => println!("Day {day:02}\n not implemented!"),
53+
_ => println!("Day {day:02}\n not implemented!\n"),
5454
}
5555
}
5656

src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ use std::env;
33
mod helpers;
44
mod solutions;
55

6-
const SOLVED: [u8; 2] = [1, 2];
7-
86
fn main() {
97
// reading command line arguments
108
let args: Vec<String> = env::args().collect();
119

1210
if args.len() == 1 {
1311
// if no arguments given, run all available solutions
14-
SOLVED.into_iter().for_each(|day| {
12+
(1..=25).for_each(|day| {
1513
helpers::solve_day(day);
1614
})
1715
} else {

0 commit comments

Comments
 (0)