From 6ba11bdaca1721fb4591819604c340d147798f45 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 12 Aug 2022 17:02:01 +0200 Subject: Remove `match` statements if clumsy --- src/construct/heading_setext.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src/construct/heading_setext.rs') 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)) } } -- cgit