From a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 26 Jul 2022 16:37:13 +0200 Subject: Refactor to drastically improve perf around whitespace --- src/subtokenize.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/subtokenize.rs') 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, 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; } -- cgit