Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Aug 14, 2025

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.

@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Aug 14, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@overlookmotel overlookmotel marked this pull request as ready for review August 14, 2025 20:30
Copilot AI review requested due to automatic review settings August 14, 2025 20:30
Copy link
Contributor

Copilot AI left a 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::mem import and mem::replace usage
  • Changed reorder_struct_fields to mutate the struct in place instead of returning an Option<TokenStream>
  • Simplified the control flow by removing the need to handle None return values

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 14, 2025

CodSpeed Instrumentation Performance Report

Merging #13101 will not alter performance

Comparing 08-14-refactor_ast_macros_simplify_code (c63c944) with main (437a63d)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on main (c63c944) during the generation of this report, so 437a63d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Aug 16, 2025
Copy link
Member Author

overlookmotel commented Aug 16, 2025

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`.
@graphite-app graphite-app bot force-pushed the 08-14-refactor_ast_macros_simplify_code branch from e582c0a to c63c944 Compare August 16, 2025 15:01
@graphite-app graphite-app bot merged commit c63c944 into main Aug 16, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 08-14-refactor_ast_macros_simplify_code branch August 16, 2025 15:06
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants