Remove redundant into_iter and collect
This commit is contained in:
parent
74cd67ddfc
commit
39235ce0cf
1 changed files with 3 additions and 3 deletions
|
@ -13,11 +13,11 @@ fn total_fuel(mass: u64) -> u64 {
|
|||
|
||||
pub fn main() -> io::Result<()> {
|
||||
let f = BufReader::new(File::open("day1-input.txt")?);
|
||||
let masses: Vec<u64> = f
|
||||
let total: u64 = f
|
||||
.lines()
|
||||
.map(|line| line.unwrap().parse().unwrap())
|
||||
.collect();
|
||||
let total: u64 = masses.into_iter().map(total_fuel).sum();
|
||||
.map(total_fuel)
|
||||
.sum();
|
||||
println!("Fuel needed for bringing Santa home is: {}", total);
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue