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<()> {
|
pub fn main() -> io::Result<()> {
|
||||||
let f = BufReader::new(File::open("day1-input.txt")?);
|
let f = BufReader::new(File::open("day1-input.txt")?);
|
||||||
let masses: Vec<u64> = f
|
let total: u64 = f
|
||||||
.lines()
|
.lines()
|
||||||
.map(|line| line.unwrap().parse().unwrap())
|
.map(|line| line.unwrap().parse().unwrap())
|
||||||
.collect();
|
.map(total_fuel)
|
||||||
let total: u64 = masses.into_iter().map(total_fuel).sum();
|
.sum();
|
||||||
println!("Fuel needed for bringing Santa home is: {}", total);
|
println!("Fuel needed for bringing Santa home is: {}", total);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue