From 01c35f99cdd296e65d97199186f0ea0d241a04b5 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 7 Sep 2017 12:48:14 -0700 Subject: [PATCH] Remove 5k from AnimationValue::compute_squared_distance. --- .../properties/helpers/animated_properties.mako.rs | 14 ++++++++++---- servo-tidy.toml | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index d85337c3593..c3a272239ed 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -568,6 +568,16 @@ impl Animate for AnimationValue { impl ComputeSquaredDistance for AnimationValue { fn compute_squared_distance(&self, other: &Self) -> Result { + match *self { + % for i, prop in enumerate([p for p in data.longhands if p.animatable and p.animation_value_type == "discrete"]): + % if i > 0: + | + % endif + AnimationValue::${prop.camel_case}(..) + % endfor + => return Err(()), + _ => (), + } match (self, other) { % for prop in data.longhands: % if prop.animatable: @@ -575,10 +585,6 @@ impl ComputeSquaredDistance for AnimationValue { (&AnimationValue::${prop.camel_case}(ref this), &AnimationValue::${prop.camel_case}(ref other)) => { this.compute_squared_distance(other) }, - % else: - (&AnimationValue::${prop.camel_case}(_), &AnimationValue::${prop.camel_case}(_)) => { - Err(()) - }, % endif % endif % endfor diff --git a/servo-tidy.toml b/servo-tidy.toml index b7e48d8f424..3bd5ebdd96a 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -40,6 +40,8 @@ packages = [ ] # Files that are ignored for all tidy and lint checks. files = [ + # Mako does not lend itself easily to splitting long lines + "./components/style/properties/helpers/animated_properties.mako.rs", # Helper macro where actually a pseudo-element per line makes sense. "./components/style/gecko/non_ts_pseudo_class_list.rs", # Generated and upstream code combined with our own. Could use cleanup