mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #20183 - servo:computed-as-clone, r=emilio
Unconditionally derive ToComputedValue as Clone for non-generic types We assume that types such as `<Self as ToComputedValue>::ToComputedValue == Self` just construct a new value that is just a clone of the original one without any additional code. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20183) <!-- Reviewable:end -->
This commit is contained in:
commit
95f81d0c39
2 changed files with 27 additions and 1 deletions
|
@ -289,7 +289,10 @@ impl<'a, 'cx, 'cx_a: 'cx, S: ToComputedValue + 'a> Iterator for ComputedVecIter<
|
|||
/// This trait is derivable with `#[derive(ToComputedValue)]`. The derived
|
||||
/// implementation just calls `ToComputedValue::to_computed_value` on each field
|
||||
/// of the passed value, or `Clone::clone` if the field is annotated with
|
||||
/// `#[compute(clone)]`.
|
||||
/// `#[compute(clone)]`. The deriving code assumes that if the type isn't
|
||||
/// generic, then the trait can be implemented as simple `Clone::clone` calls,
|
||||
/// this means that a manual implementation with `ComputedValue = Self` is bogus
|
||||
/// if it returns anything else than a clone.
|
||||
pub trait ToComputedValue {
|
||||
/// The computed value type we're going to be converted to.
|
||||
type ComputedValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue