From 11304728b6607bc2a8d41a640308f3379a25b933 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 25 Jul 2022 15:29:11 +0200 Subject: Improve performance w/ a single feed loop --- src/construct/partial_space_or_tab.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/construct/partial_space_or_tab.rs') diff --git a/src/construct/partial_space_or_tab.rs b/src/construct/partial_space_or_tab.rs index 6eb3f1d..f13414a 100644 --- a/src/construct/partial_space_or_tab.rs +++ b/src/construct/partial_space_or_tab.rs @@ -149,7 +149,7 @@ fn start(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> State { } _ => { if info.options.min == 0 { - State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) + State::Ok(0) } else { State::Nok } @@ -173,7 +173,7 @@ fn inside(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> State { _ => { tokenizer.exit(info.options.kind.clone()); if info.size >= info.options.min { - State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) + State::Ok(0) } else { State::Nok } @@ -204,7 +204,7 @@ fn after_space_or_tab(tokenizer: &mut Tokenizer, code: Code, mut info: EolInfo) tokenizer.exit(Token::LineEnding); State::Fn(Box::new(|t, c| after_eol(t, c, info))) } - _ if info.ok => State::Ok(if matches!(code, Code::None) { 0 } else { 1 }), + _ if info.ok => State::Ok(0), _ => State::Nok, } } @@ -245,6 +245,6 @@ fn after_more_space_or_tab(_tokenizer: &mut Tokenizer, code: Code) -> State { ) { State::Nok } else { - State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) + State::Ok(0) } } -- cgit