@@ -33,31 +33,29 @@ fn main() {
33
33
. filter ( |solution| year. is_none_or ( |y : u32 | y == solution. year ) )
34
34
. filter ( |solution| day. is_none_or ( |d : u32 | d == solution. day ) ) ;
35
35
36
- // Pretty print output and timing for each solution
36
+ // Pretty print output for each solution.
37
37
let mut solved = 0 ;
38
38
let mut duration = Duration :: ZERO ;
39
39
40
40
for Solution { year, day, path, wrapper } in solutions {
41
41
if let Ok ( data) = read_to_string ( & path) {
42
42
let instant = Instant :: now ( ) ;
43
43
let ( part1, part2) = wrapper ( data) ;
44
- let elapsed = instant. elapsed ( ) ;
45
44
46
45
solved += 2 ;
47
- duration += elapsed;
46
+ duration += instant . elapsed ( ) ;
48
47
49
48
println ! ( "{BOLD}{YELLOW}{year} Day {day:02}{RESET}" ) ;
50
49
println ! ( " Part 1: {part1}" ) ;
51
50
println ! ( " Part 2: {part2}" ) ;
52
- println ! ( " Elapsed: {} μs" , elapsed. as_micros( ) ) ;
53
51
} else {
54
52
eprintln ! ( "{BOLD}{RED}{year} Day {day:02}{RESET}" ) ;
55
53
eprintln ! ( " Missing input!" ) ;
56
54
eprintln ! ( " Place input file in {BOLD}{WHITE}{}{RESET}" , path. display( ) ) ;
57
55
}
58
56
}
59
57
60
- // Optionally print totals
58
+ // Optionally print totals.
61
59
if args ( ) . any ( |a| a == "--totals" ) {
62
60
println ! ( "{BOLD}{YELLOW}⭐ {solved}{RESET}" ) ;
63
61
println ! ( "{BOLD}{WHITE}🕓 {} ms{RESET}" , duration. as_millis( ) ) ;
0 commit comments