From c1810d24cb8377f2bbd9e4254c131355bd90fe2a Mon Sep 17 00:00:00 2001 From: matthewevans Date: Thu, 9 Jul 2026 13:30:52 -0700 Subject: [PATCH] refactor(oracle-gen): drop stats flag from CardWorkCtx; count unimplemented faces unconditionally Review follow-up for PR #5458: the per-face unimplemented scan is trivial next to the parse, so the counter is always computed and --stats gates only the printout. Removes the CLI coupling (and the bool field) from the worker context. --- crates/engine/src/bin/oracle_gen.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/bin/oracle_gen.rs b/crates/engine/src/bin/oracle_gen.rs index 0c0f0358fe..fbfaeb8880 100644 --- a/crates/engine/src/bin/oracle_gen.rs +++ b/crates/engine/src/bin/oracle_gen.rs @@ -348,7 +348,6 @@ enum FacePriority { /// Read-only inputs shared by every worker thread of the per-card parse pass. struct CardWorkCtx<'a> { filter_names: &'a [String], - stats: bool, token_source_metadata: &'a HashMap, rarity_map: &'a HashMap>, bracket_lists: &'a BracketLists, @@ -367,7 +366,8 @@ struct CardWork<'a> { localized: Vec<(String, &'a AtomicCard)>, /// Number of `cards_with_unimplemented` increments this card contributes. /// A homonym group increments once per unimplemented face, so this is a - /// count rather than a flag. Always 0 when `--stats` is off. + /// count rather than a flag. Always computed (the AST scan is trivial next + /// to the parse); `--stats` only gates the printout. unimplemented_faces: u32, } @@ -424,7 +424,7 @@ fn build_card_work<'a>( let key = face.name.to_lowercase(); let legalities = legalities_to_export_map(&normalize_legalities(&source.legalities)); - if ctx.stats && card_face_has_unimplemented_parts(&face) { + if card_face_has_unimplemented_parts(&face) { work.unimplemented_faces += 1; } @@ -460,13 +460,11 @@ fn build_card_work<'a>( ); } - if ctx.stats { - let has_unimplemented = layout_faces(&layout) - .iter() - .any(|f| card_face_has_unimplemented_parts(f)); - if has_unimplemented { - work.unimplemented_faces += 1; - } + if layout_faces(&layout) + .iter() + .any(|f| card_face_has_unimplemented_parts(f)) + { + work.unimplemented_faces += 1; } for (face_idx, (face_ref, source)) in layout_faces(&layout) @@ -527,7 +525,7 @@ fn build_card_work<'a>( let key = face.name.to_lowercase(); let legalities = legalities_to_export_map(&normalize_legalities(&faces[0].legalities)); - if ctx.stats && card_face_has_unimplemented_parts(&face) { + if card_face_has_unimplemented_parts(&face) { work.unimplemented_faces += 1; } @@ -1089,7 +1087,6 @@ fn main() { let ctx = CardWorkCtx { filter_names: &filter_names, - stats, token_source_metadata: &token_source_metadata, rarity_map: &rarity_map, bracket_lists: &bracket_lists,