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

do not trigger MATCH_LIKE_MATCHES_MACRO lint with attrs #6290

Merged
merged 3 commits into from
Nov 28, 2020

Conversation

alex-700
Copy link
Contributor

@alex-700 alex-700 commented Nov 4, 2020

fixed #6289
changelog: do not trigger MATCH_LIKE_MATCHES_MACRO lint for arms with attrs

@rust-highfive
Copy link

r? @flip1995

(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 Nov 4, 2020
@alex-700 alex-700 force-pushed the fix-match-like-matches branch 2 times, most recently from b8fc060 to c6efae9 Compare November 6, 2020 10:41
@matthiaskrgr
Copy link
Member

Thanks!
@bors r=matthiaskrgr

@bors
Copy link
Collaborator

bors commented Nov 6, 2020

📌 Commit c6efae9 has been approved by matthiaskrgr

bors added a commit that referenced this pull request Nov 6, 2020
do not trigger MATCH_LIKE_MATCHES_MACRO lint with attrs

fixed #6289
changelog: do not trigger MATCH_LIKE_MATCHES_MACRO lint for arms with attrs
@bors
Copy link
Collaborator

bors commented Nov 6, 2020

⌛ Testing commit c6efae9 with merge b7715f2...

@bors
Copy link
Collaborator

bors commented Nov 6, 2020

💔 Test failed - checks-action_test

@matthiaskrgr
Copy link
Member

You need to update the .fixed file as well https://github.com/rust-lang/rust-clippy/runs/1365306167#step:13:1203

@alex-700
Copy link
Contributor Author

alex-700 commented Nov 7, 2020

@matthiaskrgr it's not easy :) The current .fixed file is correct. CI failed because of the bug in my implementation. I didn't take into account that LateLintPass already dropped cfg attributes, if it resolved them into false (if I got it right). And ... I don't know how to fix this. Any ideas?

@flip1995
Copy link
Member

flip1995 commented Nov 8, 2020

I don't think we can fix this at all. cfg attributes are already resolved before the AST is even built, so clippy doesn't have access to them. What we can do is mention this in the lint documentation and set the applicability to MaybeIncorrect

@giraffate
Copy link
Contributor

ping from triage @alex-700. Could you have any update on this?

- it can't be solved completely for attrs evaluated into `false`
- change applicability to MaybeIncorrect and mention it in docs
@alex-700
Copy link
Contributor Author

@giraffate thanks for ping!

I decided don't add this failed test with attributes, but anyway my changes in lint code do their best and don't lint if "see" some arms with attrs. For example it doesn't lint in the initial case mentioned by @matthiaskrgr (in the case when target_os is indeed linux). Also I add a note to known problems and change the applicability to MaybeIncorrect.

"tests failed" in clippy dogfood doesn't seem to be relevant to this PR.

@flip1995 flip1995 added S-waiting-on-bors Status: The marked PR was approved and is only waiting bors and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Nov 28, 2020
@flip1995
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Nov 28, 2020

📌 Commit 84cdb0a has been approved by flip1995

@bors
Copy link
Collaborator

bors commented Nov 28, 2020

⌛ Testing commit 84cdb0a with merge b627731...

@bors
Copy link
Collaborator

bors commented Nov 28, 2020

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

@bors bors merged commit b627731 into rust-lang:master Nov 28, 2020
@alex-700 alex-700 deleted the fix-match-like-matches branch December 29, 2020 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: The marked PR was approved and is only waiting bors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

match_like_matches_macro ignores #[cfg()] attribute in suggestion
6 participants