Format with rustfmt 2019-07-30

This commit is contained in:
David Tolnay 2019-07-31 21:19:46 -07:00
parent fb1cacc10e
commit 668651ee01
2 changed files with 12 additions and 30 deletions

View File

@ -453,8 +453,7 @@ impl Container {
// Parse `#[serde(bound = "T: SomeBound")]`
Meta(NameValue(ref m)) if m.ident == BOUND => {
if let Ok(where_predicates) =
parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
{
ser_bound.set(&m.ident, where_predicates.clone());
de_bound.set(&m.ident, where_predicates);
@ -1013,8 +1012,7 @@ impl Variant {
// Parse `#[serde(bound = "T: SomeBound")]`
Meta(NameValue(ref m)) if m.ident == BOUND => {
if let Ok(where_predicates) =
parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
{
ser_bound.set(&m.ident, where_predicates.clone());
de_bound.set(&m.ident, where_predicates);
@ -1289,7 +1287,8 @@ impl Field {
// Parse `#[serde(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);
}
}
@ -1328,8 +1327,7 @@ impl Field {
// Parse `#[serde(bound = "T: SomeBound")]`
Meta(NameValue(ref m)) if m.ident == BOUND => {
if let Ok(where_predicates) =
parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit)
{
ser_bound.set(&m.ident, where_predicates.clone());
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>(
cx: &Ctxt,
attr_name: Symbol,
lit: &'a syn::Lit,
) -> Result<&'a syn::LitStr, ()> {
fn get_lit_str<'a>(cx: &Ctxt, attr_name: Symbol, lit: &'a syn::Lit) -> Result<&'a syn::LitStr, ()> {
get_lit_str2(cx, attr_name, attr_name, lit)
}

View File

@ -1267,15 +1267,9 @@ enum StructTrait {
impl StructTrait {
fn serialize_field(&self, span: Span) -> TokenStream {
match *self {
StructTrait::SerializeMap => {
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::SerializeMap => 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),
}
}
@ -1301,15 +1295,9 @@ enum TupleTrait {
impl TupleTrait {
fn serialize_element(&self, span: Span) -> TokenStream {
match *self {
TupleTrait::SerializeTuple => {
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::SerializeTuple => 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),
}
}
}