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

Suppress the triggering of some lints in derived structures #10203

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

c410-f3r
Copy link
Contributor

@c410-f3r c410-f3r commented Jan 14, 2023

Fixes #10185
Fixes #10417

For integer_arithmetic, arithmetic_side_effects and shadow_reuse.

  • Not sure how to test these use-cases so feel free to point any method or any related PR.

changelog: FP: [integer_arithmetic], [arithmetic_side_effects]: No longer lint inside proc macros
#10203

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2023

r? @giraffate

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 14, 2023
@giraffate
Copy link
Contributor

Not sure how to test these use-cases so feel free to point any method or any related PR.

This is a reference to adding tests for the derived struct: #9043
We use compiletest for tests, so this documents is helpful: https://rustc-dev-guide.rust-lang.org/tests/compiletest.html#building-auxiliary-crates

If you have any questions, feel free to ask me.

@xFrednet
Copy link
Member

Hey @c410-f3r, would you mind listing the lints that are affected by this change, for the changelog entry? 🙃

@c410-f3r
Copy link
Contributor Author

Not sure how to test these use-cases so feel free to point any method or any related PR.

This is a reference to adding tests for the derived struct: #9043 We use compiletest for tests, so this documents is helpful: https://rustc-dev-guide.rust-lang.org/tests/compiletest.html#building-auxiliary-crates

If you have any questions, feel free to ask me.

Thank you @giraffate

@c410-f3r
Copy link
Contributor Author

Hey @c410-f3r, would you mind listing the lints that are affected by this change, for the changelog entry? upside_down_face

Done

@Jarcho
Copy link
Contributor

Jarcho commented Jan 20, 2023

This doesn't fix #9757 as quote doesn't use #[automatically_derived]. See @Alexendoo's comment on the issue for a likely fix.

@xFrednet
Copy link
Member

xFrednet commented Jan 20, 2023

Hey @c410-f3r, would you mind listing the lints that are affected by this change, for the changelog entry? upside_down_face

Done

Thank you!

@bors
Copy link
Collaborator

bors commented Feb 12, 2023

☔ The latest upstream changes (presumably #10310) made this pull request unmergeable. Please resolve the merge conflicts.

@michaelsproul
Copy link
Contributor

Hey @c410-f3r would you be able to resolve the merge conflicts here? I'm happy to help in any way I can, but seems like you've got it covered.

@c410-f3r
Copy link
Contributor Author

c410-f3r commented Mar 14, 2023

This doesn't fix #9757 as quote doesn't use #[automatically_derived]. See @Alexendoo's comment on the issue for a likely fix.

Well, that is unfortunate...

Tests are now using statements that were manually created.

@c410-f3r
Copy link
Contributor Author

Hey @c410-f3r would you be able to resolve the merge conflicts here? I'm happy to help in any way I can, but seems like you've got it covered.

The actual fix needed more than a rebase but everything should probably be fine now

@c410-f3r
Copy link
Contributor Author

c410-f3r commented Apr 1, 2023

ping @giraffate

I can re-roll if you don't have the time to review

@bors
Copy link
Collaborator

bors commented Apr 2, 2023

☔ The latest upstream changes (presumably #10585) made this pull request unmergeable. Please resolve the merge conflicts.

@giraffate
Copy link
Contributor

Thanks for letting me know! I'll review this in this week.

Copy link
Contributor

@giraffate giraffate left a comment

Choose a reason for hiding this comment

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

Overall looks good. I made small comments.

question: For shadow_reuse, does this pull request just add a test?

changelog: FP: [integer_arithmetic], [arithmetic_side_effects], [shadow_reuse]: No longer lint inside proc macros

clippy_lints/src/operators/numeric_arithmetic.rs Outdated Show resolved Hide resolved
clippy_lints/src/operators/numeric_arithmetic.rs Outdated Show resolved Hide resolved
@c410-f3r
Copy link
Contributor Author

c410-f3r commented Apr 15, 2023

Overall looks good. I made small comments.

question: For shadow_reuse, does this pull request just add a test?

changelog: FP: [integer_arithmetic], [arithmetic_side_effects], [shadow_reuse]: No longer lint inside proc macros

Yeah, just modified the changelog.

Initially I tried to solve #9757 but it turns out that such thing shouldn't happen because shadow_reuse already has a ident.span.from_expansion() guard. I will try to investigate in a following PR but would appreciate if the test can be kept for reference and enhanced robustness.

@giraffate
Copy link
Contributor

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Apr 19, 2023

📌 Commit d639062 has been approved by giraffate

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Apr 19, 2023

⌛ Testing commit d639062 with merge f1a552c...

@bors
Copy link
Collaborator

bors commented Apr 19, 2023

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

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.

[arithmetic_side_effects] triggers on macro-generated code integer_arithmetic triggers in derive macro code
7 participants