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_reference.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/construct/character_reference.rs') diff --git a/src/construct/character_reference.rs b/src/construct/character_reference.rs index 6171927..7d7b6f9 100644 --- a/src/construct/character_reference.rs +++ b/src/construct/character_reference.rs @@ -81,15 +81,14 @@ use crate::util::slice::Slice; /// ^ /// ``` pub fn start(tokenizer: &mut Tokenizer) -> State { - match tokenizer.current { - Some(b'&') if tokenizer.parse_state.constructs.character_reference => { - tokenizer.enter(Name::CharacterReference); - tokenizer.enter(Name::CharacterReferenceMarker); - tokenizer.consume(); - tokenizer.exit(Name::CharacterReferenceMarker); - State::Next(StateName::CharacterReferenceOpen) - } - _ => State::Nok, + if tokenizer.parse_state.constructs.character_reference && tokenizer.current == Some(b'&') { + tokenizer.enter(Name::CharacterReference); + tokenizer.enter(Name::CharacterReferenceMarker); + tokenizer.consume(); + tokenizer.exit(Name::CharacterReferenceMarker); + State::Next(StateName::CharacterReferenceOpen) + } else { + State::Nok } } -- cgit