Skip to content

perf(linter): remove unnecessary clone of owned String in drain loop#20388

Merged
graphite-app[bot] merged 1 commit intomainfrom
perf/linter-disable-directives-remove-clone
Mar 15, 2026
Merged

perf(linter): remove unnecessary clone of owned String in drain loop#20388
graphite-app[bot] merged 1 commit intomainfrom
perf/linter-disable-directives-remove-clone

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Mar 14, 2026

Summary

  • After drain(), rule_name is already an owned String that can be moved directly
  • Remove the unnecessary .clone() call

🤖 Generated with Claude Code

@Boshen Boshen requested a review from camc314 as a code owner March 14, 2026 15:57
Copilot AI review requested due to automatic review settings March 14, 2026 15:57
@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels Mar 14, 2026
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 removes an unnecessary String::clone() when creating a DisabledRule::Single after draining disable_start_map, leveraging the fact that drain() yields owned String keys that can be moved directly. This is a small performance/cleanup change in the linter’s disable-directive interval construction logic.

Changes:

  • Remove a redundant .clone() of rule_name in the post-drain() loop when building lone eslint-disable rule_name intervals.

You can also share your feedback on Copilot code review. Take the survey.

@Boshen Boshen self-assigned this Mar 14, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 14, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 52 skipped benchmarks1


Comparing perf/linter-disable-directives-remove-clone (43df6bf) with main (e62524d)

Open in CodSpeed

Footnotes

  1. 52 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.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Mar 15, 2026
Copy link
Member Author

Boshen commented Mar 15, 2026

Merge activity

…20388)

## Summary
- After `drain()`, `rule_name` is already an owned `String` that can be moved directly
- Remove the unnecessary `.clone()` call

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app bot force-pushed the perf/linter-disable-directives-remove-clone branch from 43df6bf to e4f7248 Compare March 15, 2026 02:06
@graphite-app graphite-app bot merged commit e4f7248 into main Mar 15, 2026
21 checks passed
@graphite-app graphite-app bot deleted the perf/linter-disable-directives-remove-clone branch March 15, 2026 02:12
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-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants