Make `Severity::Error` to be default severity

This commit is contained in:
Gavrilikhin Daniil 2023-05-06 09:30:24 +08:00
parent ab20069e85
commit 01b34a4f75
1 changed files with 8 additions and 1 deletions

View File

@ -160,7 +160,7 @@ impl From<Box<dyn std::error::Error + Send + Sync>> for Box<dyn Diagnostic + Sen
/**
[`Diagnostic`] severity. Intended to be used by
[`ReportHandler`](crate::ReportHandler)s to change the way different
[`Diagnostic`]s are displayed.
[`Diagnostic`]s are displayed. Defaults to [`Severity::Error`].
*/
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub enum Severity {
@ -169,9 +169,16 @@ pub enum Severity {
/// Warning. Please take note.
Warning,
/// Critical failure. The program cannot continue.
/// This is the default severity, if you don't specify another one
Error,
}
impl Default for Severity {
fn default() -> Self {
Severity::Error
}
}
/**
Represents readable source code of some sort.