mirror of
https://github.com/github/codeql.git
synced 2026-05-14 11:19:27 +02:00
Every rule firing returned `Vec<Id>` even though the overwhelming majority of rules produce a single replacement node. Switch the Transform return type, try_rule, apply_rules, and apply_rules_inner to `RuleOutput = SmallVec<[Id; 1]>`. Re-export `smallvec` and `SmallVec` from the yeast crate so generated rule! macro code can refer to them by short paths. For the rule! macro, generate `yeast::smallvec![__id]` for the shorthand form and `yeast::RuleOutput = yeast::SmallVec::new()` for the full template form, so rule outputs stay inline for the common single-Id case. Per-firing memory: a Vec allocation per rule firing turns into zero when the rule produces 0 or 1 Ids. Rules that produce multiple Ids still allocate (SmallVec spills to heap when the inline buffer is exceeded), unchanged from before.