From c7a1ecf2802fb97d96991239343a9065c0348abd Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 8 Dec 2019 15:56:08 +0100 Subject: [PATCH] 2019: da04: fix clippy lints --- aoc2019/src/day04.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aoc2019/src/day04.rs b/aoc2019/src/day04.rs index d11b981..09a2e06 100644 --- a/aoc2019/src/day04.rs +++ b/aoc2019/src/day04.rs @@ -59,11 +59,11 @@ fn part2(begin: usize, end: usize) -> Result { let mut pair = false; let mut count = 1; let mut prev = digits[0]; - for i in 1..digits.len() { - if prev > digits[i] { + for digit in digits.iter().skip(1) { + if prev > *digit { ordered = false; break; - } else if prev == digits[i] { + } else if prev == *digit { count += 1; } else { if count == 2 { @@ -72,7 +72,7 @@ fn part2(begin: usize, end: usize) -> Result { count = 1; } - prev = digits[i]; + prev = *digit; } pair = pair || count == 2;