aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/heading_setext.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 17:26:17 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 17:26:17 +0200
commit0d9c4611922535533746d1a86f10ef4e701c950e (patch)
treedd776161db75ba264b67830635b736ca5dd5c314 /src/construct/heading_setext.rs
parent90969231bfcdfcd09bae646abba17d832b633376 (diff)
downloadmarkdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.tar.gz
markdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.tar.bz2
markdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.zip
Refactor attempts to remove unneeded state name
Diffstat (limited to '')
-rw-r--r--src/construct/heading_setext.rs16
1 files changed, 5 insertions, 11 deletions
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))
}
}
}