diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-08-02 16:56:14 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-08-02 16:56:14 +0200 |
| commit | d5ff97f42ed1e682a66ea8d51e5f9ed1be547b9c (patch) | |
| tree | 2fdc3a368c4320051e3f62a460f3912fe5f44c7c /src/diagnostic.rs | |
| parent | 533374db14087ac54fdc86afa5f009487ac1b850 (diff) | |
Move binary into separate crate and tidy dependencies ðŸŽ
Diffstat (limited to 'src/diagnostic.rs')
| -rw-r--r-- | src/diagnostic.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/diagnostic.rs b/src/diagnostic.rs index a5c5d0b8..fc332aac 100644 --- a/src/diagnostic.rs +++ b/src/diagnostic.rs @@ -4,14 +4,17 @@ //! layout. However, this is a best effort process and bad things will still //! generate errors and warnings. +#[cfg(feature = "serialize")] use serde::Serialize; + use crate::syntax::span::SpanVec; /// A list of spanned diagnostics. pub type Diagnostics = SpanVec<Diagnostic>; /// A diagnostic that arose in parsing or layouting. -#[derive(Debug, Clone, Eq, PartialEq, Serialize)] +#[derive(Debug, Clone, Eq, PartialEq)] +#[cfg_attr(feature = "serialize", derive(Serialize))] pub struct Diagnostic { /// How severe / important the diagnostic is. pub level: Level, @@ -20,8 +23,9 @@ pub struct Diagnostic { } /// How severe / important a diagnostic is. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] -#[serde(rename_all = "camelCase")] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[cfg_attr(feature = "serialize", derive(Serialize))] +#[cfg_attr(feature = "serialize", serde(rename_all = "camelCase"))] pub enum Level { Warning, Error, |
