Remove `Diagnostic::new_with_code`.

Its single use can be replaced with `Diagnostic::new_with_messages`.
This commit is contained in:
Nicholas Nethercote 2023-12-20 16:53:42 +11:00
parent 3a1b8e643a
commit d7a3b6291c
1 changed files with 1 additions and 21 deletions

View File

@ -216,7 +216,7 @@ impl StringPart {
impl Diagnostic {
#[track_caller]
pub fn new<M: Into<DiagnosticMessage>>(level: Level, message: M) -> Self {
Diagnostic::new_with_code(level, None, message)
Diagnostic::new_with_messages(level, vec![(message.into(), Style::NoStyle)])
}
#[track_caller]
@ -235,26 +235,6 @@ impl Diagnostic {
}
}
#[track_caller]
pub(crate) fn new_with_code<M: Into<DiagnosticMessage>>(
level: Level,
code: Option<DiagnosticId>,
message: M,
) -> Self {
Diagnostic {
level,
message: vec![(message.into(), Style::NoStyle)],
code,
span: MultiSpan::new(),
children: vec![],
suggestions: Ok(vec![]),
args: Default::default(),
sort_span: DUMMY_SP,
is_lint: false,
emitted_at: DiagnosticLocation::caller(),
}
}
#[inline(always)]
pub fn level(&self) -> Level {
self.level