diff options
Diffstat (limited to '')
| -rw-r--r-- | graphics/src/primitive.rs | 9 | ||||
| -rw-r--r-- | graphics/src/widget/canvas/cache.rs | 7 | ||||
| -rw-r--r-- | graphics/src/widget/canvas/stroke.rs | 18 | 
3 files changed, 8 insertions, 26 deletions
| diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index 5a163a2f..cef422a2 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -9,9 +9,10 @@ use crate::triangle;  use std::sync::Arc;  /// A rendering primitive. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)]  pub enum Primitive {      /// An empty primitive +    #[default]      None,      /// A group of primitives      Group { @@ -117,9 +118,3 @@ pub enum Primitive {          cache: Arc<Primitive>,      },  } - -impl Default for Primitive { -    fn default() -> Primitive { -        Primitive::None -    } -} diff --git a/graphics/src/widget/canvas/cache.rs b/graphics/src/widget/canvas/cache.rs index 52217bbb..678b0f92 100644 --- a/graphics/src/widget/canvas/cache.rs +++ b/graphics/src/widget/canvas/cache.rs @@ -4,7 +4,9 @@ use crate::Primitive;  use iced_native::Size;  use std::{cell::RefCell, sync::Arc}; +#[derive(Default)]  enum State { +    #[default]      Empty,      Filled {          bounds: Size, @@ -12,11 +14,6 @@ enum State {      },  } -impl Default for State { -    fn default() -> Self { -        State::Empty -    } -}  /// A simple cache that stores generated [`Geometry`] to avoid recomputation.  ///  /// A [`Cache`] will not redraw its geometry unless the dimensions of its layer diff --git a/graphics/src/widget/canvas/stroke.rs b/graphics/src/widget/canvas/stroke.rs index 4c19251d..49f5701c 100644 --- a/graphics/src/widget/canvas/stroke.rs +++ b/graphics/src/widget/canvas/stroke.rs @@ -59,9 +59,10 @@ impl<'a> Default for Stroke<'a> {  }  /// The shape used at the end of open subpaths when they are stroked. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)]  pub enum LineCap {      /// The stroke for each sub-path does not extend beyond its two endpoints. +    #[default]      Butt,      /// At the end of each sub-path, the shape representing the stroke will be      /// extended by a square. @@ -71,12 +72,6 @@ pub enum LineCap {      Round,  } -impl Default for LineCap { -    fn default() -> LineCap { -        LineCap::Butt -    } -} -  impl From<LineCap> for lyon::tessellation::LineCap {      fn from(line_cap: LineCap) -> lyon::tessellation::LineCap {          match line_cap { @@ -89,9 +84,10 @@ impl From<LineCap> for lyon::tessellation::LineCap {  /// The shape used at the corners of paths or basic shapes when they are  /// stroked. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)]  pub enum LineJoin {      /// A sharp corner. +    #[default]      Miter,      /// A round corner.      Round, @@ -99,12 +95,6 @@ pub enum LineJoin {      Bevel,  } -impl Default for LineJoin { -    fn default() -> LineJoin { -        LineJoin::Miter -    } -} -  impl From<LineJoin> for lyon::tessellation::LineJoin {      fn from(line_join: LineJoin) -> lyon::tessellation::LineJoin {          match line_join { | 
