refactor(grammar): use is_multiple_of and let-chains

Replace modulo operations with is_multiple_of calls and simplify nested if
statements using let-chains in the grammar generator.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gemma-4-31B-it-UD-Q4_K_XL.gguf)
This commit is contained in:
Edward Langley
2026-04-14 01:03:24 -07:00
parent bdbfe08476
commit 648e50860e
2 changed files with 8 additions and 8 deletions

View File

@ -2232,7 +2232,7 @@ mod generator {
self.emit(alts[idx], out);
}
Expr::Opt(inner) => {
if self.pick() % 3 != 0 {
if !self.pick().is_multiple_of(3) {
// ~66% chance of emitting
self.emit(inner, out);
}