diff --git a/rust/src/day_05.rs b/rust/src/day_05.rs index fa6be63..c98afc4 100644 --- a/rust/src/day_05.rs +++ b/rust/src/day_05.rs @@ -21,12 +21,7 @@ impl Day05 { } fn has_double_letters(string: &String) -> bool { - for win in string.as_bytes().windows(2) { - if win[0] == win[1] { - return true; - } - } - false + string.as_bytes().windows(2).any(|win| win[0] == win[1]) } fn has_no_substrings(string: &String) -> bool {