diff options
author | Irene Knapp <ireneista@irenes.space> | 2024-04-06 18:04:08 -0700 |
---|---|---|
committer | Irene Knapp <ireneista@irenes.space> | 2024-04-06 18:04:08 -0700 |
commit | 2c051d3780cddb9de5c610a314e80d6d5cabc8ad (patch) | |
tree | 2a91252f8fc4eab8daaee16e8c2a13122d17667d /src | |
parent | 57bc76545486914ff1b1dd39b6cdd4162a35d8ac (diff) |
clean up some return stuff
Change-Id: Ie27f7b6882f36af551e1c2fd505248d50691b160
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 11 |
1 files 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(()) } |