diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 15:03:15 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 15:03:15 +0200 |
commit | 41fc406af206e21014eaaba94bcf6b1854f892b3 (patch) | |
tree | 510f6e1d763643da9072f9cf7e097e777fdbd5b8 /src/construct/heading_setext.rs | |
parent | 37fad739ba73d488d4c3652caee01f1ec5d0aaaa (diff) | |
download | markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.tar.gz markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.tar.bz2 markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.zip |
Refactor to pass ints instead of vecs around
Diffstat (limited to '')
-rw-r--r-- | src/construct/heading_setext.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs index ee6c23c..49d9cd2 100644 --- a/src/construct/heading_setext.rs +++ b/src/construct/heading_setext.rs @@ -135,7 +135,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { if paragraph_before && !tokenizer.lazy && tokenizer.parse_state.constructs.heading_setext { tokenizer.go(space_or_tab_min_max(0, max), before)(tokenizer, code) } else { - (State::Nok, None) + (State::Nok, 0) } } @@ -152,7 +152,7 @@ fn before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { tokenizer.enter(Token::HeadingSetextUnderline); inside(tokenizer, code, Kind::from_char(char)) } - _ => (State::Nok, None), + _ => (State::Nok, 0), } } @@ -167,7 +167,7 @@ fn inside(tokenizer: &mut Tokenizer, code: Code, kind: Kind) -> StateFnResult { match code { Code::Char(char) if char == kind.as_char() => { tokenizer.consume(code); - (State::Fn(Box::new(move |t, c| inside(t, c, kind))), None) + (State::Fn(Box::new(move |t, c| inside(t, c, kind))), 0) } _ => { tokenizer.exit(Token::HeadingSetextUnderline); @@ -189,9 +189,9 @@ fn after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { // Feel free to interrupt. tokenizer.interrupt = false; tokenizer.register_resolver("heading_setext".to_string(), Box::new(resolve)); - (State::Ok, Some(vec![code])) + (State::Ok, if matches!(code, Code::None) { 0 } else { 1 }) } - _ => (State::Nok, None), + _ => (State::Nok, 0), } } |