diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index 7e699542fd4..46a13410801 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -109,9 +109,6 @@ pub fn animate_multiplicative_factor( /// If a variant is annotated with `#[animation(error)]`, the corresponding /// `match` arm returns an error. /// -/// If the two values are not similar, an error is returned unless a fallback -/// function has been specified through `#[animate(fallback)]`. -/// /// Trait bounds for type parameter `Foo` can be opted out of with /// `#[animation(no_bound(Foo))]` on the type definition, trait bounds for /// fields can be opted into with `#[animation(field_bound)]` on the field. diff --git a/components/style/values/distance.rs b/components/style/values/distance.rs index efaa2314e01..a4259ce8c6b 100644 --- a/components/style/values/distance.rs +++ b/components/style/values/distance.rs @@ -19,9 +19,6 @@ use std::ops::Add; /// If a variant is annotated with `#[animation(error)]`, the corresponding /// `match` arm returns an error. /// -/// If the two values are not similar, an error is returned unless a fallback -/// function has been specified through `#[distance(fallback)]`. -/// /// Trait bounds for type parameter `Foo` can be opted out of with /// `#[animation(no_bound(Foo))]` on the type definition, trait bounds for /// fields can be opted into with `#[distance(field_bound)]` on the field. diff --git a/components/style_derive/animate.rs b/components/style_derive/animate.rs index 190568514fc..59b19214971 100644 --- a/components/style_derive/animate.rs +++ b/components/style_derive/animate.rs @@ -6,12 +6,11 @@ use darling::util::PathList; use derive_common::cg; use proc_macro2::TokenStream; use quote::TokenStreamExt; -use syn::{DeriveInput, Path, WhereClause}; +use syn::{DeriveInput, WhereClause}; use synstructure::{Structure, VariantInfo}; pub fn derive(mut input: DeriveInput) -> TokenStream { let animation_input_attrs = cg::parse_input_attrs::(&input); - let input_attrs = cg::parse_input_attrs::(&input); let no_bound = animation_input_attrs.no_bound.unwrap_or_default(); let mut where_clause = input.generics.where_clause.take(); @@ -44,11 +43,6 @@ pub fn derive(mut input: DeriveInput) -> TokenStream { let name = &input.ident; let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); - let fallback = match input_attrs.fallback { - Some(fallback) => quote! { #fallback(self, other, procedure) }, - None => quote! { Err(()) }, - }; - quote! { impl #impl_generics crate::values::animated::Animate for #name #ty_generics #where_clause { #[allow(unused_variables, unused_imports)] @@ -59,7 +53,7 @@ pub fn derive(mut input: DeriveInput) -> TokenStream { procedure: crate::values::animated::Procedure, ) -> Result { if std::mem::discriminant(self) != std::mem::discriminant(other) { - return #fallback; + return Err(()); } match (self, other) { #match_body @@ -118,12 +112,6 @@ fn derive_variant_arm( } } -#[darling(attributes(animate), default)] -#[derive(Default, FromDeriveInput)] -struct AnimateInputAttrs { - fallback: Option, -} - #[darling(attributes(animation), default)] #[derive(Default, FromDeriveInput)] pub struct AnimationInputAttrs { diff --git a/components/style_derive/compute_squared_distance.rs b/components/style_derive/compute_squared_distance.rs index 5e130e75b06..b4e67f6c984 100644 --- a/components/style_derive/compute_squared_distance.rs +++ b/components/style_derive/compute_squared_distance.rs @@ -6,12 +6,11 @@ use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantA use derive_common::cg; use proc_macro2::TokenStream; use quote::TokenStreamExt; -use syn::{DeriveInput, Path, WhereClause}; +use syn::{DeriveInput, WhereClause}; use synstructure; pub fn derive(mut input: DeriveInput) -> TokenStream { let animation_input_attrs = cg::parse_input_attrs::(&input); - let input_attrs = cg::parse_input_attrs::(&input); let no_bound = animation_input_attrs.no_bound.unwrap_or_default(); let mut where_clause = input.generics.where_clause.take(); for param in input.generics.type_params() { @@ -43,11 +42,6 @@ pub fn derive(mut input: DeriveInput) -> TokenStream { match_body.append_all(quote! { _ => unsafe { debug_unreachable!() } }); } - let fallback = match input_attrs.fallback { - Some(fallback) => quote! { #fallback(self, other) }, - None => quote! { Err(()) }, - }; - let name = &input.ident; let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); @@ -60,7 +54,7 @@ pub fn derive(mut input: DeriveInput) -> TokenStream { other: &Self, ) -> Result { if std::mem::discriminant(self) != std::mem::discriminant(other) { - return #fallback; + return Err(()); } match (self, other) { #match_body @@ -124,12 +118,6 @@ fn derive_variant_arm( }; } -#[darling(attributes(distance), default)] -#[derive(Default, FromDeriveInput)] -struct DistanceInputAttrs { - fallback: Option, -} - #[darling(attributes(distance), default)] #[derive(Default, FromField)] struct DistanceFieldAttrs {