-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
don't lint [mixed_attributes_style
] when mixing docs and other attrs
#12486
Conversation
I know |
95646b8
to
b434eda
Compare
Instead of changing the lint pass and having to handle new cases, why not handle doc comments separately from the other attributes? Should be simpler, no? |
Oh I see, |
I wasn't sure if a post-expansion early pass wouldn't just run into the same issue. I could be wrong on this, but my understanding of the issue here is that outlined
I'm not sure. One "downside" I suppose is that post-expansion lints don't see the disabled |
I'm surprised that modules would get inlined in the AST pass. Would be worth checking it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think we should avoid linting on differing attributes, but I would also be fine with just landing the PR with allowing doc comments for now if that makes it easier (like it does rn), just so the lint level attribute bug is fixed and people who disagree with the lint can at least allow it properly
I also tested it locally and yes, a post-expansion early lint pass also seems to have the same issue (inner attributes of the other file being part of the |
Make sense, I'll open another issue addressing the other problem |
After experimenting on this a little bit, I ended up changes almost everything in the src file, might as well try to fix it... The only problem was it still has some false-negative afaik. One of them being it's unable to detect the problem inside a nested module inside of test module, idk if it's by design or not, since is very specific. (If it's unexpected, I can But hey, having FN is better than having FP right?! |
f69739b
to
1c71163
Compare
Please prefer false negatives over false positives, especially for a novel lint! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes make sense to me, 👍 for also only linting on same attributes
just some minor comments and I think it's ready
Inner proc macro attributes are unstable anyway so I would say that false negative is fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just some doc nits I found
Can you also squash the commits?
don't lint [`mixed_attributes_style`] when mixing docs and other attrs add test files for issue rust-lang#12436 move [`mixed_attributes_style`] to `LateLintPass` to enable global `allow` stop [`mixed_attributes_style`] from linting on different attributes add `@compile-flags` to [`mixed_attributes_style`]'s test; turns out not linting in test mod is not a FN. Apply suggestions from code review Co-authored-by: Timo <[email protected]> move [`mixed_attributes_style`] to late pass and stop it from linting on different kind of attributes
@y21 oops, mess up the commit message, should've put the last line first... but anyway, it should be good now, thank you for all the patience~ |
yep, looks good, thank you for fixing these issues! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
…ulacrum [beta] Clippy backport r? `@Mark-Simulacrum` Backports: - rust-lang/rust-clippy#12486 - rust-lang/rust-clippy#12572 - rust-lang/rust-clippy#12508 - rust-lang/rust-clippy#12617 The first one is a bit bigger as usual for a backport. But it fixes a major issue with this lint that we overlooked. So I think this is worth it. After that was merged into nightly, there were no new issues opened about this lint, so IMO this is safe to backport to `beta` and put into stable.
fixes: #12435
fixes: #12436
fixes: #12530
changelog: don't lint [
mixed_attributes_style
] when mixing different kind of attrs; and move it to late pass;