Filter OnceNote in diagnostic infra.
This commit is contained in:
@@ -135,7 +135,12 @@ impl Diagnostic {
|
||||
| Level::Error { .. }
|
||||
| Level::FailureNote => true,
|
||||
|
||||
Level::Warning | Level::Note | Level::Help | Level::Allow | Level::Expect(_) => false,
|
||||
Level::Warning
|
||||
| Level::Note
|
||||
| Level::OnceNote
|
||||
| Level::Help
|
||||
| Level::Allow
|
||||
| Level::Expect(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,6 +338,13 @@ impl Diagnostic {
|
||||
self
|
||||
}
|
||||
|
||||
/// Prints the span with a note above it.
|
||||
/// This is like [`Diagnostic::note()`], but it gets its own span.
|
||||
pub fn note_once(&mut self, msg: &str) -> &mut Self {
|
||||
self.sub(Level::OnceNote, msg, MultiSpan::new(), None);
|
||||
self
|
||||
}
|
||||
|
||||
/// Prints the span with a note above it.
|
||||
/// This is like [`Diagnostic::note()`], but it gets its own span.
|
||||
pub fn span_note<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self {
|
||||
@@ -340,6 +352,13 @@ impl Diagnostic {
|
||||
self
|
||||
}
|
||||
|
||||
/// Prints the span with a note above it.
|
||||
/// This is like [`Diagnostic::note()`], but it gets its own span.
|
||||
pub fn span_note_once<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self {
|
||||
self.sub(Level::OnceNote, msg, sp.into(), None);
|
||||
self
|
||||
}
|
||||
|
||||
/// Add a warning attached to this diagnostic.
|
||||
pub fn warn(&mut self, msg: &str) -> &mut Self {
|
||||
self.sub(Level::Warning, msg, MultiSpan::new(), None);
|
||||
|
||||
Reference in New Issue
Block a user