Skip to content
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(isolated_declarations, linter, minifier, prettier, semantic, transformer): remove unnecessary ref / ref mut syntax #8643

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jan 21, 2025

While working on #8641, I found a lot of places where we unnecessarily use ref / ref mut in match arms.

In many cases, we're creating double-references (turning a &T into a &&T). The compiler should be smart enough to remove them for us, but there doesn't seem much point in explicitly creating double-references when we don't actually want them, and relying on compiler to optimize them out again.

@github-actions github-actions bot added A-linter Area - Linter A-semantic Area - Semantic A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler A-prettier Area - Prettier A-isolated-declarations Isolated Declarations A-editor Area - Editor and Language Server labels Jan 21, 2025
Copy link
Contributor Author

overlookmotel commented Jan 21, 2025


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.

@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Jan 21, 2025
@overlookmotel overlookmotel marked this pull request as ready for review January 21, 2025 13:47
Copy link

codspeed-hq bot commented Jan 21, 2025

CodSpeed Performance Report

Merging #8643 will not alter performance

Comparing 01-21-refactor_isolated_declarations_linter_minifier_prettier_semantic_transformer_remove_unnecessary_ref___ref_mut_syntax (e66da9f) with main (61d96fd)

Summary

✅ 32 untouched benchmarks

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jan 21, 2025
Copy link
Member

Boshen commented Jan 21, 2025

Merge activity

  • Jan 21, 9:19 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 21, 9:19 AM EST: A user added this pull request to the Graphite merge queue.
  • Jan 21, 9:35 AM EST: A user merged this pull request with the Graphite merge queue.

… transformer): remove unnecessary `ref` / `ref mut` syntax (#8643)

While working on #8641, I found a lot of places where we unnecessarily use `ref` / `ref mut` in match arms.

In many cases, we're creating double-references (turning a `&T` into a `&&T`). The compiler should be smart enough to remove them for us, but there doesn't seem much point in explicitly creating double-references when we don't actually want them, and relying on compiler to optimize them out again.
@Boshen Boshen force-pushed the 01-21-refactor_span_remove_partialeq_impl_for_atom_ branch from c83b9d1 to 54d0fac Compare January 21, 2025 14:21
@Boshen Boshen force-pushed the 01-21-refactor_isolated_declarations_linter_minifier_prettier_semantic_transformer_remove_unnecessary_ref___ref_mut_syntax branch from 961b755 to e66da9f Compare January 21, 2025 14:22
Base automatically changed from 01-21-refactor_span_remove_partialeq_impl_for_atom_ to main January 21, 2025 14:32
@graphite-app graphite-app bot merged commit e66da9f into main Jan 21, 2025
32 checks passed
@graphite-app graphite-app bot deleted the 01-21-refactor_isolated_declarations_linter_minifier_prettier_semantic_transformer_remove_unnecessary_ref___ref_mut_syntax branch January 21, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-editor Area - Editor and Language Server A-isolated-declarations Isolated Declarations A-linter Area - Linter A-minifier Area - Minifier A-prettier Area - Prettier A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler 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