Skip to content

Conversation

camchenry
Copy link
Member

@camchenry camchenry commented Oct 16, 2025

Adding support for matches! in the linter codegen would be somewhat tedious as we'd need to start parsing macros. Instead, there is a similar idiom that we already support: diverging match on node.kind(). So, I've updated the linter codegen to support | in match arms, plus updated rules to use this new pattern instead of if !matches!(...).

CleanShot 2025-10-16 at 12 12 45@2x

@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels Oct 16, 2025
Copy link
Member Author

camchenry commented Oct 16, 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.

Copy link

codspeed-hq bot commented Oct 16, 2025

CodSpeed Performance Report

Merging #14650 will not alter performance

Comparing 10-16-perf_linter_switch_if_matches_node.kind_._to_match_block (00e64a8) with main (f2c33f5)

Summary

✅ 4 untouched
⏩ 33 skipped1

Footnotes

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

@camchenry camchenry marked this pull request as ready for review October 16, 2025 16:13
@camchenry camchenry requested a review from camc314 as a code owner October 16, 2025 16:13
@graphite-app graphite-app bot changed the base branch from 10-15-perf_linter_rearrange_rules_for_node_type_analysis to graphite-base/14650 October 16, 2025 16:19
@graphite-app graphite-app bot force-pushed the 10-16-perf_linter_switch_if_matches_node.kind_._to_match_block branch from cf235ec to d1868c6 Compare October 16, 2025 16:23
@graphite-app graphite-app bot force-pushed the graphite-base/14650 branch from 46ec4b6 to f2c33f5 Compare October 16, 2025 16:23
@graphite-app graphite-app bot changed the base branch from graphite-base/14650 to main October 16, 2025 16:24
@graphite-app graphite-app bot force-pushed the 10-16-perf_linter_switch_if_matches_node.kind_._to_match_block branch from d1868c6 to 00e64a8 Compare October 16, 2025 16:24
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
Copy link
Contributor

camc314 commented Oct 16, 2025

Merge activity

…14650)

Adding support for `matches!` in the linter codegen would be somewhat tedious as we'd need to start parsing macros. Instead, there is a similar idiom that we already support: diverging `match` on `node.kind()`. So, I've updated the linter codegen to support `|` in match arms, plus updated rules to use this new pattern instead of `if !matches!(...)`.

<img width="1392" height="664" alt="CleanShot 2025-10-16 at 12 12 45@2x" src="https://github.com/user-attachments/assets/75762f93-152a-49e4-83ab-46240d7b2b62" />
@graphite-app graphite-app bot force-pushed the 10-16-perf_linter_switch_if_matches_node.kind_._to_match_block branch from 00e64a8 to 400a99a Compare October 16, 2025 16:29
@graphite-app graphite-app bot merged commit 400a99a into main Oct 16, 2025
20 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
@graphite-app graphite-app bot deleted the 10-16-perf_linter_switch_if_matches_node.kind_._to_match_block branch October 16, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants