Format with rustfmt 2019-07-30
This commit is contained in:
parent
fb1cacc10e
commit
668651ee01
@ -453,8 +453,7 @@ impl Container {
|
|||||||
|
|
||||||
// Parse `#[serde(bound = "T: SomeBound")]`
|
// Parse `#[serde(bound = "T: SomeBound")]`
|
||||||
Meta(NameValue(ref m)) if m.ident == BOUND => {
|
Meta(NameValue(ref m)) if m.ident == BOUND => {
|
||||||
if let Ok(where_predicates) =
|
if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
|
||||||
parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
|
|
||||||
{
|
{
|
||||||
ser_bound.set(&m.ident, where_predicates.clone());
|
ser_bound.set(&m.ident, where_predicates.clone());
|
||||||
de_bound.set(&m.ident, where_predicates);
|
de_bound.set(&m.ident, where_predicates);
|
||||||
@ -1013,8 +1012,7 @@ impl Variant {
|
|||||||
|
|
||||||
// Parse `#[serde(bound = "T: SomeBound")]`
|
// Parse `#[serde(bound = "T: SomeBound")]`
|
||||||
Meta(NameValue(ref m)) if m.ident == BOUND => {
|
Meta(NameValue(ref m)) if m.ident == BOUND => {
|
||||||
if let Ok(where_predicates) =
|
if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
|
||||||
parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
|
|
||||||
{
|
{
|
||||||
ser_bound.set(&m.ident, where_predicates.clone());
|
ser_bound.set(&m.ident, where_predicates.clone());
|
||||||
de_bound.set(&m.ident, where_predicates);
|
de_bound.set(&m.ident, where_predicates);
|
||||||
@ -1289,7 +1287,8 @@ impl Field {
|
|||||||
|
|
||||||
// Parse `#[serde(skip_serializing_if = "...")]`
|
// Parse `#[serde(skip_serializing_if = "...")]`
|
||||||
Meta(NameValue(ref m)) if m.ident == SKIP_SERIALIZING_IF => {
|
Meta(NameValue(ref m)) if m.ident == SKIP_SERIALIZING_IF => {
|
||||||
if let Ok(path) = parse_lit_into_expr_path(cx, SKIP_SERIALIZING_IF, &m.lit) {
|
if let Ok(path) = parse_lit_into_expr_path(cx, SKIP_SERIALIZING_IF, &m.lit)
|
||||||
|
{
|
||||||
skip_serializing_if.set(&m.ident, path);
|
skip_serializing_if.set(&m.ident, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1328,8 +1327,7 @@ impl Field {
|
|||||||
|
|
||||||
// Parse `#[serde(bound = "T: SomeBound")]`
|
// Parse `#[serde(bound = "T: SomeBound")]`
|
||||||
Meta(NameValue(ref m)) if m.ident == BOUND => {
|
Meta(NameValue(ref m)) if m.ident == BOUND => {
|
||||||
if let Ok(where_predicates) =
|
if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
|
||||||
parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
|
|
||||||
{
|
{
|
||||||
ser_bound.set(&m.ident, where_predicates.clone());
|
ser_bound.set(&m.ident, where_predicates.clone());
|
||||||
de_bound.set(&m.ident, where_predicates);
|
de_bound.set(&m.ident, where_predicates);
|
||||||
@ -1633,11 +1631,7 @@ pub fn get_serde_meta_items(attr: &syn::Attribute) -> Option<Vec<syn::NestedMeta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_lit_str<'a>(
|
fn get_lit_str<'a>(cx: &Ctxt, attr_name: Symbol, lit: &'a syn::Lit) -> Result<&'a syn::LitStr, ()> {
|
||||||
cx: &Ctxt,
|
|
||||||
attr_name: Symbol,
|
|
||||||
lit: &'a syn::Lit,
|
|
||||||
) -> Result<&'a syn::LitStr, ()> {
|
|
||||||
get_lit_str2(cx, attr_name, attr_name, lit)
|
get_lit_str2(cx, attr_name, attr_name, lit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1267,15 +1267,9 @@ enum StructTrait {
|
|||||||
impl StructTrait {
|
impl StructTrait {
|
||||||
fn serialize_field(&self, span: Span) -> TokenStream {
|
fn serialize_field(&self, span: Span) -> TokenStream {
|
||||||
match *self {
|
match *self {
|
||||||
StructTrait::SerializeMap => {
|
StructTrait::SerializeMap => quote_spanned!(span=> _serde::ser::SerializeMap::serialize_entry),
|
||||||
quote_spanned!(span=> _serde::ser::SerializeMap::serialize_entry)
|
StructTrait::SerializeStruct => quote_spanned!(span=> _serde::ser::SerializeStruct::serialize_field),
|
||||||
}
|
StructTrait::SerializeStructVariant => quote_spanned!(span=> _serde::ser::SerializeStructVariant::serialize_field),
|
||||||
StructTrait::SerializeStruct => {
|
|
||||||
quote_spanned!(span=> _serde::ser::SerializeStruct::serialize_field)
|
|
||||||
}
|
|
||||||
StructTrait::SerializeStructVariant => {
|
|
||||||
quote_spanned!(span=> _serde::ser::SerializeStructVariant::serialize_field)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1301,15 +1295,9 @@ enum TupleTrait {
|
|||||||
impl TupleTrait {
|
impl TupleTrait {
|
||||||
fn serialize_element(&self, span: Span) -> TokenStream {
|
fn serialize_element(&self, span: Span) -> TokenStream {
|
||||||
match *self {
|
match *self {
|
||||||
TupleTrait::SerializeTuple => {
|
TupleTrait::SerializeTuple => quote_spanned!(span=> _serde::ser::SerializeTuple::serialize_element),
|
||||||
quote_spanned!(span=> _serde::ser::SerializeTuple::serialize_element)
|
TupleTrait::SerializeTupleStruct => quote_spanned!(span=> _serde::ser::SerializeTupleStruct::serialize_field),
|
||||||
}
|
TupleTrait::SerializeTupleVariant => quote_spanned!(span=> _serde::ser::SerializeTupleVariant::serialize_field),
|
||||||
TupleTrait::SerializeTupleStruct => {
|
|
||||||
quote_spanned!(span=> _serde::ser::SerializeTupleStruct::serialize_field)
|
|
||||||
}
|
|
||||||
TupleTrait::SerializeTupleVariant => {
|
|
||||||
quote_spanned!(span=> _serde::ser::SerializeTupleVariant::serialize_field)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user