diff options
author | Bastien Orivel <eijebong@bananium.fr> | 2018-02-12 16:49:28 +0100 |
---|---|---|
committer | Bastien Orivel <eijebong@bananium.fr> | 2018-02-12 17:08:55 +0100 |
commit | 9faa579c892ed4e45faf40a161e42da95a11f14c (patch) | |
tree | ee731f096a36c8e631374648345cff6e79562a69 /components/style_derive/to_computed_value.rs | |
parent | cf6330b6c169273d5c0de7b6e39dbd9d48c36111 (diff) | |
download | servo-9faa579c892ed4e45faf40a161e42da95a11f14c.tar.gz servo-9faa579c892ed4e45faf40a161e42da95a11f14c.zip |
Bump syn/quote in style_derive
Diffstat (limited to 'components/style_derive/to_computed_value.rs')
-rw-r--r-- | components/style_derive/to_computed_value.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/style_derive/to_computed_value.rs b/components/style_derive/to_computed_value.rs index c53b25408e9..198d5cfe17c 100644 --- a/components/style_derive/to_computed_value.rs +++ b/components/style_derive/to_computed_value.rs @@ -4,29 +4,29 @@ use cg; use quote::Tokens; -use syn::DeriveInput; +use syn::{Ident, DeriveInput}; use synstructure::BindStyle; pub fn derive(input: DeriveInput) -> Tokens { let name = &input.ident; - let trait_path = &["values", "computed", "ToComputedValue"]; + let trait_path = parse_quote!(values::computed::ToComputedValue); let (impl_generics, ty_generics, mut where_clause, computed_value_type) = - cg::fmap_trait_parts(&input, trait_path, "ComputedValue"); + cg::fmap_trait_parts(&input, &trait_path, Ident::from("ComputedValue")); let to_body = cg::fmap_match(&input, BindStyle::Ref, |binding| { - let attrs = cg::parse_field_attrs::<ComputedValueAttrs>(&binding.field); + let attrs = cg::parse_field_attrs::<ComputedValueAttrs>(&binding.ast()); if attrs.clone { - if cg::is_parameterized(&binding.field.ty, where_clause.params, None) { - where_clause.inner.predicates.push(cg::where_predicate( - binding.field.ty.clone(), - &["std", "clone", "Clone"], + if cg::is_parameterized(&binding.ast().ty, &where_clause.params, None) { + where_clause.add_predicate(cg::where_predicate( + binding.ast().ty.clone(), + &parse_quote!(std::clone::Clone), None, )); } quote! { ::std::clone::Clone::clone(#binding) } } else { if !attrs.ignore_bound { - where_clause.add_trait_bound(&binding.field.ty); + where_clause.add_trait_bound(&binding.ast().ty); } quote! { ::values::computed::ToComputedValue::to_computed_value(#binding, context) @@ -34,7 +34,7 @@ pub fn derive(input: DeriveInput) -> Tokens { } }); let from_body = cg::fmap_match(&input, BindStyle::Ref, |binding| { - let attrs = cg::parse_field_attrs::<ComputedValueAttrs>(&binding.field); + let attrs = cg::parse_field_attrs::<ComputedValueAttrs>(&binding.ast()); if attrs.clone { quote! { ::std::clone::Clone::clone(#binding) } } else { |