diff --git a/2018/day1/src/main.rs b/2018/day1/src/main.rs index da76224..ac89b7d 100644 --- a/2018/day1/src/main.rs +++ b/2018/day1/src/main.rs @@ -3,10 +3,7 @@ use std::io::{BufRead, BufReader}; use std::iter::Iterator; fn print_final_frequency(ints: &Vec) { - let mut frequency = 0; - for drift in ints { - frequency = frequency + drift; - } + let frequency: i32 = ints.iter().sum(); println!("frequency is {}", frequency) }