Remove unnecessary type annotations

This commit is contained in:
pjht 2022-12-03 08:16:20 -06:00
parent 69fe736ff0
commit 986ae7ef08
2 changed files with 7 additions and 17 deletions

View File

@ -6,30 +6,20 @@ pub fn input_generator(input: &str) -> Vec<Vec<u64>> {
.lines()
.collect::<Vec<_>>()
.split(|el| el == &"")
.map(|list| {
list.iter()
.map(|el| el.parse::<u64>().unwrap())
.collect::<Vec<_>>()
})
.collect::<Vec<_>>()
.map(|list| list.iter().map(|el| el.parse().unwrap()).collect())
.collect()
}
#[aoc(day1, part1)]
pub fn solve_part1(input: &[Vec<u64>]) -> u64 {
let mut sums = input
.iter()
.map(|el| el.iter().sum::<u64>())
.collect::<Vec<_>>();
let mut sums = input.iter().map(|el| el.iter().sum()).collect::<Vec<_>>();
sums.sort();
sums.pop().unwrap()
}
#[aoc(day1, part2)]
pub fn solve_part2(input: &[Vec<u64>]) -> u64 {
let mut sums = input
.iter()
.map(|el| el.iter().sum::<u64>())
.collect::<Vec<_>>();
let mut sums = input.iter().map(|el| el.iter().sum()).collect::<Vec<_>>();
sums.sort();
sums[sums.len() - 3..sums.len()].iter().sum::<u64>()
sums[sums.len() - 3..sums.len()].iter().sum()
}

View File

@ -98,7 +98,7 @@ pub fn input_generator_part1(input: &str) -> Vec<(Move, Move)> {
let (opp, you) = line.split_once(' ').unwrap();
(opp.parse().unwrap(), you.parse().unwrap())
})
.collect::<Vec<_>>()
.collect()
}
#[aoc(day2, part1)]
@ -117,7 +117,7 @@ pub fn input_generator_part2(input: &str) -> Vec<(Move, Outcome)> {
let (opp, outcome) = line.split_once(' ').unwrap();
(opp.parse().unwrap(), outcome.parse().unwrap())
})
.collect::<Vec<_>>()
.collect()
}
#[aoc(day2, part2)]