summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-03 04:53:27 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-03 04:53:27 +0100
commit7e22e2d45293c5916812be03dc7367134b69b3ad (patch)
tree2d1814e37599644ec2bf093ed6ce42eb1a0cb34b
parentedce457365aae5e1aa20863389cdd28357234908 (diff)
downloadiced-7e22e2d45293c5916812be03dc7367134b69b3ad.tar.gz
iced-7e22e2d45293c5916812be03dc7367134b69b3ad.tar.bz2
iced-7e22e2d45293c5916812be03dc7367134b69b3ad.zip
Fix lints by `clippy`
-rw-r--r--glow/src/triangle.rs4
-rw-r--r--graphics/src/gradient/linear.rs9
-rw-r--r--graphics/src/layer/mesh.rs10
-rw-r--r--graphics/src/transformation.rs6
-rw-r--r--graphics/src/widget/canvas/fill.rs6
-rw-r--r--wgpu/src/buffers.rs3
-rw-r--r--wgpu/src/buffers/dynamic.rs4
-rw-r--r--wgpu/src/triangle.rs4
-rw-r--r--wgpu/src/triangle/solid.rs2
9 files changed, 20 insertions, 28 deletions
diff --git a/glow/src/triangle.rs b/glow/src/triangle.rs
index fff14910..68ebcb00 100644
--- a/glow/src/triangle.rs
+++ b/glow/src/triangle.rs
@@ -137,12 +137,12 @@ impl Pipeline {
match mesh.style {
mesh::Style::Solid(color) => {
- self.programs.solid.use_program(gl, &color, &transform);
+ self.programs.solid.use_program(gl, color, &transform);
}
mesh::Style::Gradient(gradient) => {
self.programs
.gradient
- .use_program(gl, &gradient, &transform);
+ .use_program(gl, gradient, &transform);
}
}
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()
}
}
diff --git a/wgpu/src/buffers.rs b/wgpu/src/buffers.rs
index 34fe0fca..707ad832 100644
--- a/wgpu/src/buffers.rs
+++ b/wgpu/src/buffers.rs
@@ -57,8 +57,7 @@ impl<T: Pod + Zeroable> StaticBuffer<T> {
/// Returns whether or not the buffer needs to be recreated. This can happen whenever mesh data
/// changes & a redraw is requested.
pub fn resize(&mut self, device: &wgpu::Device, new_count: usize) -> bool {
- let size =
- wgpu::BufferAddress::from((mem::size_of::<T>() * new_count) as u64);
+ let size = (mem::size_of::<T>() * new_count) as u64;
if self.size < size {
self.offsets.clear();
diff --git a/wgpu/src/buffers/dynamic.rs b/wgpu/src/buffers/dynamic.rs
index 3c65d6e1..f1262d83 100644
--- a/wgpu/src/buffers/dynamic.rs
+++ b/wgpu/src/buffers/dynamic.rs
@@ -180,8 +180,8 @@ impl<T: ShaderType + WriteInto> Buffer<T> {
let offset = self
.offsets
.get(index)
- .expect("Index not found in offsets.")
- .clone();
+ .copied()
+ .expect("Index not found in offsets.");
offset
}
diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs
index a21e0fac..2af35588 100644
--- a/wgpu/src/triangle.rs
+++ b/wgpu/src/triangle.rs
@@ -134,8 +134,8 @@ impl Pipeline {
&mesh.buffers.indices,
);
- vertex_offset = vertex_offset + new_vertex_offset;
- index_offset = index_offset + new_index_offset;
+ vertex_offset += new_vertex_offset;
+ index_offset += new_index_offset;
self.index_strides.push(mesh.buffers.indices.len() as u32);
diff --git a/wgpu/src/triangle/solid.rs b/wgpu/src/triangle/solid.rs
index 75455310..9d85ff7b 100644
--- a/wgpu/src/triangle/solid.rs
+++ b/wgpu/src/triangle/solid.rs
@@ -57,7 +57,7 @@ impl Pipeline {
});
let bind_group =
- Pipeline::bind_group(device, &buffer.raw(), &bind_group_layout);
+ Pipeline::bind_group(device, buffer.raw(), &bind_group_layout);
let layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {