From cdf9f97c34734e82431bbc54d3383f7ac6ac328e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 13 Oct 2022 19:03:03 +0200 Subject: Remove some unused code --- src/construct/heading_atx.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src/construct/heading_atx.rs') diff --git a/src/construct/heading_atx.rs b/src/construct/heading_atx.rs index c867117..ca100c8 100644 --- a/src/construct/heading_atx.rs +++ b/src/construct/heading_atx.rs @@ -127,20 +127,17 @@ pub fn sequence_open(tokenizer: &mut Tokenizer) -> State { tokenizer.tokenize_state.size += 1; tokenizer.consume(); State::Next(StateName::HeadingAtxSequenceOpen) - } else if tokenizer.tokenize_state.size > 0 { - if matches!(tokenizer.current, None | Some(b'\n')) { - tokenizer.tokenize_state.size = 0; - tokenizer.exit(Name::HeadingAtxSequence); - State::Retry(StateName::HeadingAtxAtBreak) - } else if matches!(tokenizer.current, Some(b'\t' | b' ')) { - tokenizer.tokenize_state.size = 0; - tokenizer.exit(Name::HeadingAtxSequence); - tokenizer.attempt(State::Next(StateName::HeadingAtxAtBreak), State::Nok); - State::Retry(space_or_tab(tokenizer)) - } else { - tokenizer.tokenize_state.size = 0; - State::Nok - } + } + // Always at least one `#`. + else if matches!(tokenizer.current, None | Some(b'\n')) { + tokenizer.tokenize_state.size = 0; + tokenizer.exit(Name::HeadingAtxSequence); + State::Retry(StateName::HeadingAtxAtBreak) + } else if matches!(tokenizer.current, Some(b'\t' | b' ')) { + tokenizer.tokenize_state.size = 0; + tokenizer.exit(Name::HeadingAtxSequence); + tokenizer.attempt(State::Next(StateName::HeadingAtxAtBreak), State::Nok); + State::Retry(space_or_tab(tokenizer)) } else { tokenizer.tokenize_state.size = 0; State::Nok -- cgit