1
Fork 0

Add OnceHelp lint level (same as OnceNote, except for help)

This commit is contained in:
Urgau 2023-07-25 19:37:45 +02:00
parent bf1e3f31f9
commit eba5b44729
3 changed files with 14 additions and 4 deletions

View file

@ -270,6 +270,7 @@ impl Diagnostic {
| Level::Note
| Level::OnceNote
| Level::Help
| Level::OnceHelp
| Level::Allow
| Level::Expect(_) => false,
}
@ -532,6 +533,13 @@ impl Diagnostic {
self
}
/// Prints the span with a help above it.
/// This is like [`Diagnostic::help()`], but it gets its own span.
pub fn help_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
self.sub(Level::OnceHelp, msg, MultiSpan::new(), None);
self
}
/// Add a help message attached to this diagnostic with a customizable highlighted message.
pub fn highlighted_help(&mut self, msg: Vec<(String, Style)>) -> &mut Self {
self.sub_with_highlights(Level::Help, msg, MultiSpan::new(), None);