From 2c051d3780cddb9de5c610a314e80d6d5cabc8ad Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Sat, 6 Apr 2024 18:04:08 -0700 Subject: clean up some return stuff Change-Id: Ie27f7b6882f36af551e1c2fd505248d50691b160 --- src/main.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 987bce0..2775410 100644 --- a/src/main.rs +++ b/src/main.rs @@ -503,7 +503,7 @@ fn register_char(c: char, state: &mut RPState) -> Result<(), Exit> { fn eval(input: &str, state: &mut RPState) -> Result<(), Exit> { for (_cpos, c) in input.char_indices() { - let res = match state.mode { + match state.mode { Mode::CommandChar => command_char(c, state), Mode::CommandNamed => command_str(c, state), Mode::Integer => integer(c, state), @@ -511,18 +511,15 @@ fn eval(input: &str, state: &mut RPState) -> Result<(), Exit> { Mode::Str => string(c, state), Mode::RegisterChar => register_char(c, state), Mode::RegisterStr => register_str(c, state), - }; - if res.is_err() { - return res - } + }?; } match state.mode { Mode::Integer | Mode::Decimal => { return finish_num(' ', state) }, - _ => {} + _ => { } }; - return Ok(()); + Ok(()) } -- cgit 1.4.1