aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/autolink.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/autolink.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/autolink.rs')
-rw-r--r--src/construct/autolink.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs
index 1bb8004..5c826a3 100644
--- a/src/construct/autolink.rs
+++ b/src/construct/autolink.rs
@@ -115,16 +115,15 @@ use crate::tokenizer::Tokenizer;
/// ^
/// ```
pub fn start(tokenizer: &mut Tokenizer) -> State {
- match tokenizer.current {
- Some(b'<') if tokenizer.parse_state.constructs.autolink => {
- tokenizer.enter(Name::Autolink);
- tokenizer.enter(Name::AutolinkMarker);
- tokenizer.consume();
- tokenizer.exit(Name::AutolinkMarker);
- tokenizer.enter(Name::AutolinkProtocol);
- State::Next(StateName::AutolinkOpen)
- }
- _ => State::Nok,
+ if tokenizer.parse_state.constructs.autolink && tokenizer.current == Some(b'<') {
+ tokenizer.enter(Name::Autolink);
+ tokenizer.enter(Name::AutolinkMarker);
+ tokenizer.consume();
+ tokenizer.exit(Name::AutolinkMarker);
+ tokenizer.enter(Name::AutolinkProtocol);
+ State::Next(StateName::AutolinkOpen)
+ } else {
+ State::Nok
}
}