Opt into field bounds when deriving ToCss, instead of opting out

This commit is contained in:
Anthony Ramine 2018-03-08 11:07:57 +01:00
parent 8133f788cf
commit 859002a81f
8 changed files with 89 additions and 67 deletions

View file

@ -27,11 +27,14 @@ pub fn derive(input: syn::DeriveInput) -> quote::Tokens {
let field_attrs = cg::parse_field_attrs::<AnimationFieldAttrs>(&binding.ast());
if field_attrs.constant {
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,
));
cg::add_predicate(
&mut where_clause.inner,
cg::where_predicate(
binding.ast().ty.clone(),
&parse_quote!(std::clone::Clone),
None,
),
);
}
quote! {
let #mapped_binding = ::std::clone::Clone::clone(#binding);