mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Remove #[compute(clone)]
This commit is contained in:
parent
92068ca540
commit
2efd06c12d
6 changed files with 7 additions and 27 deletions
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue