diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-26 16:37:13 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-26 16:37:13 +0200 |
commit | a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6 (patch) | |
tree | fd7be2fe6d7355d3aafaf8b731f0e0b48624debc /src/subtokenize.rs | |
parent | 297784cb925b1196d89479fa24c898703ae598d6 (diff) | |
download | markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.tar.gz markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.tar.bz2 markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.zip |
Refactor to drastically improve perf around whitespace
Diffstat (limited to '')
-rw-r--r-- | src/subtokenize.rs | 14 |
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; } |