From 08ea55e6c3a20d639a56f9f6c74d928437a847fc Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 1 Dec 2025 12:17:22 +0700 Subject: [PATCH] Derive rather than impl `Default` for `Fill` --- src/style.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/style.rs b/src/style.rs index eb6e014..cd92f49 100644 --- a/src/style.rs +++ b/src/style.rs @@ -7,7 +7,7 @@ use kurbo::Stroke; /// /// This is only relevant for self-intersecting paths (e.g. a hourglass shape). /// For non-self-intersecting paths, both rules produce the same result. -#[derive(Copy, Clone, PartialEq, Eq, Debug)] +#[derive(Copy, Clone, Default, PartialEq, Eq, Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[repr(u8)] pub enum Fill { @@ -16,6 +16,7 @@ pub enum Fill { /// All regions where the winding number of the path is not zero will be filled. /// This is generally more correct, but can be more expensive to implement in renderers. /// This matches the default behavior of the web canvas, and is the default value. + #[default] NonZero = 0, /// Even-odd fill rule. /// @@ -42,12 +43,6 @@ pub enum Style { Stroke(Stroke), } -impl Default for Fill { - fn default() -> Self { - Self::NonZero - } -} - impl From for Style { fn from(fill: Fill) -> Self { Self::Fill(fill)