feat: show what lint was overruled
This commit is contained in:
parent
4c37f6d78c
commit
d12923346c
8 changed files with 36 additions and 13 deletions
|
|
@ -20,7 +20,7 @@ pub(crate) struct OverruledAttribute<'a> {
|
|||
pub(crate) enum OverruledAttributeSub {
|
||||
DefaultSource { id: String },
|
||||
NodeSource { span: Span, reason: Option<Symbol> },
|
||||
CommandLineSource,
|
||||
CommandLineSource { id: Symbol },
|
||||
}
|
||||
|
||||
impl Subdiagnostic for OverruledAttributeSub {
|
||||
|
|
@ -36,8 +36,9 @@ impl Subdiagnostic for OverruledAttributeSub {
|
|||
diag.note(rationale.to_string());
|
||||
}
|
||||
}
|
||||
OverruledAttributeSub::CommandLineSource => {
|
||||
diag.note(msg!("`forbid` lint level was set on command line"));
|
||||
OverruledAttributeSub::CommandLineSource { id } => {
|
||||
diag.note(msg!("`forbid` lint level was set on command line (`-F {$id}`)"));
|
||||
diag.arg("id", id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -580,7 +580,9 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
|||
LintLevelSource::Node { span, reason, .. } => {
|
||||
OverruledAttributeSub::NodeSource { span, reason }
|
||||
}
|
||||
LintLevelSource::CommandLine(_, _) => OverruledAttributeSub::CommandLineSource,
|
||||
LintLevelSource::CommandLine(name, _) => {
|
||||
OverruledAttributeSub::CommandLineSource { id: name }
|
||||
}
|
||||
};
|
||||
if !fcw_warning {
|
||||
self.sess.dcx().emit_err(OverruledAttribute {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue