From 64851dd68b2c3a39f46c4cf271aca9d501c0abf1 Mon Sep 17 00:00:00 2001 From: "max.nuding" Date: Thu, 1 Dec 2022 07:23:51 +0100 Subject: [PATCH] Fix part 1 feature flag --- src/day01/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/day01/mod.rs b/src/day01/mod.rs index 0542716..8d24e2c 100644 --- a/src/day01/mod.rs +++ b/src/day01/mod.rs @@ -2,9 +2,9 @@ use crate::read; pub fn run() { let input = read("01"); - let set = vec![0]; + let elves = vec![0]; - let mut res = input.lines().fold(set, |mut acc, x|{ + let mut elves = input.lines().fold(elves, |mut acc, x|{ if x.is_empty() { acc.push(0); } else { @@ -13,18 +13,18 @@ pub fn run() { } acc }); - res.sort(); - res.reverse(); + elves.sort(); + elves.reverse(); - #[cfg(feature="part2")] + #[cfg(feature="part1")] { - let a = res.first().unwrap(); + let a = elves.first().unwrap(); eprintln!("Part 01: {}", *a); } #[cfg(feature="part2")] { - let b: i32 = res[..3].iter().sum(); + let b = elves[..3].iter().sum::(); eprintln!("Part 02: {}", b); } }