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

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