~janbaudisch/euler-rs

93c1fc2eb54dab7595c7796e54a379bd544d0c3d — Jan Baudisch 4 years ago e10d50a
update format
6 files changed, 12 insertions(+), 13 deletions(-)

D .rustfmt.toml
M common/src/format/binary.rs
M common/src/input.rs
M common/src/math/fibonacci.rs
M problem_019/src/date.rs
M problem_019/src/main.rs
D .rustfmt.toml => .rustfmt.toml +0 -1
@@ 1,1 0,0 @@
trailing_comma = "Never"

M common/src/format/binary.rs => common/src/format/binary.rs +2 -2
@@ 1,7 1,7 @@
#[derive(Clone, Copy, PartialEq)]
pub enum Bit {
    One,
    Zero
    Zero,
}

pub trait ToBinary {


@@ 25,7 25,7 @@ macro_rules! impl_to_binary {
                    match remainder {
                        0 => bits.push(Bit::Zero),
                        1 => bits.push(Bit::One),
                        _ => bits.push(Bit::Zero)
                        _ => bits.push(Bit::Zero),
                    }

                    n /= 2;

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 common/src/math/fibonacci.rs => common/src/math/fibonacci.rs +1 -1
@@ 2,7 2,7 @@ pub fn fibonacci(n: u64) -> u64 {
    match n {
        0 => 1,
        1 => 1,
        _ => fibonacci(n - 1) + fibonacci(n - 2)
        _ => fibonacci(n - 1) + fibonacci(n - 2),
    }
}


M problem_019/src/date.rs => problem_019/src/date.rs +6 -6
@@ 2,7 2,7 @@ pub struct Date {
    pub weekday: Weekday,
    pub day: u8,
    pub month: Month,
    pub year: u16
    pub year: u16,
}

impl Date {


@@ 36,7 36,7 @@ impl Date {
            weekday,
            day,
            month,
            year
            year,
        }
    }
}


@@ 49,7 49,7 @@ pub enum Weekday {
    Thursday,
    Friday,
    Saturday,
    Sunday
    Sunday,
}

impl Weekday {


@@ 61,7 61,7 @@ impl Weekday {
            Weekday::Thursday => Weekday::Friday,
            Weekday::Friday => Weekday::Saturday,
            Weekday::Saturday => Weekday::Sunday,
            Weekday::Sunday => Weekday::Monday
            Weekday::Sunday => Weekday::Monday,
        }
    }
}


@@ 79,7 79,7 @@ pub enum Month {
    September,
    October,
    November,
    December
    December,
}

impl Month {


@@ 96,7 96,7 @@ impl Month {
            Month::September => Month::October,
            Month::October => Month::November,
            Month::November => Month::December,
            Month::December => Month::January
            Month::December => Month::January,
        }
    }


M problem_019/src/main.rs => problem_019/src/main.rs +1 -1
@@ 7,7 7,7 @@ fn main() {
        weekday: Weekday::Monday,
        day: 1,
        month: Month::January,
        year: 1900
        year: 1900,
    };

    let mut count = 0;