-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Diagnostics for -D flags make it slightly harder to allow vs. #![deny(...)] #114030
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
When using
-Dcommand-line flags to deny some lints, the compiler emits diagnostics that are slightly harder to allow, compared to a denied lint via#![deny(...)].Compare the following cases:
The first two provide, one way or another, the name of the lint that can be easily copy-pasted from the terminal to
allow(...)it. In particular, they provide the name of the lint with underscores:However, in the latter two cases, we get a message that is useful, but one needs to manually replace the minuses with underscores (and there may be a few in other cases):
(By the way, note that the diagnostics also seem to print minus signs even if one used underscores in the command line, like here, i.e.
-Ddead_code-- see rust-lang/rust-clippy#11332 as well).For newcomers, it may make it harder to understand that one can
allow(...)things locally with an attribute, plus it may not be obvious that they need to replace the minus signs, even if they tried:And, for experienced developers, it is anyway a bit annoying to have to do the replacement all the time.
I don't know what is the best way to improve this. Perhaps an extra
help:line would not hurt, and in principle, it could be given in all cases:This follows the pattern for the suggestion when using unstable features:
Of course, this could potentially encourage users to
allowthings they should not.