From 6ba11bdaca1721fb4591819604c340d147798f45 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 12 Aug 2022 17:02:01 +0200 Subject: Remove `match` statements if clumsy --- src/construct/character_escape.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/construct/character_escape.rs') diff --git a/src/construct/character_escape.rs b/src/construct/character_escape.rs index 494f1d2..ac91c29 100644 --- a/src/construct/character_escape.rs +++ b/src/construct/character_escape.rs @@ -44,15 +44,14 @@ use crate::tokenizer::Tokenizer; /// ^ /// ``` pub fn start(tokenizer: &mut Tokenizer) -> State { - match tokenizer.current { - Some(b'\\') if tokenizer.parse_state.constructs.character_escape => { - tokenizer.enter(Name::CharacterEscape); - tokenizer.enter(Name::CharacterEscapeMarker); - tokenizer.consume(); - tokenizer.exit(Name::CharacterEscapeMarker); - State::Next(StateName::CharacterEscapeInside) - } - _ => State::Nok, + if tokenizer.parse_state.constructs.character_escape && tokenizer.current == Some(b'\\') { + tokenizer.enter(Name::CharacterEscape); + tokenizer.enter(Name::CharacterEscapeMarker); + tokenizer.consume(); + tokenizer.exit(Name::CharacterEscapeMarker); + State::Next(StateName::CharacterEscapeInside) + } else { + State::Nok } } -- cgit