Skip to content

fix(linter): false positve in no-unused-vars #10470

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

Merged

Conversation

camc314
Copy link
Contributor

@camc314 camc314 commented Apr 17, 2025

fixes #10458

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Apr 17, 2025
Copy link
Contributor Author

camc314 commented Apr 17, 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.

@camc314 camc314 marked this pull request as ready for review April 17, 2025 11:25
Copy link

codspeed-hq bot commented Apr 17, 2025

CodSpeed Instrumentation Performance Report

Merging #10470 will not alter performance

Comparing c/04-17-fix_linter_false_positve_in_no-unused-vars (f0c1eff) with main (a42d85f)

Summary

✅ 36 untouched benchmarks

Copy link
Member

@Dunqing Dunqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I do not fully understand how it works, but from the code, it looks like it can be simplified.

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Apr 18, 2025
Copy link
Member

Dunqing commented Apr 18, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the c/04-17-fix_linter_false_positve_in_no-unused-vars branch from 1ef693b to f0c1eff Compare April 18, 2025 02:26
@graphite-app graphite-app bot merged commit f0c1eff into main Apr 18, 2025
26 checks passed
@graphite-app graphite-app bot deleted the c/04-17-fix_linter_false_positve_in_no-unused-vars branch April 18, 2025 02:29
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 18, 2025
@camc314
Copy link
Contributor Author

camc314 commented Apr 24, 2025

from the code, it looks like it can be simplified.

know how?

rust-lang/rust#138528 looks like 1.88, we should be able to use implicit deref ect.

so it'd end up (I think) like:

                    match left {
                        AssignmentTarget::AssignmentTargetIdentifier(id) => {
                            if id.name == name {
                                is_used_by_others = false;
                            } else {
                                 return false; // we can short-circuit
                             }
                         }
                         AssignmentTarget::TSAsExpression(ref TSAsExpression { expression, .. })
                         | AssignmentTarget::TSSatisfiesExpression(ref TSSatisfiesExpression { expression, .. })
                         | AssignmentTarget::TSSatisfiesExpression(ref TSSatisfiesExpression { expression, .. })
                         | AssignmentTarget::TSNonNullExpression(ref TSNonNullExpression { expression, .. })
                         | AssignmentTarget::TSTypeAssertion(ref TSTypeAssertion { expression, .. })
                         if expression.is_member_expression() =>
                         {
                             return false;
                         }
                         

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

linter: no-unused-vars
3 participants