Skip to content

refactor(formatter): remove unnecessary clone for experimental_sort_imports option#17065

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-18-refactor_formatter_remove_unnecessary_clone_for_experimental_sort_imports_option
Dec 19, 2025
Merged

refactor(formatter): remove unnecessary clone for experimental_sort_imports option#17065
graphite-app[bot] merged 1 commit intomainfrom
12-18-refactor_formatter_remove_unnecessary_clone_for_experimental_sort_imports_option

Conversation

@Dunqing
Copy link
Copy Markdown
Member

@Dunqing Dunqing commented Dec 18, 2025

Remove the unnecessary clone, since experimental_sort_imports is a complex struct that is not cheap to clone. I also removed apply_transform to avoid a borrow checker problem, as it borrows &mut self, and there is already an immutable reference borrowed by formatted.context().options().experimental_sort_imports.

@github-actions github-actions Bot added A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Dec 18, 2025
Copy link
Copy Markdown
Member Author

Dunqing commented Dec 18, 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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 18, 2025

CodSpeed Performance Report

Merging #17065 will not alter performance

Comparing 12-18-refactor_formatter_remove_unnecessary_clone_for_experimental_sort_imports_option (8c6fa17) with 12-18-refactor_formatter_move_the_parsing_group_for_sorting_imports_to_the_place_where_it_is_used (ea7cbec)

Summary

✅ 38 untouched
⏩ 7 skipped1

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Dunqing Dunqing force-pushed the 12-18-refactor_formatter_remove_unnecessary_clone_for_experimental_sort_imports_option branch from 1d8cd3c to 8c6fa17 Compare December 19, 2025 00:57
@Dunqing Dunqing force-pushed the 12-18-refactor_formatter_move_the_parsing_group_for_sorting_imports_to_the_place_where_it_is_used branch from bc2dc61 to ea7cbec Compare December 19, 2025 00:57
@Dunqing Dunqing marked this pull request as ready for review December 19, 2025 00:59
@Dunqing Dunqing requested a review from leaysgur December 19, 2025 00:59
@Dunqing Dunqing changed the title refactor(formatter): remove unnecessary clone for experimental_sort_imports option refactor(formatter): remove unnecessary clone for experimental_sort_imports option Dec 19, 2025
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Dec 19, 2025
Copy link
Copy Markdown
Member

leaysgur commented Dec 19, 2025

Merge activity

…imports` option (#17065)

Remove the unnecessary clone, since `experimental_sort_imports` is a complex struct that is not cheap to clone. I also removed `apply_transform` to avoid a borrow checker problem, as it borrows `&mut self`, and there is already an immutable reference borrowed by `formatted.context().options().experimental_sort_imports`.
@graphite-app graphite-app Bot force-pushed the 12-18-refactor_formatter_move_the_parsing_group_for_sorting_imports_to_the_place_where_it_is_used branch from ea7cbec to 297eb09 Compare December 19, 2025 01:17
@graphite-app graphite-app Bot force-pushed the 12-18-refactor_formatter_remove_unnecessary_clone_for_experimental_sort_imports_option branch from 8c6fa17 to 853f659 Compare December 19, 2025 01:18
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Dec 19, 2025
Base automatically changed from 12-18-refactor_formatter_move_the_parsing_group_for_sorting_imports_to_the_place_where_it_is_used to main December 19, 2025 01:25
@graphite-app graphite-app Bot merged commit 853f659 into main Dec 19, 2025
21 checks passed
@graphite-app graphite-app Bot deleted the 12-18-refactor_formatter_remove_unnecessary_clone_for_experimental_sort_imports_option branch December 19, 2025 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter 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.

2 participants