1
Fork 0

Streamline struct_lint_level.

We can just get the error level in the `match` and then use
`DiagnosticBuilder::new`. This then means a number of `DiagCtxt`
functions are no longer needed, because this was the one place that used
them.

Note: the commit changes the treatment of spans for `Expect`, which was
different to all the other cases, but this has no apparent effect.
This commit is contained in:
Nicholas Nethercote 2023-12-19 13:47:09 +11:00
parent c8c1615df0
commit de303b87c9
3 changed files with 13 additions and 104 deletions

View file

@ -321,16 +321,6 @@ impl Session {
}
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_span_warn_with_expectation<S: Into<MultiSpan>>(
&self,
sp: S,
msg: impl Into<DiagnosticMessage>,
id: lint::LintExpectationId,
) -> DiagnosticBuilder<'_, ()> {
self.dcx().struct_span_warn_with_expectation(sp, msg, id)
}
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(
&self,
sp: S,
@ -346,24 +336,6 @@ impl Session {
}
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_warn_with_expectation(
&self,
msg: impl Into<DiagnosticMessage>,
id: lint::LintExpectationId,
) -> DiagnosticBuilder<'_, ()> {
self.dcx().struct_warn_with_expectation(msg, id)
}
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_span_allow<S: Into<MultiSpan>>(
&self,
sp: S,
msg: impl Into<DiagnosticMessage>,
) -> DiagnosticBuilder<'_, ()> {
self.dcx().struct_span_allow(sp, msg)
}
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_allow(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
self.dcx().struct_allow(msg)
}