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

fix(noUnusedVariables): don't panic when renaming ref at the start #4144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Conaclos
Copy link
Member

Summary

Fix #4114

Test Plan

I added a test.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Sep 30, 2024
@Conaclos Conaclos force-pushed the conaclos/noUnusedVariables-4114 branch from 06e7246 to 825f23b Compare September 30, 2024 16:06
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 48517 48517 0
Passed 47326 47326 0
Failed 1191 1191 0
Panics 0 0 0
Coverage 97.55% 97.55% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6571 6571 0
Passed 2203 2203 0
Failed 4368 4368 0
Panics 0 0 0
Coverage 33.53% 33.53% 0.00%

ts/babel

Test result main count This PR count Difference
Total 680 680 0
Passed 608 608 0
Failed 72 72 0
Panics 0 0 0
Coverage 89.41% 89.41% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18471 18471 0
Passed 14144 14144 0
Failed 4327 4327 0
Panics 0 0 0
Coverage 76.57% 76.57% 0.00%

let id = self.data.scope(TextRange::new(
start,
// SAFETY: A reference name has at least a length of 1 byte.
start.checked_add(1.into()).unwrap(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use checked_add() if you're just going to unwrap() anyway?

Suggested change
start.checked_add(1.into()).unwrap(),
start + 1.into(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 noUnusedVariables makes the semantic model panics on invalid code
3 participants