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/html_text.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/html_text.rs')
-rw-r--r-- | src/construct/html_text.rs | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/construct/html_text.rs b/src/construct/html_text.rs index fde78de..ffbc768 100644 --- a/src/construct/html_text.rs +++ b/src/construct/html_text.rs @@ -558,26 +558,27 @@ pub fn tag_open_attribute_value_before(tokenizer: &mut Tokenizer) -> State { /// ^ /// ``` pub fn tag_open_attribute_value_quoted(tokenizer: &mut Tokenizer) -> State { - match tokenizer.current { - None => { - tokenizer.tokenize_state.marker = 0; - State::Nok - } - Some(b'\n') => { - tokenizer.attempt( - State::Next(StateName::HtmlTextTagOpenAttributeValueQuoted), - State::Nok, - ); - State::Retry(StateName::HtmlTextLineEndingBefore) - } - Some(b'"' | b'\'') if tokenizer.current.unwrap() == tokenizer.tokenize_state.marker => { - tokenizer.tokenize_state.marker = 0; - tokenizer.consume(); - State::Next(StateName::HtmlTextTagOpenAttributeValueQuotedAfter) - } - _ => { - tokenizer.consume(); - State::Next(StateName::HtmlTextTagOpenAttributeValueQuoted) + if tokenizer.current == Some(tokenizer.tokenize_state.marker) { + tokenizer.tokenize_state.marker = 0; + tokenizer.consume(); + State::Next(StateName::HtmlTextTagOpenAttributeValueQuotedAfter) + } else { + match tokenizer.current { + None => { + tokenizer.tokenize_state.marker = 0; + State::Nok + } + Some(b'\n') => { + tokenizer.attempt( + State::Next(StateName::HtmlTextTagOpenAttributeValueQuoted), + State::Nok, + ); + State::Retry(StateName::HtmlTextLineEndingBefore) + } + _ => { + tokenizer.consume(); + State::Next(StateName::HtmlTextTagOpenAttributeValueQuoted) + } } } } |