mirror of https://github.com/zkat/miette.git
use a msrv-friendly enum Default impl
This commit is contained in:
parent
2b207b02bb
commit
e0d6d4e186
|
|
@ -96,11 +96,10 @@ pub struct Diagnostic {
|
||||||
/// The severity of a diagnostic
|
/// The severity of a diagnostic
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
|
#[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 {
|
pub enum Severity {
|
||||||
/// This is an error
|
/// This is an error
|
||||||
#[serde(rename = "error")]
|
#[serde(rename = "error")]
|
||||||
#[default]
|
|
||||||
Error,
|
Error,
|
||||||
/// This is a warning
|
/// This is a warning
|
||||||
#[serde(rename = "warning")]
|
#[serde(rename = "warning")]
|
||||||
|
|
@ -115,6 +114,12 @@ pub enum Severity {
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Severity {
|
||||||
|
fn default() -> Self {
|
||||||
|
Severity::Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A label/span indicating relevant portions of a source file for a Diagnostic
|
/// A label/span indicating relevant portions of a source file for a Diagnostic
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue