Skip to content

Commit 5ded2d5

Browse files
committed
Remove LabelKind.
It has three variants, but only `LabelKind::Label` is ever used. This means `SingleLabelManySpans::kind` can also be removed.
1 parent d24c315 commit 5ded2d5

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

compiler/rustc_builtin_macros/src/format.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,6 @@ fn report_invalid_references(
883883
highlight: SingleLabelManySpans {
884884
spans: args.explicit_args().iter().map(|arg| arg.expr.span).collect(),
885885
label: "",
886-
kind: rustc_errors::LabelKind::Label,
887886
},
888887
});
889888
// Point out `{:.*}` placeholders: those take an extra argument.

compiler/rustc_errors/src/diagnostic_impls.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -312,25 +312,13 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetDataLayoutErrors<'_>
312312
pub struct SingleLabelManySpans {
313313
pub spans: Vec<Span>,
314314
pub label: &'static str,
315-
pub kind: LabelKind,
316315
}
317316
impl AddToDiagnostic for SingleLabelManySpans {
318317
fn add_to_diagnostic_with<F>(self, diag: &mut crate::Diagnostic, _: F) {
319-
match self.kind {
320-
LabelKind::Note => diag.span_note(self.spans, self.label),
321-
LabelKind::Label => diag.span_labels(self.spans, self.label),
322-
LabelKind::Help => diag.span_help(self.spans, self.label),
323-
};
318+
diag.span_labels(self.spans, self.label);
324319
}
325320
}
326321

327-
/// The kind of label to attach when using [`SingleLabelManySpans`]
328-
pub enum LabelKind {
329-
Note,
330-
Label,
331-
Help,
332-
}
333-
334322
#[derive(Subdiagnostic)]
335323
#[label(errors_expected_lifetime_parameter)]
336324
pub struct ExpectedLifetimeParameter {

compiler/rustc_errors/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ pub use diagnostic_builder::{
3636
};
3737
pub use diagnostic_impls::{
3838
DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
39-
IndicateAnonymousLifetime, InvalidFlushedDelayedDiagnosticLevel, LabelKind,
40-
SingleLabelManySpans,
39+
IndicateAnonymousLifetime, InvalidFlushedDelayedDiagnosticLevel, SingleLabelManySpans,
4140
};
4241
pub use emitter::ColorConfig;
4342
pub use rustc_error_messages::{

0 commit comments

Comments
 (0)