diff --git a/full-moon/src/ast/mod.rs b/full-moon/src/ast/mod.rs index 180b077c..49c36efe 100644 --- a/full-moon/src/ast/mod.rs +++ b/full-moon/src/ast/mod.rs @@ -2216,7 +2216,7 @@ pub struct AstError { additional: Cow<'static, str>, /// If set, this is the complete range of the error - #[serde(skip_serializing_if = "Option::is_none")] + #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] range: Option<(Position, Position)>, } diff --git a/full-moon/src/tokenizer/structs.rs b/full-moon/src/tokenizer/structs.rs index 24160684..da15bd0b 100644 --- a/full-moon/src/tokenizer/structs.rs +++ b/full-moon/src/tokenizer/structs.rs @@ -33,7 +33,7 @@ macro_rules! symbol { $(feature = "" $version),+ ))] )* - #[serde(rename = $string)] + #[cfg_attr(feature = "serde", serde(rename = $string))] $name, )+ }