Skip to content

Commit

Permalink
into_iter over iter when possible
Browse files Browse the repository at this point in the history
Signed-off-by: Lance-Drane <ldraneutk@gmail.com>
  • Loading branch information
Lance-Drane committed Dec 3, 2023
1 parent 3211037 commit 0eed106
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/bin/search_movie_festival.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ fn solve<W: std::io::Write>(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
Expand Down
2 changes: 1 addition & 1 deletion src/bin/search_restaurant_customers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn solve<W: std::io::Write>(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)
Expand Down

0 comments on commit 0eed106

Please sign in to comment.