refactor: deduplicate Rust keyword list in buffa-build#59
Merged
iainmcgin merged 3 commits intoanthropics:mainfrom Apr 23, 2026
Merged
refactor: deduplicate Rust keyword list in buffa-build#59iainmcgin merged 3 commits intoanthropics:mainfrom
iainmcgin merged 3 commits intoanthropics:mainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
iainmcgin
approved these changes
Apr 23, 2026
Collaborator
iainmcgin
left a comment
There was a problem hiding this comment.
[claude code] Code review: pure refactor, behavior-preserving. Replaces a duplicated keyword list with a call to the shared canonical helper. LGTM once CLA is signed.
buffa-build maintained its own copy of the Rust keyword list for module name escaping, duplicating the canonical list in buffa-codegen::idents. This creates a maintenance hazard: if a new keyword is added to one list but not the other, generated module names could become invalid. Replace the inline keyword list and escaping logic with a call to the existing buffa_codegen::idents::escape_mod_ident function, which is already a public dependency. Co-authored-by: Qiaochu Hu <110803307+hobostay@users.noreply.github.com>
3230042 to
7415af9
Compare
Collaborator
|
[claude code] Thanks for the contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buffa-build'sescape_mod_namewith a call to the canonicalbuffa_codegen::idents::escape_mod_identfunction.The
buffa-buildcrate maintained a 48-keyword array that duplicated the authoritative list inbuffa-codegen::idents. This is a maintenance hazard: if a new Rust keyword is added (e.g. a future edition keyword), updating one list without the other would produce incorrect module names.The
escape_mod_identfunction inbuffa-codegenis alreadypubandbuffa-buildalready depends onbuffa-codegen, so this is a zero-cost refactor.Test plan
buffa-buildtests pass unchangedbuffa_codegen::idents::escape_mod_identhas identical behavior (raw identifiers for regular keywords,_suffix forself/super/Self/crate)🤖 Generated with Claude Code