From 3cadbb098454612514dc899671048abb984eacf0 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Wed, 8 May 2024 23:19:53 +0200 Subject: [PATCH] fix outdated cache after removing rules --- petri/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/petri/src/lib.rs b/petri/src/lib.rs index 98e7641..27e7b07 100644 --- a/petri/src/lib.rs +++ b/petri/src/lib.rs @@ -404,6 +404,7 @@ impl Dish { // remove old cache for this rule, since the variants may have changed self.cache.retain(|c| c.rule != rule_index); self.add_cache_single_rule(rule_index); + self.update_match_cache(); } /// run after adding a rule @@ -434,9 +435,6 @@ impl Dish { } } } - if !matches.is_empty() { - self.match_cache.push(self.cache.len()); - } self.cache.push(RuleCache { rule: rule_index, variant: variant_index,