diff --git a/day03/src/main.rs b/day03/src/main.rs index b565993..b5b13ee 100644 --- a/day03/src/main.rs +++ b/day03/src/main.rs @@ -11,7 +11,7 @@ fn main() { println!("{}", pt2(&input)); } -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] enum Inst { Mul(i64, i64), Do, @@ -56,13 +56,11 @@ fn parse_mul(input: &mut &str) -> PResult { } fn parse_do(input: &mut &str) -> PResult { - let _ = "do()".parse_next(input)?; - Ok(Inst::Do) + "do()".value(Inst::Do).parse_next(input) } fn parse_dont(input: &mut &str) -> PResult { - let _ = "don't()".parse_next(input)?; - Ok(Inst::Dont) + "don't()".value(Inst::Dont).parse_next(input) } fn parse_inst(input: &mut &str) -> PResult {