~janbaudisch/aoc-2019

10431400a06317b188fa9d5814e995f98264812a — Jan Baudisch 4 years ago ca4efb1
fix format
2 files changed, 10 insertions(+), 4 deletions(-)

M common/src/input.rs
M day_01/src/main.rs
M common/src/input.rs => common/src/input.rs +2 -2
@@ 7,7 7,7 @@ pub fn read_line() -> String {
        Ok(_) => {
            input.pop();
        }
        Err(error) => panic!("{}", error)
        Err(error) => panic!("{}", error),
    }

    input


@@ 29,7 29,7 @@ pub fn read_lines() -> Vec<String> {

                lines.push(input.clone());
            }
            Err(error) => panic!("{}", error)
            Err(error) => panic!("{}", error),
        }
    }


M day_01/src/main.rs => day_01/src/main.rs +8 -2
@@ 7,13 7,19 @@ fn main() {
        .map(|x| calculate_fuel(&x) as u32)
        .collect();

    println!("[PART ONE] sum of the fuel requirements: {}", fuel.iter().sum::<u32>());
    println!(
        "[PART ONE] sum of the fuel requirements: {}",
        fuel.iter().sum::<u32>()
    );

    for f in fuel.iter_mut() {
        *f += calculate_fuel_recursive(f);
    }

    println!("[PART TWO] sum of the fuel requirements: {}", fuel.iter().sum::<u32>());
    println!(
        "[PART TWO] sum of the fuel requirements: {}",
        fuel.iter().sum::<u32>()
    );
}

fn calculate_fuel(mass: &u32) -> i32 {