Fix adjacently tagged empty tuple variant or struct variant
This commit is contained in:
parent
9dc05c36f0
commit
3cd9d071c2
@ -645,7 +645,7 @@ fn serialize_adjacently_tagged_variant(
|
||||
|
||||
let (_, ty_generics, where_clause) = params.generics.split_for_impl();
|
||||
|
||||
let wrapper_generics = if let Style::Unit = variant.style {
|
||||
let wrapper_generics = if fields_ident.is_empty() {
|
||||
params.generics.clone()
|
||||
} else {
|
||||
bound::with_lifetime_bound(¶ms.generics, "'__a")
|
||||
|
@ -567,6 +567,17 @@ fn test_gen() {
|
||||
}
|
||||
|
||||
assert::<AssocDeriveMulti<i32, NoSerdeImpl>>();
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(tag = "t", content = "c")]
|
||||
enum EmptyAdjacentlyTagged {
|
||||
#[allow(dead_code)]
|
||||
Struct {},
|
||||
#[allow(dead_code)]
|
||||
Tuple(),
|
||||
}
|
||||
|
||||
assert_ser::<EmptyAdjacentlyTagged>();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user