aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/heading_setext.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/heading_setext.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/heading_setext.rs')
-rw-r--r--src/construct/heading_setext.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs
index 8485f5a..4e6345a 100644
--- a/src/construct/heading_setext.rs
+++ b/src/construct/heading_setext.rs
@@ -126,20 +126,17 @@ pub fn before(tokenizer: &mut Tokenizer) -> State {
/// ^
/// ```
pub fn inside(tokenizer: &mut Tokenizer) -> State {
- match tokenizer.current {
- Some(b'-' | b'=') if tokenizer.current.unwrap() == tokenizer.tokenize_state.marker => {
- tokenizer.consume();
- State::Next(StateName::HeadingSetextInside)
- }
- _ => {
- tokenizer.tokenize_state.marker = 0;
- tokenizer.exit(Name::HeadingSetextUnderline);
- tokenizer.attempt(
- State::Next(StateName::HeadingSetextAfter),
- State::Next(StateName::HeadingSetextAfter),
- );
- State::Retry(space_or_tab(tokenizer))
- }
+ if tokenizer.current == Some(tokenizer.tokenize_state.marker) {
+ tokenizer.consume();
+ State::Next(StateName::HeadingSetextInside)
+ } else {
+ tokenizer.tokenize_state.marker = 0;
+ tokenizer.exit(Name::HeadingSetextUnderline);
+ tokenizer.attempt(
+ State::Next(StateName::HeadingSetextAfter),
+ State::Next(StateName::HeadingSetextAfter),
+ );
+ State::Retry(space_or_tab(tokenizer))
}
}