-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Shorten Span of unused macro lints #90761
Conversation
69bfa8e
to
3f9b7d2
Compare
#![allow(dead_code)] | ||
#![allow(dead_code, unused_macros)] |
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.
This one is very insteresting.
rust/src/test/ui/proc-macro/auxiliary/issue-39889.rs
Lines 10 to 17 in 493ea77
pub fn f(_input: TokenStream) -> TokenStream { | |
let rules = r#" | |
macro_rules! id { | |
($($tt:tt)*) => { $($tt)* }; | |
} | |
"#; | |
rules.parse().unwrap() | |
} |
Any idea why the unused macro wasn't linted before?
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.
Good question, no idea. My best guess is that now we have a span for id
, but we didn't for the whole macro. I think changing the test is reasonable. The issue is about the macro expansion machinery, so it's reasonable to allow
it.
#![allow(dead_code)] | ||
#![allow(dead_code, unused_macros)] |
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.
Good question, no idea. My best guess is that now we have a span for id
, but we didn't for the whole macro. I think changing the test is reasonable. The issue is about the macro expansion machinery, so it's reasonable to allow
it.
I have one stylistic nitpick, I'm r+ing, but if you want to fix it gets picked up, go ahead. @bors r+ |
📌 Commit 3f9b7d2113e50e062a7464ad861d933290e5fda0 has been approved by |
This comment has been minimized.
This comment has been minimized.
8ea10b7
to
9f6ca74
Compare
The span has been recuded to the actual ident, instead of linting the *whole* macro.
@bors r=estebank |
📌 Commit 9f6ca74 has been approved by |
Shorten Span of unused macro lints The span has been reduced to the actual ident of the macro, instead of linting the *whole* macro. Closes rust-lang#90745 r? `@estebank`
⌛ Testing commit 9f6ca74 with merge 5926b64a90e7d28dacce5b89ec935eb73656db23... |
💔 Test failed - checks-actions |
The job Click to see the possible cause of the failure (guessed by this bot)
|
That looks spurious, nothing I can do?! |
@bors retry |
⌛ Testing commit 9f6ca74 with merge 6cc0c20eda28e8c057542cb97e0043e066fcef74... |
💔 Test failed - checks-actions |
The job Click to see the possible cause of the failure (guessed by this bot)
|
@bors retry |
Shorten Span of unused macro lints The span has been reduced to the actual ident of the macro, instead of linting the *whole* macro. Closes rust-lang#90745 r? `@estebank`
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#90589 (rustc_llvm: update PassWrapper for recent LLVM) - rust-lang#90644 (Extend the const swap feature) - rust-lang#90704 (Unix ExitStatus comments and a tiny docs fix) - rust-lang#90761 (Shorten Span of unused macro lints) - rust-lang#90795 (Add more comments to explain the code to generate the search index) - rust-lang#90798 (Document `unreachable!` custom panic message) - rust-lang#90826 (rustc_feature: Convert `BuiltinAttribute` from tuple to a struct) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…span, r=cjgillot Reduce span of let else irrefutable_let_patterns warning Huge spans aren't good for IDE users as they underline constructs that are possibly multiline. Similar PR to rust-lang#90761 which did the same for the `unused_macros` lint.
Shrink `missing_{safety,errors,panics}_doc` spans Shrink the spans of `clippy::missing_*_doc` to match `missing_docs` and don't cover the entire item anymore. This helps readability in IDEs by not coloring the entire screen yellow, similar to rust-lang/rust#103749 and rust-lang/rust#90761. before: ![image](https://user-images.githubusercontent.com/26522220/199483288-af0cf0c2-a9e4-47a8-81e3-50ccf380d939.png) after: ![image](https://user-images.githubusercontent.com/26522220/199483366-445e5ddd-9f71-4de1-85be-43461c9b7d5d.png) changelog: [`missing_safety_doc`], [`missing_error_doc`], [`missing_panics_doc`]: These lints no longer span the entire item.
The span has been reduced to the actual ident of the macro, instead of linting the
whole macro.
Closes #90745
r? @estebank