-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Always print lints from plugins, if they're available #77671
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
r+ on making this happen, I'll let eddy review the PR (though i should be able to if i get time) |
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.
Clippy part LGTM 👍
This comment has been minimized.
This comment has been minimized.
f014442
to
146f09e
Compare
This comment has been minimized.
This comment has been minimized.
146f09e
to
7be0d4f
Compare
This comment has been minimized.
This comment has been minimized.
7be0d4f
to
1cdd047
Compare
This comment has been minimized.
This comment has been minimized.
1cdd047
to
2ba3a00
Compare
This comment has been minimized.
This comment has been minimized.
2ba3a00
to
dfe8455
Compare
☔ The latest upstream changes (presumably #79228) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
Currently you can get a list of lints and lint groups by running `rustc -Whelp`. This prints an additional line at the end: ``` Compiler plugins can provide additional lints and lint groups. To see a listing of these, re-run `rustc -W help` with a crate filename. ``` Clippy is such a "compiler plugin", that provides additional lints. Running `clippy-driver -Whelp` (`rustc` wrapper) still only prints the rustc lints with the above message at the end. But when running `clippy-driver -Whelp main.rs`, where `main.rs` is any rust file, it also prints Clippy lints. I don't think this is a good approach from a UX perspective: Why is a random file necessary to print a help message? This commit changes this behavior: Whenever a compiler callback registers lints, it is assumed that these lints come from a plugin and are printed without having to specify a Rust source file.
Also stop updating the lintlist module in clippy_dev update_lints
dfe8455
to
f4fb47b
Compare
@eddyb @Manishearth This PR is 1 1/2 months old and waiting for review. This would be nice to have from a Clippy perspective. |
For more context, it's also useful for |
Oh right, that's why I did this in the first place. I already forgot lol 😄 |
compiler/rustc_driver/src/lib.rs
Outdated
"Compiler plugins can provide additional lints and lint groups. To see a \ | ||
listing of these, re-run `rustc -W help` with a crate filename." | ||
); | ||
println!("Compiler plugins can provide additional lints and lint groups."); |
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.
let's actually just get rid of this? It's not relevant to clippy, and compiler plugins are not a common thing.
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 reworded it in e54c060. Removing this would also involve dealing with this case in the match statement somehow. I think printing a message, that tools can provide more lints is a good way to deal with this case.
@@ -1,2942 +0,0 @@ | |||
//! This file is managed by `cargo dev update_lints`. Do not edit or format this file. |
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.
YAY
@bors r=oli-obk,Manishearth |
📌 Commit e54c060 has been approved by |
🌲 The tree is currently closed for pull requests below priority 500, this pull request will be tested once the tree is reopened |
r? @oli-obk |
☀️ Test successful - checks-actions |
…oli-obk,Manishearth Always print lints from plugins, if they're available Currently you can get a list of lints and lint groups by running `rustc -Whelp`. This prints an additional line at the end: ``` Compiler plugins can provide additional lints and lint groups. To see a listing of these, re-run `rustc -W help` with a crate filename. ``` Clippy is such a "compiler plugin", that provides additional lints. Running `clippy-driver -Whelp` (`rustc` wrapper) still only prints the rustc lints with the above message at the end. But when running `clippy-driver -Whelp main.rs`, where `main.rs` is any rust file, it also prints Clippy lints. I don't think this is a good approach from a UX perspective: Why is a random file necessary to print a help message? This PR changes this behavior: Whenever a compiler callback registers lints, it is assumed that these lints come from a plugin and are printed without having to specify a Rust source file. Fixes rust-lang/rust-clippy#6122 cc `@Manishearth` `@ebroto` for the Clippy changes.
Currently you can get a list of lints and lint groups by running
rustc -Whelp
. This prints an additional line at the end:Clippy is such a "compiler plugin", that provides additional lints.
Running
clippy-driver -Whelp
(rustc
wrapper) still only prints therustc lints with the above message at the end. But when running
clippy-driver -Whelp main.rs
, wheremain.rs
is any rust file, italso prints Clippy lints. I don't think this is a good approach from a
UX perspective: Why is a random file necessary to print a help message?
This PR changes this behavior: Whenever a compiler callback
registers lints, it is assumed that these lints come from a plugin and
are printed without having to specify a Rust source file.
Fixes rust-lang/rust-clippy#6122
cc @Manishearth @ebroto for the Clippy changes.