From a321ce3f224204cee5ffa27c35d3cf0051821cf7 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Thu, 18 Dec 2025 13:01:07 +0000 Subject: [PATCH] Revert "Minor refactor (inlining)" This reverts commit bb57673f8a01e77e42c38bbf5bab60fba8c63098. Actually, the symmetry with `is_repetition_2` is worth the slight extra verbosity. --- rust/puzzles/day2.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/puzzles/day2.rs b/rust/puzzles/day2.rs index 99bc697..bc9063d 100644 --- a/rust/puzzles/day2.rs +++ b/rust/puzzles/day2.rs @@ -57,7 +57,9 @@ fn is_repetition_2(n: usize) -> bool { fn is_repetition_n(n: usize) -> bool { let n = n.to_string(); - (1..(n.len() / 2 + 1)).any(|i| equal_chunks(&n, i)) + let l = n.len(); + let d = l / 2; + (1..(d + 1)).any(|i| equal_chunks(&n, i)) } fn equal_chunks(n: &String, i: usize) -> bool {