refactor(formatter): split generated ownership boundary - #771
Closed
MintsInc wants to merge 1 commit into
Closed
Conversation
Keep the generator-facing formatter API in formatter.rs and move the hand-maintained rendering implementation into formatter_ext.rs. Repoint rate-limit formatting at the extension module so future code generation cannot overwrite these helpers.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Keeps the generator-owned formatter surface (
Metadata,format_and_print, andoutput) insrc/formatter.rswhile moving the hand-maintained rendering implementation and tests tosrc/formatter_ext.rs.It also registers the extension module for native and browser builds and repoints rate-limit rendering helpers to the hand-maintained module.
Motivation
The Pup generator overwrites
src/formatter.rsfrom a vendored snapshot. That can remove newer handwritten helpers and signature changes during code generation, which currently prevents the generated downtime commands in #759 from compiling.This split establishes the same generated/handwritten ownership boundary already used elsewhere in the client and preserves existing formatter behavior.
Additional Notes
No dependencies or user-visible behavior change.
Verification:
cargo buildcargo fmt --checkcargo clippy -- -D warningscargo test formatter_ext::tests(85 passed)cargo test: 1,852 passed; five unrelated shared-environment HTTP tests failed againstunused.localand passed when rerun individuallycargo audit: reports pre-existing advisories forh2andrsa, plus a yankedchacha20; this PR does not changeCargo.lockChecklist
Related Issues
Unblocks #759.