Support lint expectations for --force-warn
lints (RFC 2383)
This commit is contained in:
parent
ec55c61305
commit
8527a3d369
19 changed files with 317 additions and 71 deletions
|
@ -162,13 +162,19 @@ pub enum Level {
|
|||
///
|
||||
/// See RFC 2383.
|
||||
///
|
||||
/// The `LintExpectationId` is used to later link a lint emission to the actual
|
||||
/// The [`LintExpectationId`] is used to later link a lint emission to the actual
|
||||
/// expectation. It can be ignored in most cases.
|
||||
Expect(LintExpectationId),
|
||||
/// The `warn` level will produce a warning if the lint was violated, however the
|
||||
/// compiler will continue with its execution.
|
||||
Warn,
|
||||
ForceWarn,
|
||||
/// This lint level is a special case of [`Warn`], that can't be overridden. This is used
|
||||
/// to ensure that a lint can't be suppressed. This lint level can currently only be set
|
||||
/// via the console and is therefore session specific.
|
||||
///
|
||||
/// The [`LintExpectationId`] is intended to fulfill expectations marked via the
|
||||
/// `#[expect]` attribute, that will still be suppressed due to the level.
|
||||
ForceWarn(Option<LintExpectationId>),
|
||||
/// The `deny` level will produce an error and stop further execution after the lint
|
||||
/// pass is complete.
|
||||
Deny,
|
||||
|
@ -184,7 +190,7 @@ impl Level {
|
|||
Level::Allow => "allow",
|
||||
Level::Expect(_) => "expect",
|
||||
Level::Warn => "warn",
|
||||
Level::ForceWarn => "force-warn",
|
||||
Level::ForceWarn(_) => "force-warn",
|
||||
Level::Deny => "deny",
|
||||
Level::Forbid => "forbid",
|
||||
}
|
||||
|
@ -219,7 +225,7 @@ impl Level {
|
|||
|
||||
pub fn is_error(self) -> bool {
|
||||
match self {
|
||||
Level::Allow | Level::Expect(_) | Level::Warn | Level::ForceWarn => false,
|
||||
Level::Allow | Level::Expect(_) | Level::Warn | Level::ForceWarn(_) => false,
|
||||
Level::Deny | Level::Forbid => true,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue