mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 20:11:02 +00:00
Fix adjacently tagged empty tuple variant or struct variant
This commit is contained in:
@@ -645,7 +645,7 @@ fn serialize_adjacently_tagged_variant(
|
|||||||
|
|
||||||
let (_, ty_generics, where_clause) = params.generics.split_for_impl();
|
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()
|
params.generics.clone()
|
||||||
} else {
|
} else {
|
||||||
bound::with_lifetime_bound(¶ms.generics, "'__a")
|
bound::with_lifetime_bound(¶ms.generics, "'__a")
|
||||||
|
|||||||
@@ -567,6 +567,17 @@ fn test_gen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert::<AssocDeriveMulti<i32, NoSerdeImpl>>();
|
assert::<AssocDeriveMulti<i32, NoSerdeImpl>>();
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(tag = "t", content = "c")]
|
||||||
|
enum EmptyAdjacentlyTagged {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
Struct {},
|
||||||
|
#[allow(dead_code)]
|
||||||
|
Tuple(),
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_ser::<EmptyAdjacentlyTagged>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user