From 0d9c4611922535533746d1a86f10ef4e701c950e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 11 Aug 2022 17:26:17 +0200 Subject: Refactor attempts to remove unneeded state name --- src/construct/heading_setext.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/construct/heading_setext.rs') diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs index 91a40b3..e31ce76 100644 --- a/src/construct/heading_setext.rs +++ b/src/construct/heading_setext.rs @@ -85,7 +85,8 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { .name == Name::Paragraph) { - let name = space_or_tab_min_max( + tokenizer.attempt(State::Next(StateName::HeadingSetextBefore), State::Nok); + State::Retry(space_or_tab_min_max( tokenizer, 0, if tokenizer.parse_state.constructs.code_indented { @@ -93,13 +94,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { } else { usize::MAX }, - ); - - tokenizer.attempt( - name, - State::Next(StateName::HeadingSetextBefore), - State::Nok, - ) + )) } else { State::Nok } @@ -139,12 +134,11 @@ pub fn inside(tokenizer: &mut Tokenizer) -> State { _ => { tokenizer.tokenize_state.marker = 0; tokenizer.exit(Name::HeadingSetextUnderline); - let name = space_or_tab(tokenizer); tokenizer.attempt( - name, State::Next(StateName::HeadingSetextAfter), State::Next(StateName::HeadingSetextAfter), - ) + ); + State::Retry(space_or_tab(tokenizer)) } } } -- cgit