From dcb1c08422a46f1f43d7002a3d4790b713dd9eab Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 1 Dec 2022 17:44:53 +0300 Subject: 2022, day1: clippy --- 2022/day1/part1/src/main.rs | 2 +- 2022/day1/part2/src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/2022/day1/part1/src/main.rs b/2022/day1/part1/src/main.rs index 637b4e3..a177d98 100644 --- a/2022/day1/part1/src/main.rs +++ b/2022/day1/part1/src/main.rs @@ -4,7 +4,7 @@ fn main() { let input: String = include_str!("../../input").to_string(); let mut calories: Vec = Vec::new(); - for (key, group) in &input.lines().group_by(|line| *line != "") { + for (key, group) in &input.lines().group_by(|line| line.is_empty()) { if key { calories.push(group.into_iter().map(|i| i.parse::().unwrap()).sum()); } diff --git a/2022/day1/part2/src/main.rs b/2022/day1/part2/src/main.rs index 2a65d1a..62175ab 100644 --- a/2022/day1/part2/src/main.rs +++ b/2022/day1/part2/src/main.rs @@ -4,7 +4,7 @@ fn main() { let input: String = include_str!("../../input").to_string(); let mut calories: Vec = Vec::new(); - for (key, group) in &input.lines().group_by(|line| *line != "") { + for (key, group) in &input.lines().group_by(|line| line.is_empty()) { if key { calories.push(group.into_iter().map(|i| i.parse::().unwrap()).sum()); } -- cgit v1.2.3-70-g09d2