Skip to content

Commit 4cb8d07

Browse files
committed
Accept empty #[serde()] attribute
1 parent 6ab55a1 commit 4cb8d07

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

serde_derive/src/internals/attr.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ impl Container {
307307
continue;
308308
}
309309

310+
if let syn::Meta::List(meta) = &attr.meta {
311+
if meta.tokens.is_empty() {
312+
continue;
313+
}
314+
}
315+
310316
if let Err(err) = attr.parse_nested_meta(|meta| {
311317
if meta.path == RENAME {
312318
// #[serde(rename = "foo")]
@@ -762,6 +768,12 @@ impl Variant {
762768
continue;
763769
}
764770

771+
if let syn::Meta::List(meta) = &attr.meta {
772+
if meta.tokens.is_empty() {
773+
continue;
774+
}
775+
}
776+
765777
if let Err(err) = attr.parse_nested_meta(|meta| {
766778
if meta.path == RENAME {
767779
// #[serde(rename = "foo")]
@@ -1033,6 +1045,12 @@ impl Field {
10331045
continue;
10341046
}
10351047

1048+
if let syn::Meta::List(meta) = &attr.meta {
1049+
if meta.tokens.is_empty() {
1050+
continue;
1051+
}
1052+
}
1053+
10361054
if let Err(err) = attr.parse_nested_meta(|meta| {
10371055
if meta.path == RENAME {
10381056
// #[serde(rename = "foo")]

0 commit comments

Comments
 (0)