diff options
author | Federico Mena Quintero <federico@gnome.org> | 2023-03-29 17:58:25 -0600 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2023-03-30 22:16:35 +0000 |
commit | f2f8df329fdcd508f78edbd27d3c7d6bbc4cdd4e (patch) | |
tree | 0dcb32e7b6c0303dfb10a7885ef4a3bfedd0bc62 | |
parent | cc4ddead58ef7c63cd5675a5ea27f8938a9baa67 (diff) | |
download | librsvg-f2f8df329fdcd508f78edbd27d3c7d6bbc4cdd4e.tar.gz |
clippy: Use derivable impls for enums
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/817>
-rw-r--r-- | src/length.rs | 11 | ||||
-rw-r--r-- | src/transform.rs | 9 |
2 files changed, 5 insertions, 15 deletions
diff --git a/src/length.rs b/src/length.rs index f5656cbe..5d91b166 100644 --- a/src/length.rs +++ b/src/length.rs @@ -505,16 +505,11 @@ pub type Length<N> = CssLength<N, Signed>; /// Alias for `CssLength` types that are non negative pub type ULength<N> = CssLength<N, Unsigned>; -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, Default, PartialEq, Copy, Clone)] pub enum LengthOrAuto<N: Normalize> { - Length(CssLength<N, Unsigned>), + #[default] Auto, -} - -impl<N: Normalize> Default for LengthOrAuto<N> { - fn default() -> Self { - LengthOrAuto::Auto - } + Length(CssLength<N, Unsigned>), } impl<N: Normalize> Parse for LengthOrAuto<N> { diff --git a/src/transform.rs b/src/transform.rs index a042b778..9f6c6789 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -68,8 +68,9 @@ pub struct Transform { /// The `transform` property from the CSS Transforms Module Level 1. /// /// CSS Transforms 1: <https://www.w3.org/TR/css-transforms-1/#transform-property> -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq)] pub enum TransformProperty { + #[default] None, List(Vec<TransformFunction>), } @@ -80,12 +81,6 @@ pub enum TransformProperty { #[derive(Copy, Clone, Default, Debug, PartialEq)] pub struct TransformAttribute(Transform); -impl Default for TransformProperty { - fn default() -> Self { - TransformProperty::None - } -} - impl Property for TransformProperty { fn inherits_automatically() -> bool { false |