diff options
author | 2022-11-03 04:53:27 +0100 | |
---|---|---|
committer | 2022-11-03 04:53:27 +0100 | |
commit | 7e22e2d45293c5916812be03dc7367134b69b3ad (patch) | |
tree | 2d1814e37599644ec2bf093ed6ce42eb1a0cb34b /graphics | |
parent | edce457365aae5e1aa20863389cdd28357234908 (diff) | |
download | iced-7e22e2d45293c5916812be03dc7367134b69b3ad.tar.gz iced-7e22e2d45293c5916812be03dc7367134b69b3ad.tar.bz2 iced-7e22e2d45293c5916812be03dc7367134b69b3ad.zip |
Fix lints by `clippy`
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/gradient/linear.rs | 9 | ||||
-rw-r--r-- | graphics/src/layer/mesh.rs | 10 | ||||
-rw-r--r-- | graphics/src/transformation.rs | 6 | ||||
-rw-r--r-- | graphics/src/widget/canvas/fill.rs | 6 |
4 files changed, 12 insertions, 19 deletions
diff --git a/graphics/src/gradient/linear.rs b/graphics/src/gradient/linear.rs index aaa9e234..439e848e 100644 --- a/graphics/src/gradient/linear.rs +++ b/graphics/src/gradient/linear.rs @@ -36,12 +36,9 @@ pub enum Position { }, } -impl Into<Position> for (Point, Point) { - fn into(self) -> Position { - Position::Absolute { - start: self.0, - end: self.1, - } +impl From<(Point, Point)> for Position { + fn from((start, end): (Point, Point)) -> Self { + Self::Absolute { start, end } } } diff --git a/graphics/src/layer/mesh.rs b/graphics/src/layer/mesh.rs index a2232a1f..7056db9b 100644 --- a/graphics/src/layer/mesh.rs +++ b/graphics/src/layer/mesh.rs @@ -28,13 +28,9 @@ pub enum Style { Gradient(Gradient), } -impl<'a> Into<Style> for Gradient { - fn into(self) -> Style { - match self { - Gradient::Linear(linear) => { - Style::Gradient(Gradient::Linear(linear)) - } - } +impl From<Gradient> for Style { + fn from(gradient: Gradient) -> Self { + Self::Gradient(gradient) } } diff --git a/graphics/src/transformation.rs b/graphics/src/transformation.rs index 116b3058..cf0457a4 100644 --- a/graphics/src/transformation.rs +++ b/graphics/src/transformation.rs @@ -52,8 +52,8 @@ impl From<Transformation> for [f32; 16] { } } -impl Into<Mat4> for Transformation { - fn into(self) -> Mat4 { - self.0 +impl From<Transformation> for Mat4 { + fn from(transformation: Transformation) -> Self { + transformation.0 } } diff --git a/graphics/src/widget/canvas/fill.rs b/graphics/src/widget/canvas/fill.rs index 9582bf27..2be8ed41 100644 --- a/graphics/src/widget/canvas/fill.rs +++ b/graphics/src/widget/canvas/fill.rs @@ -42,10 +42,10 @@ impl<'a> From<Color> for Fill<'a> { } } -impl<'a> Into<Fill<'a>> for &'a Gradient { - fn into(self) -> Fill<'a> { +impl<'a> From<&'a Gradient> for Fill<'a> { + fn from(gradient: &'a Gradient) -> Self { Fill { - style: Style::Gradient(self), + style: Style::Gradient(gradient), ..Default::default() } } |