use a msrv-friendly enum Default impl

This commit is contained in:
Aria Beingessner 2023-03-28 15:04:31 -04:00
parent 2b207b02bb
commit e0d6d4e186
1 changed files with 7 additions and 2 deletions

View File

@ -96,11 +96,10 @@ pub struct Diagnostic {
/// The severity of a diagnostic
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
pub enum Severity {
/// This is an error
#[serde(rename = "error")]
#[default]
Error,
/// This is a warning
#[serde(rename = "warning")]
@ -115,6 +114,12 @@ pub enum Severity {
Unknown,
}
impl Default for Severity {
fn default() -> Self {
Severity::Error
}
}
/// A label/span indicating relevant portions of a source file for a Diagnostic
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]