1
0
Fork 0

Less lines :p

This commit is contained in:
Pcornat 2022-12-08 22:08:30 +01:00
parent befbc009cc
commit c615d8f16a
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0
1 changed files with 4 additions and 3 deletions

View File

@ -4,7 +4,7 @@ fn mutual_inclusion(first_pair: &[u32], second_pair: &[u32]) -> bool {
}
pub fn solve_part1(file_path: &str) -> i32 {
let result = std::fs::read_to_string(file_path)
std::fs::read_to_string(file_path)
.expect("Please provide a text file as an argument.")
.lines()
.map(|line| {
@ -35,6 +35,7 @@ pub fn solve_part1(file_path: &str) -> i32 {
0
}
})
.collect::<Vec<i32>>();
result.iter().sum()
.collect::<Vec<i32>>()
.iter()
.sum()
}