mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 13:47:58 +00:00
Bump syntex/aster/quasi version
This commit is contained in:
@@ -196,7 +196,7 @@ impl FieldAttrs {
|
||||
is_enum: bool) -> Result<Self, Error> {
|
||||
let builder = AstBuilder::new();
|
||||
|
||||
let field_ident = match field.node.ident() {
|
||||
let field_ident = match field.ident {
|
||||
Some(ident) => ident,
|
||||
None => { cx.span_bug(field.span, "struct field has no name?") }
|
||||
};
|
||||
@@ -210,7 +210,7 @@ impl FieldAttrs {
|
||||
deserialize_with: None,
|
||||
};
|
||||
|
||||
for meta_items in field.node.attrs.iter().filter_map(get_serde_meta_items) {
|
||||
for meta_items in field.attrs.iter().filter_map(get_serde_meta_items) {
|
||||
for meta_item in meta_items {
|
||||
match meta_item.node {
|
||||
// Parse `#[serde(rename="foo")]`
|
||||
@@ -278,7 +278,7 @@ impl FieldAttrs {
|
||||
ast::MetaItemKind::NameValue(ref name, ref lit) if name == &"deserialize_with" => {
|
||||
let expr = wrap_deserialize_with(
|
||||
cx,
|
||||
&field.node.ty,
|
||||
&field.ty,
|
||||
generics,
|
||||
try!(parse_lit_into_path(cx, name, lit)),
|
||||
);
|
||||
|
||||
+20
-20
@@ -148,7 +148,7 @@ fn deserialize_item_struct(
|
||||
)
|
||||
}
|
||||
ast::VariantData::Tuple(ref fields, _) => {
|
||||
if fields.iter().any(|field| !field.node.kind.is_unnamed()) {
|
||||
if fields.iter().any(|field| field.ident.is_some()) {
|
||||
cx.span_bug(span, "tuple struct has named fields")
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ fn deserialize_item_struct(
|
||||
)
|
||||
}
|
||||
ast::VariantData::Struct(ref fields, _) => {
|
||||
if fields.iter().any(|field| field.node.kind.is_unnamed()) {
|
||||
if fields.iter().any(|field| field.ident.is_none()) {
|
||||
cx.span_bug(span, "struct has unnamed fields")
|
||||
}
|
||||
|
||||
@@ -452,9 +452,9 @@ fn deserialize_struct_as_seq(
|
||||
.enumerate()
|
||||
.map(|(i, field)| {
|
||||
(
|
||||
match field.node.kind {
|
||||
ast::NamedField(name, _) => name.clone(),
|
||||
ast::UnnamedField(_) => {
|
||||
match field.ident {
|
||||
Some(name) => name.clone(),
|
||||
None => {
|
||||
cx.span_bug(field.span, "struct contains unnamed fields")
|
||||
}
|
||||
},
|
||||
@@ -583,10 +583,10 @@ fn deserialize_item_enum(
|
||||
const VARIANTS: &'static [&'static str] = $variants_expr;
|
||||
).unwrap();
|
||||
|
||||
let ignored_arm = if !container_attrs.deny_unknown_fields() {
|
||||
Some(quote_arm!(cx, __Field::__ignore => { Err(::serde::de::Error::end_of_stream()) }))
|
||||
} else {
|
||||
let ignored_arm = if container_attrs.deny_unknown_fields() {
|
||||
None
|
||||
} else {
|
||||
Some(quote_arm!(cx, __Field::__ignore => { Err(::serde::de::Error::end_of_stream()) }))
|
||||
};
|
||||
|
||||
// Match arms to extract a variant from a string
|
||||
@@ -816,11 +816,11 @@ fn deserialize_field_visitor(
|
||||
.map(|i| builder.id(format!("__field{}", i)))
|
||||
.collect();
|
||||
|
||||
let ignore_variant = if !container_attrs.deny_unknown_fields() {
|
||||
let ignore_variant = if container_attrs.deny_unknown_fields() {
|
||||
None
|
||||
} else {
|
||||
let skip_ident = builder.id("__ignore");
|
||||
Some(builder.variant(skip_ident).unit())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let field_enum = builder.item()
|
||||
@@ -1008,9 +1008,9 @@ fn deserialize_struct_visitor(
|
||||
.with_exprs(
|
||||
fields.iter()
|
||||
.map(|field| {
|
||||
match field.node.kind {
|
||||
ast::NamedField(name, _) => builder.expr().str(name),
|
||||
ast::UnnamedField(_) => {
|
||||
match field.ident {
|
||||
Some(name) => builder.expr().str(name),
|
||||
None => {
|
||||
cx.span_bug(field.span, "struct contains unnamed fields")
|
||||
}
|
||||
}
|
||||
@@ -1053,12 +1053,12 @@ fn deserialize_map(
|
||||
|
||||
|
||||
// Visit ignored values to consume them
|
||||
let ignored_arm = if !container_attrs.deny_unknown_fields() {
|
||||
let ignored_arm = if container_attrs.deny_unknown_fields() {
|
||||
None
|
||||
} else {
|
||||
Some(quote_arm!(cx,
|
||||
_ => { try!(visitor.visit_value::<::serde::de::impls::IgnoredAny>()); }
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// Match arms to extract a value for a field.
|
||||
@@ -1099,9 +1099,9 @@ fn deserialize_map(
|
||||
.zip(field_names.iter())
|
||||
.map(|(field, field_name)| {
|
||||
(
|
||||
match field.node.kind {
|
||||
ast::NamedField(name, _) => name.clone(),
|
||||
ast::UnnamedField(_) => {
|
||||
match field.ident {
|
||||
Some(name) => name.clone(),
|
||||
None => {
|
||||
cx.span_bug(field.span, "struct contains unnamed fields")
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#![cfg_attr(feature = "nightly-testing", plugin(clippy))]
|
||||
#![cfg_attr(feature = "nightly-testing", feature(plugin))]
|
||||
#![cfg_attr(feature = "nightly-testing", allow(too_many_arguments))]
|
||||
#![cfg_attr(feature = "nightly-testing", allow(used_underscore_binding))]
|
||||
#![cfg_attr(not(feature = "with-syntex"), feature(rustc_private, plugin))]
|
||||
#![cfg_attr(not(feature = "with-syntex"), plugin(quasi_macros))]
|
||||
|
||||
+11
-11
@@ -151,7 +151,7 @@ fn serialize_item_struct(
|
||||
)
|
||||
}
|
||||
ast::VariantData::Tuple(ref fields, _) => {
|
||||
if fields.iter().any(|field| !field.node.kind.is_unnamed()) {
|
||||
if fields.iter().any(|field| field.ident.is_some()) {
|
||||
cx.span_bug(span, "tuple struct has named fields")
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ fn serialize_item_struct(
|
||||
)
|
||||
}
|
||||
ast::VariantData::Struct(ref fields, _) => {
|
||||
if fields.iter().any(|field| field.node.kind.is_unnamed()) {
|
||||
if fields.iter().any(|field| field.ident.is_none()) {
|
||||
cx.span_bug(span, "struct has unnamed fields")
|
||||
}
|
||||
|
||||
@@ -399,9 +399,9 @@ fn serialize_variant(
|
||||
field_names.iter()
|
||||
.zip(fields.iter())
|
||||
.map(|(id, field)| {
|
||||
let name = match field.node.kind {
|
||||
ast::NamedField(name, _) => name,
|
||||
ast::UnnamedField(_) => {
|
||||
let name = match field.ident {
|
||||
Some(name) => name,
|
||||
None => {
|
||||
cx.span_bug(field.span, "struct variant has unnamed fields")
|
||||
}
|
||||
};
|
||||
@@ -447,7 +447,7 @@ fn serialize_tuple_variant(
|
||||
builder.ty()
|
||||
.ref_()
|
||||
.lifetime("'__a")
|
||||
.build_ty(field.node.ty.clone())
|
||||
.build_ty(field.ty.clone())
|
||||
})
|
||||
)
|
||||
.build();
|
||||
@@ -502,12 +502,12 @@ fn serialize_struct_variant(
|
||||
.with_generics(variant_generics.clone())
|
||||
.with_fields(
|
||||
fields.iter().map(|field| {
|
||||
builder.struct_field(field.node.ident().expect("struct has unnamed fields"))
|
||||
.with_attrs(field.node.attrs.iter().cloned())
|
||||
builder.struct_field(field.ident.expect("struct has unnamed fields"))
|
||||
.with_attrs(field.attrs.iter().cloned())
|
||||
.ty()
|
||||
.ref_()
|
||||
.lifetime("'__serde_variant")
|
||||
.build_ty(field.node.ty.clone())
|
||||
.build_ty(field.ty.clone())
|
||||
})
|
||||
)
|
||||
.field("__serde_container_ty")
|
||||
@@ -520,7 +520,7 @@ fn serialize_struct_variant(
|
||||
.zip(field_names.iter())
|
||||
.map(|(field, field_name)| {
|
||||
(
|
||||
field.node.ident().expect("struct has unnamed fields"),
|
||||
field.ident.expect("struct has unnamed fields"),
|
||||
builder.expr().id(field_name),
|
||||
)
|
||||
})
|
||||
@@ -656,7 +656,7 @@ fn serialize_struct_visitor(
|
||||
.filter(|&(_, ref field_attr)| !field_attr.skip_serializing_field())
|
||||
.enumerate()
|
||||
.map(|(i, (ref field, ref field_attr))| {
|
||||
let name = field.node.ident().expect("struct has unnamed field");
|
||||
let name = field.ident.expect("struct has unnamed field");
|
||||
|
||||
let key_expr = field_attr.name().serialize_name_expr();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user