Rename unit struct to a generic name: Info->Unit

This commit is contained in:
Mingun 2023-08-07 21:35:02 +05:00
parent 2d75ef6b30
commit 93bda5f1dc

View File

@ -636,16 +636,16 @@ fn newtype_variant_containing_externally_tagged_enum() {
#[test] #[test]
fn newtype_variant_containing_unit_struct() { fn newtype_variant_containing_unit_struct() {
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Info; struct Unit;
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "tag")] #[serde(tag = "tag")]
enum Message { enum Message {
Info(Info), Info(Unit),
} }
assert_tokens( assert_tokens(
&Message::Info(Info), &Message::Info(Unit),
&[ &[
Token::Map { len: Some(1) }, Token::Map { len: Some(1) },
Token::Str("tag"), Token::Str("tag"),
@ -655,7 +655,7 @@ fn newtype_variant_containing_unit_struct() {
); );
assert_de_tokens( assert_de_tokens(
&Message::Info(Info), &Message::Info(Unit),
&[ &[
Token::Struct { Token::Struct {
name: "Message", name: "Message",
@ -668,7 +668,7 @@ fn newtype_variant_containing_unit_struct() {
); );
assert_de_tokens( assert_de_tokens(
&Message::Info(Info), &Message::Info(Unit),
&[ &[
Token::Seq { len: Some(1) }, Token::Seq { len: Some(1) },
Token::Str("Info"), Token::Str("Info"),