aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/character_reference.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-12 17:02:01 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-12 17:02:01 +0200
commit6ba11bdaca1721fb4591819604c340d147798f45 (patch)
treeef602b518043c0a7228e76d9d00bee95a17798d4 /src/construct/character_reference.rs
parent504729a4a0c8f3e0d8fc9159e0273150b169e184 (diff)
downloadmarkdown-rs-6ba11bdaca1721fb4591819604c340d147798f45.tar.gz
markdown-rs-6ba11bdaca1721fb4591819604c340d147798f45.tar.bz2
markdown-rs-6ba11bdaca1721fb4591819604c340d147798f45.zip
Remove `match` statements if clumsy
Diffstat (limited to 'src/construct/character_reference.rs')
-rw-r--r--src/construct/character_reference.rs17
1 files changed, 8 insertions, 9 deletions
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
}
}