From 4b9da5f6504b693bb621f3952f967337d0421c10 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 30 Jan 2025 21:02:50 +0100 Subject: [PATCH] Remove `StrokeKind::default` (#5658) Since there is no natural default for `RectShape`. --- crates/epaint/src/stroke.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/crates/epaint/src/stroke.rs b/crates/epaint/src/stroke.rs index fa85a9588b0..ce7d274ddac 100644 --- a/crates/epaint/src/stroke.rs +++ b/crates/epaint/src/stroke.rs @@ -69,16 +69,10 @@ pub enum StrokeKind { Outside, } -impl Default for StrokeKind { - fn default() -> Self { - Self::Middle - } -} - /// Describes the width and color of paths. The color can either be solid or provided by a callback. For more information, see [`ColorMode`] /// /// The default stroke is the same as [`Stroke::NONE`]. -#[derive(Clone, Debug, Default, PartialEq)] +#[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct PathStroke { pub width: f32, @@ -86,6 +80,13 @@ pub struct PathStroke { pub kind: StrokeKind, } +impl Default for PathStroke { + #[inline] + fn default() -> Self { + Self::NONE + } +} + impl PathStroke { /// Same as [`PathStroke::default`]. pub const NONE: Self = Self { @@ -99,7 +100,7 @@ impl PathStroke { Self { width: width.into(), color: ColorMode::Solid(color.into()), - kind: StrokeKind::default(), + kind: StrokeKind::Middle, } } @@ -114,7 +115,7 @@ impl PathStroke { Self { width: width.into(), color: ColorMode::UV(Arc::new(callback)), - kind: StrokeKind::default(), + kind: StrokeKind::Middle, } } @@ -168,7 +169,7 @@ impl From for PathStroke { Self { width: value.width, color: ColorMode::Solid(value.color), - kind: StrokeKind::default(), + kind: StrokeKind::Middle, } } }