Remove #[compute(clone)]

This commit is contained in:
Anthony Ramine 2018-03-09 15:45:34 +01:00
parent 92068ca540
commit 2efd06c12d
6 changed files with 7 additions and 27 deletions

View file

@ -38,25 +38,11 @@ pub fn derive(input: DeriveInput) -> Tokens {
let to_body = cg::fmap_match(&input, BindStyle::Ref, |binding| {
let attrs = cg::parse_field_attrs::<ComputedValueAttrs>(&binding.ast());
if attrs.clone {
if cg::is_parameterized(&binding.ast().ty, &where_clause.params, 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 {
if !attrs.ignore_bound {
where_clause.add_trait_bound(&binding.ast().ty);
}
quote! {
::values::computed::ToComputedValue::to_computed_value(#binding, context)
}
if !attrs.ignore_bound {
where_clause.add_trait_bound(&binding.ast().ty);
}
quote! {
::values::computed::ToComputedValue::to_computed_value(#binding, context)
}
});
let from_body = cg::fmap_match(&input, BindStyle::Ref, |binding| {
@ -95,6 +81,5 @@ pub fn derive(input: DeriveInput) -> Tokens {
#[darling(attributes(compute), default)]
#[derive(Default, FromField)]
struct ComputedValueAttrs {
clone: bool,
ignore_bound: bool,
}