From 64c077b16824970753bd64d0921db788981c6464 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Thu, 25 Jan 2024 12:10:17 +0100 Subject: [PATCH] handle first-time run with no arguments --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 3d75c81..3917e47 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,7 +76,10 @@ fn log_single(start: SystemTime) -> Option<()> { } fn print_day() -> Option<()> { - let history = fs::read_to_string("compiler_history.txt").unwrap_or_default(); + let Ok(history) = fs::read_to_string("compiler_history.txt") else { + println!("No history in this directory."); + return None; + }; let mut wasted_total = 0; let mut by_day = Vec::new();