From 0eed106d11b0ad9df9eebec5dd7f977ad8396af3 Mon Sep 17 00:00:00 2001 From: Lance-Drane Date: Sun, 3 Dec 2023 00:51:22 -0500 Subject: [PATCH] into_iter over iter when possible Signed-off-by: Lance-Drane --- src/bin/search_movie_festival.rs | 6 +++--- src/bin/search_restaurant_customers.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/search_movie_festival.rs b/src/bin/search_movie_festival.rs index 6b8c667..f443722 100644 --- a/src/bin/search_movie_festival.rs +++ b/src/bin/search_movie_festival.rs @@ -72,12 +72,12 @@ fn solve(mut scan: UnsafeScanner, out: &mut W) { out, "{}", movies - .iter() + .into_iter() .fold((0, 0_u32), |(curr_end, count), (end, start)| { - if *start < curr_end { + if start < curr_end { (curr_end, count) } else { - (*end, count + 1) + (end, count + 1) } }) .1 diff --git a/src/bin/search_restaurant_customers.rs b/src/bin/search_restaurant_customers.rs index e2a3dc5..0639bba 100644 --- a/src/bin/search_restaurant_customers.rs +++ b/src/bin/search_restaurant_customers.rs @@ -71,7 +71,7 @@ fn solve(mut scan: UnsafeScanner, out: &mut W) { out, "{}", customers - .iter() + .into_iter() .fold((0, 0), |(best, current), shift| { let next = current + shift.1; (best.max(next), next)