1
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

View File

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