Accept empty #[serde()] attribute

This commit is contained in:
David Tolnay 2023-03-27 22:00:46 -07:00
parent 6ab55a1e52
commit 4cb8d079f8
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -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")]