From e333fac39fba078468defd209c984561874d1501 Mon Sep 17 00:00:00 2001 From: Matthijs van der Vleuten Date: Sun, 1 Dec 2024 08:38:46 +0100 Subject: [PATCH] Avoid rewriting cache without changes --- src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6f30dd6..f23caff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -161,8 +161,8 @@ impl Aoc { let brief = http::get_brief(self)?; self.title = Some(brief.0); self.brief.insert(self.level, brief.1); + self.write()?; }; - self.write()?; Ok(self.brief.get(&self.level).unwrap().to_string()) } @@ -191,10 +191,9 @@ impl Aoc { if self.input.is_none() || force { let input = http::get_input(self)?; self.input = Some(input); + self.write()?; } - self.write()?; - Ok(self.input.clone().unwrap()) } @@ -207,8 +206,8 @@ impl Aoc { self.get_brief(true).ok(); // Update brief (force) to update stars self.add_star(); self.advance().unwrap_or(()); + self.write()?; } - self.write()?; Ok(resp) }