Format with rustfmt 0.99.4
This commit is contained in:
parent
2753ec757b
commit
53fe1b328e
@ -1172,7 +1172,7 @@ fn deserialize_externally_tagged_enum(
|
|||||||
&variant_names_idents,
|
&variant_names_idents,
|
||||||
cattrs,
|
cattrs,
|
||||||
true,
|
true,
|
||||||
other_idx
|
other_idx,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Match arms to extract a variant from a string
|
// Match arms to extract a variant from a string
|
||||||
@ -1275,7 +1275,7 @@ fn deserialize_internally_tagged_enum(
|
|||||||
&variant_names_idents,
|
&variant_names_idents,
|
||||||
cattrs,
|
cattrs,
|
||||||
true,
|
true,
|
||||||
other_idx
|
other_idx,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Match arms to extract a variant from a string
|
// Match arms to extract a variant from a string
|
||||||
@ -1349,7 +1349,7 @@ fn deserialize_adjacently_tagged_enum(
|
|||||||
&variant_names_idents,
|
&variant_names_idents,
|
||||||
cattrs,
|
cattrs,
|
||||||
true,
|
true,
|
||||||
other_idx
|
other_idx,
|
||||||
));
|
));
|
||||||
|
|
||||||
let variant_arms: &Vec<_> = &variants
|
let variant_arms: &Vec<_> = &variants
|
||||||
@ -1857,7 +1857,7 @@ fn deserialize_generated_identifier(
|
|||||||
fields: &[(String, Ident)],
|
fields: &[(String, Ident)],
|
||||||
cattrs: &attr::Container,
|
cattrs: &attr::Container,
|
||||||
is_variant: bool,
|
is_variant: bool,
|
||||||
other_idx: Option<usize>
|
other_idx: Option<usize>,
|
||||||
) -> Fragment {
|
) -> Fragment {
|
||||||
let this = quote!(__Field);
|
let this = quote!(__Field);
|
||||||
let field_idents: &Vec<_> = &fields.iter().map(|&(_, ref ident)| ident).collect();
|
let field_idents: &Vec<_> = &fields.iter().map(|&(_, ref ident)| ident).collect();
|
||||||
|
@ -111,12 +111,12 @@ fn check_identifier(cx: &Ctxt, cont: &Container) {
|
|||||||
variant.style,
|
variant.style,
|
||||||
cont.attrs.identifier(),
|
cont.attrs.identifier(),
|
||||||
variant.attrs.other(),
|
variant.attrs.other(),
|
||||||
cont.attrs.tag()
|
cont.attrs.tag(),
|
||||||
) {
|
) {
|
||||||
// The `other` attribute may not be used in a variant_identifier.
|
// The `other` attribute may not be used in a variant_identifier.
|
||||||
(_, Identifier::Variant, true, _) => {
|
(_, Identifier::Variant, true, _) => {
|
||||||
cx.error("#[serde(other)] may not be used on a variant_identifier");
|
cx.error("#[serde(other)] may not be used on a variant_identifier");
|
||||||
},
|
}
|
||||||
|
|
||||||
// Variant with `other` attribute cannot appear in untagged enum
|
// Variant with `other` attribute cannot appear in untagged enum
|
||||||
(_, Identifier::No, true, &EnumTag::None) => {
|
(_, Identifier::No, true, &EnumTag::None) => {
|
||||||
@ -133,7 +133,7 @@ fn check_identifier(cx: &Ctxt, cont: &Container) {
|
|||||||
// Variant with `other` attribute must be a unit variant.
|
// Variant with `other` attribute must be a unit variant.
|
||||||
(_, Identifier::Field, true, _) | (_, Identifier::No, true, _) => {
|
(_, Identifier::Field, true, _) | (_, Identifier::No, true, _) => {
|
||||||
cx.error("#[serde(other)] must be on a unit variant");
|
cx.error("#[serde(other)] must be on a unit variant");
|
||||||
},
|
}
|
||||||
|
|
||||||
// Any sort of variant is allowed if this is not an identifier.
|
// Any sort of variant is allowed if this is not an identifier.
|
||||||
(_, Identifier::No, false, _) => {}
|
(_, Identifier::No, false, _) => {}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
use self::serde::de::{self, Visitor, MapAccess, Unexpected};
|
use self::serde::de::{self, MapAccess, Unexpected, Visitor};
|
||||||
use self::serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use self::serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
@ -2360,9 +2360,7 @@ fn test_flatten_any_after_flatten_struct() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let s = Outer {
|
let s = Outer {
|
||||||
inner: Inner {
|
inner: Inner { inner: 0 },
|
||||||
inner: 0,
|
|
||||||
},
|
|
||||||
extra: Any,
|
extra: Any,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ enum EnumSkipAll {
|
|||||||
enum EnumOther {
|
enum EnumOther {
|
||||||
Unit,
|
Unit,
|
||||||
#[serde(other)]
|
#[serde(other)]
|
||||||
Other
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user