Skip to content

Fix range_{plus,minus}_one bad suggestions #9446

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
merged 1 commit into from Sep 9, 2022
Merged

Fix range_{plus,minus}_one bad suggestions #9446

merged 1 commit into from Sep 9, 2022

Conversation

ghost
Copy link

@ghost ghost commented Sep 8, 2022

Fixes #9431.

The current range_plus_one and range_minus_one suggestions are completely incorrect when macros are involved.

This commit resolves this by disabling the lints for any range expression that is expanded from a macro. The reasons for this are that it is very difficult to create a correct suggestion in this case and that false negatives are less important for pedantic lints.

changelog: Fix range_{plus,minus}_one bad suggestions

Fixes #9431.

The current `range_plus_one` and `range_minus_one` suggestions
are completely incorrect when macros are involved.

This commit resolves this by disabling the lints for any range
expression that is expanded from a macro. The reasons for this
are that it is very difficult to create a correct suggestion in
this case and that false negatives are less important for
pedantic lints.
@rust-highfive
Copy link

r? @giraffate

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 8, 2022
@giraffate
Copy link
Contributor

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Sep 8, 2022

📌 Commit a6d8afd has been approved by giraffate

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 8, 2022

⌛ Testing commit a6d8afd with merge b52fb52...

@bors
Copy link
Contributor

bors commented Sep 9, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing b52fb52 to master...

@bors bors merged commit b52fb52 into rust-lang:master Sep 9, 2022
@ghost ghost deleted the fix-9431-2 branch September 9, 2022 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

range_plus_one doesn't handle macros correctly
3 participants