Add SubdiagnosticMessageOp
as a trait alias.
It avoids a lot of repetition.
This commit is contained in:
parent
0d531351e8
commit
6b175a848d
19 changed files with 68 additions and 181 deletions
|
@ -3,8 +3,8 @@ use std::borrow::Cow;
|
|||
use rustc_ast::token::Token;
|
||||
use rustc_ast::{Path, Visibility};
|
||||
use rustc_errors::{
|
||||
codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, IntoDiagnostic, Level,
|
||||
SubdiagnosticMessage,
|
||||
codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
|
||||
IntoDiagnostic, Level, SubdiagnosticMessageOp,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_session::errors::ExprParenthesesNeeded;
|
||||
|
@ -1475,10 +1475,7 @@ pub(crate) struct FnTraitMissingParen {
|
|||
}
|
||||
|
||||
impl AddToDiagnostic for FnTraitMissingParen {
|
||||
fn add_to_diagnostic_with<F>(self, diag: &mut rustc_errors::Diagnostic, _: F)
|
||||
where
|
||||
F: Fn(&mut rustc_errors::Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
|
||||
{
|
||||
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
|
||||
diag.span_label(self.span, crate::fluent_generated::parse_fn_trait_missing_paren);
|
||||
let applicability = if self.machine_applicable {
|
||||
Applicability::MachineApplicable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue