-
-
Notifications
You must be signed in to change notification settings - Fork 722
refactor(ast): shorten serialize code using let chains #13100
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
refactor(ast): shorten serialize code using let chains #13100
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 get_ts_start_span function in the AST serialization module to use Rust's let chains syntax for more concise code. The functionality remains identical while reducing code duplication.
Key changes:
- Simplified nested if-let patterns using let chains
- Eliminated duplicate variable assignments and return statements
- Restructured control flow to use a single return point
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13100 will not alter performanceComparing Summary
|
|
Small change, and I think I know the serialization code better than anyone, so merging without review. |
Merge activity
|
Refactor. Shorten some ESTree serialization code by using `let` chains. It may also be marginally faster, due to only fetching `start` in one place (`first_stmt.span()` should be branchless and just a couple of ops, as every struct has `span` field in same position).
421656f to
7b86340
Compare

Refactor. Shorten some ESTree serialization code by using
letchains.It may also be marginally faster, due to only fetching
startin one place (first_stmt.span()should be branchless and just a couple of ops, as every struct hasspanfield in same position).