Fix duplicate diagnostics for min_rust_version_invalid_attr#17396
Fix duplicate diagnostics for min_rust_version_invalid_attr#17396Gri-ffin wants to merge 1 commit into
min_rust_version_invalid_attr#17396Conversation
There was a problem hiding this comment.
So this could just be me not understanding clippy, but if I put the code from the test case in the playground, the output there has all of the same errors that the updated test has - so it doesn't look like things were being duplicated previously? Or is something already suppressing the duplicates on the playground?
|
Yes, rustc will deduplicate the lints before outputting them, you can test locally by running |
I think |
|
|
|
|
||
| mixed_attributes_style::check(cx, item.span, &item.attrs); | ||
| duplicated_attributes::check(cx, &item.attrs); | ||
| msrvs::check_attrs(cx.sess(), &item.attrs); |
There was a problem hiding this comment.
But this means you'll need to manually add this line to any check_x where x can have attributes, no? So I think this is missing check_stmt, check_local, etc. Overall I'm unsure if this approach is very maintainable..
There was a problem hiding this comment.
I honestly was conflicted between this and moving the macro expansion of extract_msrv_attr! (meaning check_attributes and check_attributes_post) inside, which would duplicate code, plus I genuinely thought no one would ever put msrv attrs above stmts. But you are right, the second option is probably better instead of sprinkling checks here and there.
There was a problem hiding this comment.
Hmm now that I'm reviewing the implementation, I think duplicated_attributes::check should also be moved.
part of #12379
Separate attributes check from parsing.
changelog: [
min_rust_version_invalid_attr]: fix duplicate diagnostics