diff --git a/serde_derive/src/internals/attr.rs b/serde_derive/src/internals/attr.rs index 9875b660..b0a7d08a 100644 --- a/serde_derive/src/internals/attr.rs +++ b/serde_derive/src/internals/attr.rs @@ -307,6 +307,12 @@ impl Container { continue; } + if let syn::Meta::List(meta) = &attr.meta { + if meta.tokens.is_empty() { + continue; + } + } + if let Err(err) = attr.parse_nested_meta(|meta| { if meta.path == RENAME { // #[serde(rename = "foo")] @@ -762,6 +768,12 @@ impl Variant { continue; } + if let syn::Meta::List(meta) = &attr.meta { + if meta.tokens.is_empty() { + continue; + } + } + if let Err(err) = attr.parse_nested_meta(|meta| { if meta.path == RENAME { // #[serde(rename = "foo")] @@ -1033,6 +1045,12 @@ impl Field { continue; } + if let syn::Meta::List(meta) = &attr.meta { + if meta.tokens.is_empty() { + continue; + } + } + if let Err(err) = attr.parse_nested_meta(|meta| { if meta.path == RENAME { // #[serde(rename = "foo")] diff --git a/test_suite/tests/regression/issue2415.rs b/test_suite/tests/regression/issue2415.rs new file mode 100644 index 00000000..31c52270 --- /dev/null +++ b/test_suite/tests/regression/issue2415.rs @@ -0,0 +1,5 @@ +use serde_derive::Serialize; + +#[derive(Serialize)] +#[serde()] +pub struct S;