Remove unnecessary type annotations
This commit is contained in:
parent
69fe736ff0
commit
986ae7ef08
20
src/day01.rs
20
src/day01.rs
@ -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()
|
||||
}
|
||||
|
@ -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)]
|
||||
|
Loading…
Reference in New Issue
Block a user