From 51354ef776064ab34e9d469f4a1d954e0b65a02a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 17 Jan 2022 22:20:05 -0600 Subject: [PATCH] use just an i32 to ignore match IDs --- highlight/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/highlight/src/lib.rs b/highlight/src/lib.rs index e0016951..d37b13e9 100644 --- a/highlight/src/lib.rs +++ b/highlight/src/lib.rs @@ -111,7 +111,7 @@ struct HighlightIterLayer<'a> { scope_stack: Vec>, ranges: Vec, depth: usize, - ignore_match_ids: Vec, + ignore_match_id: i32, } impl Highlighter { @@ -414,7 +414,7 @@ impl<'a> HighlightIterLayer<'a> { captures, config, ranges, - ignore_match_ids: Vec::new(), + ignore_match_id: -1, }); } @@ -685,7 +685,7 @@ where let (mut match_, capture_index) = layer.captures.next().unwrap(); let mut capture = match_.captures[capture_index]; - if layer.ignore_match_ids.contains(&match_.id()) { + if layer.ignore_match_id >= match_.id() as i32 { continue 'main; } @@ -841,7 +841,7 @@ where // highlighting patterns that are disabled for local variables. if definition_highlight.is_some() || reference_highlight.is_some() { while layer.config.non_local_variable_patterns[match_.pattern_index] { - layer.ignore_match_ids.push(match_.id()); + layer.ignore_match_id = match_.id() as i32; if let Some((next_match, next_capture_index)) = layer.captures.peek() { let next_capture = next_match.captures[*next_capture_index]; if next_capture.node == capture.node {