fix outdated cache after removing rules

This commit is contained in:
Crispy 2024-05-08 23:19:53 +02:00
parent 0611be2837
commit 3cadbb0984

View file

@ -404,6 +404,7 @@ impl Dish {
// remove old cache for this rule, since the variants may have changed // remove old cache for this rule, since the variants may have changed
self.cache.retain(|c| c.rule != rule_index); self.cache.retain(|c| c.rule != rule_index);
self.add_cache_single_rule(rule_index); self.add_cache_single_rule(rule_index);
self.update_match_cache();
} }
/// run after adding a rule /// 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 { self.cache.push(RuleCache {
rule: rule_index, rule: rule_index,
variant: variant_index, variant: variant_index,