aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/label_start_image.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/label_start_image.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/label_start_image.rs')
-rw-r--r--src/construct/label_start_image.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs
index ce09f5b..b2890e6 100644
--- a/src/construct/label_start_image.rs
+++ b/src/construct/label_start_image.rs
@@ -40,15 +40,14 @@ use crate::tokenizer::{LabelStart, Tokenizer};
/// ^
/// ```
pub fn start(tokenizer: &mut Tokenizer) -> State {
- match tokenizer.current {
- Some(b'!') if tokenizer.parse_state.constructs.label_start_image => {
- tokenizer.enter(Name::LabelImage);
- tokenizer.enter(Name::LabelImageMarker);
- tokenizer.consume();
- tokenizer.exit(Name::LabelImageMarker);
- State::Next(StateName::LabelStartImageOpen)
- }
- _ => State::Nok,
+ if tokenizer.parse_state.constructs.label_start_image && tokenizer.current == Some(b'!') {
+ tokenizer.enter(Name::LabelImage);
+ tokenizer.enter(Name::LabelImageMarker);
+ tokenizer.consume();
+ tokenizer.exit(Name::LabelImageMarker);
+ State::Next(StateName::LabelStartImageOpen)
+ } else {
+ State::Nok
}
}