From 56ca0b72a869f9ff182a24aae6a0a432d34e1000 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sat, 21 Dec 2024 18:11:29 -0800 Subject: [PATCH] use .value() for instructions --- day03/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 {