-
-
Notifications
You must be signed in to change notification settings - Fork 721
refactor(ast_macros): simplify code #13101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the #[ast] proc macro implementation to simplify the code structure. The main purpose is to make the reorder_struct_fields function mutate the ItemStruct in place rather than using a more complex approach of extracting fields, modifying them, and reconstructing the struct.
- Eliminated unnecessary
std::memimport andmem::replaceusage - Changed
reorder_struct_fieldsto mutate the struct in place instead of returning anOption<TokenStream> - Simplified the control flow by removing the need to handle
Nonereturn values
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13101 will not alter performanceComparing Summary
Footnotes |
Merge activity
|
Pure refactor. Simplify implementation of `#[ast]` proc macro. `reorder_struct_fields` can mutate the fields of the `ItemStruct` in place, rather than taking the fields out, altering them, putting them back in, and then converting to a `TokenStream`.
e582c0a to
c63c944
Compare

Pure refactor. Simplify implementation of
#[ast]proc macro.reorder_struct_fieldscan mutate the fields of theItemStructin place, rather than taking the fields out, altering them, putting them back in, and then converting to aTokenStream.