aboutsummaryrefslogtreecommitdiffstats
path: root/src/subtokenize.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/subtokenize.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/subtokenize.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/subtokenize.rs b/src/subtokenize.rs
index 1f4c6e3..ad6f53f 100644
--- a/src/subtokenize.rs
+++ b/src/subtokenize.rs
@@ -47,12 +47,14 @@ pub fn link_to(events: &mut [Event], pevious: usize, next: usize) {
.link
.as_mut()
.expect("expected `link` on previous");
- let conten_type_previous = link_previous.content_type;
link_previous.next = Some(next);
let link_next = events[next].link.as_mut().expect("expected `link` on next");
link_next.previous = Some(pevious);
- assert_eq!(conten_type_previous, link_next.content_type);
+ assert_eq!(
+ events[pevious].link.as_ref().unwrap().content_type,
+ events[next].link.as_ref().unwrap().content_type
+ );
}
/// Parse linked events.
@@ -83,7 +85,7 @@ pub fn subtokenize(events: &mut Vec<Event>, parse_state: &ParseState) -> bool {
} else {
text
})),
- None,
+ 0,
);
// Loop through links to pass them in order to the subtokenizer.
@@ -110,7 +112,7 @@ pub fn subtokenize(events: &mut Vec<Event>, parse_state: &ParseState) -> bool {
func,
link_curr.next == None,
);
- assert!(result.1.is_none(), "expected no remainder");
+ assert_eq!(result.1, 0, "expected no remainder");
link_index = link_curr.next;
}