Skip to content

refactor: deduplicate Rust keyword list in buffa-build#59

Merged
iainmcgin merged 3 commits intoanthropics:mainfrom
hobostay:fix/deduplicate-keyword-list
Apr 23, 2026
Merged

refactor: deduplicate Rust keyword list in buffa-build#59
iainmcgin merged 3 commits intoanthropics:mainfrom
hobostay:fix/deduplicate-keyword-list

Conversation

@hobostay
Copy link
Copy Markdown
Contributor

Summary

  • Replaces the inline keyword list in buffa-build's escape_mod_name with a call to the canonical buffa_codegen::idents::escape_mod_ident function.

The buffa-build crate maintained a 48-keyword array that duplicated the authoritative list in buffa-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_ident function in buffa-codegen is already pub and buffa-build already depends on buffa-codegen, so this is a zero-cost refactor.

Test plan

  • All 19 existing buffa-build tests pass unchanged
  • Verified buffa_codegen::idents::escape_mod_ident has identical behavior (raw identifiers for regular keywords, _ suffix for self/super/Self/crate)

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Collaborator

@iainmcgin iainmcgin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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>
@iainmcgin iainmcgin force-pushed the fix/deduplicate-keyword-list branch from 3230042 to 7415af9 Compare April 23, 2026 16:08
@iainmcgin iainmcgin enabled auto-merge (squash) April 23, 2026 16:12
@iainmcgin iainmcgin merged commit 5649479 into anthropics:main Apr 23, 2026
7 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 2026
@iainmcgin
Copy link
Copy Markdown
Collaborator

[claude code] Thanks for the contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants