aboutsummaryrefslogtreecommitdiffstats
path: root/src/content/document.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-22 15:03:15 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-22 15:03:15 +0200
commit41fc406af206e21014eaaba94bcf6b1854f892b3 (patch)
tree510f6e1d763643da9072f9cf7e097e777fdbd5b8 /src/content/document.rs
parent37fad739ba73d488d4c3652caee01f1ec5d0aaaa (diff)
downloadmarkdown-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/content/document.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/content/document.rs b/src/content/document.rs
index 1a0ffee..163dcda 100644
--- a/src/content/document.rs
+++ b/src/content/document.rs
@@ -363,10 +363,10 @@ fn containers_after(
tokenizer.go_until(
state,
|code| matches!(code, Code::CarriageReturnLineFeed | Code::Char('\n' | '\r')),
- move |(state, remainder)| {
+ move |(state, back)| {
(
State::Fn(Box::new(move |t, c| flow_end(t, c, info, state))),
- remainder,
+ back,
)
},
)(tokenizer, code)
@@ -415,7 +415,7 @@ fn flow_end(
resolve(tokenizer, &mut info);
- (State::Ok, Some(vec![code]))
+ (State::Ok, if matches!(code, Code::None) { 0 } else { 1 })
}
State::Nok => unreachable!("unexpected `nok` from flow"),
State::Fn(func) => {
@@ -441,7 +441,7 @@ fn exit_containers(
info.next = Box::new(flow); // This is weird but Rust needs a function there.
let result = tokenizer.flush(next);
assert!(matches!(result.0, State::Ok));
- assert!(result.1.is_none());
+ assert_eq!(result.1, 0);
if *phase == Phase::Prefix {
info.index = tokenizer.events.len();