From f205ee3d4c6f259c82e4f1226acc6a5ae5e70031 Mon Sep 17 00:00:00 2001 From: mo8it Date: Sun, 24 Mar 2024 18:50:46 +0100 Subject: [PATCH] Call looks_done only once --- src/main.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 067c810..f646fdc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -149,17 +149,15 @@ fn main() { let filter_cond = filters .iter() .any(|f| exercise.name.contains(f) || fname.contains(f)); - let status = if exercise.looks_done() { + let looks_done = exercise.looks_done(); + let status = if looks_done { exercises_done += 1; "Done" } else { "Pending" }; - let solve_cond = { - (exercise.looks_done() && solved) - || (!exercise.looks_done() && unsolved) - || (!solved && !unsolved) - }; + let solve_cond = + (looks_done && solved) || (!looks_done && unsolved) || (!solved && !unsolved); if solve_cond && (filter_cond || filter.is_none()) { let line = if paths { format!("{fname}\n")