diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-12 17:02:01 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-12 17:02:01 +0200 |
commit | 6ba11bdaca1721fb4591819604c340d147798f45 (patch) | |
tree | ef602b518043c0a7228e76d9d00bee95a17798d4 /src/construct/character_escape.rs | |
parent | 504729a4a0c8f3e0d8fc9159e0273150b169e184 (diff) | |
download | markdown-rs-6ba11bdaca1721fb4591819604c340d147798f45.tar.gz markdown-rs-6ba11bdaca1721fb4591819604c340d147798f45.tar.bz2 markdown-rs-6ba11bdaca1721fb4591819604c340d147798f45.zip |
Remove `match` statements if clumsy
Diffstat (limited to 'src/construct/character_escape.rs')
-rw-r--r-- | src/construct/character_escape.rs | 17 |
1 files changed, 8 insertions, 9 deletions
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 } } |