Remove LabelKind
.
It has three variants, but only `LabelKind::Label` is ever used. This means `SingleLabelManySpans::kind` can also be removed.
This commit is contained in:
parent
ce0f703554
commit
49040d088a
3 changed files with 2 additions and 16 deletions
|
@ -883,7 +883,6 @@ fn report_invalid_references(
|
||||||
highlight: SingleLabelManySpans {
|
highlight: SingleLabelManySpans {
|
||||||
spans: args.explicit_args().iter().map(|arg| arg.expr.span).collect(),
|
spans: args.explicit_args().iter().map(|arg| arg.expr.span).collect(),
|
||||||
label: "",
|
label: "",
|
||||||
kind: rustc_errors::LabelKind::Label,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// Point out `{:.*}` placeholders: those take an extra argument.
|
// Point out `{:.*}` placeholders: those take an extra argument.
|
||||||
|
|
|
@ -312,25 +312,13 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetDataLayoutErrors<'_>
|
||||||
pub struct SingleLabelManySpans {
|
pub struct SingleLabelManySpans {
|
||||||
pub spans: Vec<Span>,
|
pub spans: Vec<Span>,
|
||||||
pub label: &'static str,
|
pub label: &'static str,
|
||||||
pub kind: LabelKind,
|
|
||||||
}
|
}
|
||||||
impl AddToDiagnostic for SingleLabelManySpans {
|
impl AddToDiagnostic for SingleLabelManySpans {
|
||||||
fn add_to_diagnostic_with<F>(self, diag: &mut crate::Diagnostic, _: F) {
|
fn add_to_diagnostic_with<F>(self, diag: &mut crate::Diagnostic, _: F) {
|
||||||
match self.kind {
|
diag.span_labels(self.spans, self.label);
|
||||||
LabelKind::Note => diag.span_note(self.spans, self.label),
|
|
||||||
LabelKind::Label => diag.span_labels(self.spans, self.label),
|
|
||||||
LabelKind::Help => diag.span_help(self.spans, self.label),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The kind of label to attach when using [`SingleLabelManySpans`]
|
|
||||||
pub enum LabelKind {
|
|
||||||
Note,
|
|
||||||
Label,
|
|
||||||
Help,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
#[label(errors_expected_lifetime_parameter)]
|
#[label(errors_expected_lifetime_parameter)]
|
||||||
pub struct ExpectedLifetimeParameter {
|
pub struct ExpectedLifetimeParameter {
|
||||||
|
|
|
@ -36,8 +36,7 @@ pub use diagnostic_builder::{
|
||||||
};
|
};
|
||||||
pub use diagnostic_impls::{
|
pub use diagnostic_impls::{
|
||||||
DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
|
DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
|
||||||
IndicateAnonymousLifetime, InvalidFlushedDelayedDiagnosticLevel, LabelKind,
|
IndicateAnonymousLifetime, InvalidFlushedDelayedDiagnosticLevel, SingleLabelManySpans,
|
||||||
SingleLabelManySpans,
|
|
||||||
};
|
};
|
||||||
pub use emitter::ColorConfig;
|
pub use emitter::ColorConfig;
|
||||||
pub use rustc_error_messages::{
|
pub use rustc_error_messages::{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue