summaryrefslogtreecommitdiffstats
path: root/2022/day1
diff options
context:
space:
mode:
authorYigit Sever2022-12-01 17:44:53 +0300
committerYigit Sever2022-12-01 17:44:53 +0300
commitdcb1c08422a46f1f43d7002a3d4790b713dd9eab (patch)
tree129ed6567d7db2feee87db1ec07682ba9c03cd1f /2022/day1
parent5055786d3db80e45a5c3f128f41866ea78865c45 (diff)
downloadaoc-dcb1c08422a46f1f43d7002a3d4790b713dd9eab.tar.gz
aoc-dcb1c08422a46f1f43d7002a3d4790b713dd9eab.tar.bz2
aoc-dcb1c08422a46f1f43d7002a3d4790b713dd9eab.zip
2022, day1: clippy
Diffstat (limited to '2022/day1')
-rw-r--r--2022/day1/part1/src/main.rs2
-rw-r--r--2022/day1/part2/src/main.rs2
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() {
4 let input: String = include_str!("../../input").to_string(); 4 let input: String = include_str!("../../input").to_string();
5 let mut calories: Vec<usize> = Vec::new(); 5 let mut calories: Vec<usize> = Vec::new();
6 6
7 for (key, group) in &input.lines().group_by(|line| *line != "") { 7 for (key, group) in &input.lines().group_by(|line| line.is_empty()) {
8 if key { 8 if key {
9 calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum()); 9 calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum());
10 } 10 }
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() {
4 let input: String = include_str!("../../input").to_string(); 4 let input: String = include_str!("../../input").to_string();
5 let mut calories: Vec<usize> = Vec::new(); 5 let mut calories: Vec<usize> = Vec::new();
6 6
7 for (key, group) in &input.lines().group_by(|line| *line != "") { 7 for (key, group) in &input.lines().group_by(|line| line.is_empty()) {
8 if key { 8 if key {
9 calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum()); 9 calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum());
10 } 10 }