aboutsummaryrefslogtreecommitdiffstats
path: root/src/subtokenize.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-26 16:37:13 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-26 16:37:13 +0200
commita6b317ac7fbc95b8584056b3cebffbf9d1bba2c6 (patch)
treefd7be2fe6d7355d3aafaf8b731f0e0b48624debc /src/subtokenize.rs
parent297784cb925b1196d89479fa24c898703ae598d6 (diff)
downloadmarkdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.tar.gz
markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.tar.bz2
markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.zip
Refactor to drastically improve perf around whitespace
Diffstat (limited to 'src/subtokenize.rs')
-rw-r--r--src/subtokenize.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/subtokenize.rs b/src/subtokenize.rs
index 8aa4df1..a78f5e2 100644
--- a/src/subtokenize.rs
+++ b/src/subtokenize.rs
@@ -95,12 +95,14 @@ pub fn subtokenize(events: &mut Vec<Event>, parse_state: &ParseState) -> bool {
tokenizer.define_skip(&enter.point);
}
- let func = match state {
- State::Fn(func) => func,
- _ => unreachable!("cannot be ok/nok"),
- };
-
- state = tokenizer.push(enter.point.index, events[index + 1].point.index, func);
+ state = tokenizer.push(
+ enter.point.index,
+ events[index + 1].point.index,
+ match state {
+ State::Fn(func) => func,
+ _ => unreachable!("cannot be ok/nok"),
+ },
+ );
link_index = link_curr.next;
}