summaryrefslogtreecommitdiffstats
path: root/glow/src/quad
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2022-07-09 19:03:40 +0200
committerLibravatar GitHub <noreply@github.com>2022-07-09 19:03:40 +0200
commit9051dd6977d045f991092e247e6bd9da40d2e793 (patch)
treecde7d983ffc085ed908be776e9021a8e41b44b44 /glow/src/quad
parentc4c1221be62f51dd9f1d20ea2c4ea6e2c94e20aa (diff)
parente548d6c0d5b430b090821e673dc453a24c885fbe (diff)
downloadiced-9051dd6977d045f991092e247e6bd9da40d2e793.tar.gz
iced-9051dd6977d045f991092e247e6bd9da40d2e793.tar.bz2
iced-9051dd6977d045f991092e247e6bd9da40d2e793.zip
Merge pull request #1379 from PolyMeilex/fix/clippy
Address Clippy lints
Diffstat (limited to 'glow/src/quad')
-rw-r--r--glow/src/quad/compatibility.rs19
-rw-r--r--glow/src/quad/core.rs2
2 files changed, 6 insertions, 15 deletions
diff --git a/glow/src/quad/compatibility.rs b/glow/src/quad/compatibility.rs
index 76f98ab7..eb3fb7e0 100644
--- a/glow/src/quad/compatibility.rs
+++ b/glow/src/quad/compatibility.rs
@@ -110,22 +110,13 @@ impl Pipeline {
bounds: Rectangle<u32>,
) {
// TODO: Remove this allocation (probably by changing the shader and removing the need of two `position`)
- let vertices: Vec<Vertex> = instances
- .iter()
- .flat_map(|quad| Vertex::from_quad(quad))
- .collect();
+ let vertices: Vec<Vertex> =
+ instances.iter().flat_map(Vertex::from_quad).collect();
// TODO: Remove this allocation (or allocate only when needed)
let indices: Vec<i32> = (0..instances.len().min(MAX_QUADS) as i32)
.flat_map(|i| {
- [
- 0 + i * 4,
- 1 + i * 4,
- 2 + i * 4,
- 2 + i * 4,
- 1 + i * 4,
- 3 + i * 4,
- ]
+ [i * 4, 1 + i * 4, 2 + i * 4, 2 + i * 4, 1 + i * 4, 3 + i * 4]
})
.cycle()
.take(instances.len() * 6)
@@ -187,13 +178,13 @@ impl Pipeline {
gl.buffer_sub_data_u8_slice(
glow::ARRAY_BUFFER,
0,
- bytemuck::cast_slice(&vertices),
+ bytemuck::cast_slice(vertices),
);
gl.buffer_sub_data_u8_slice(
glow::ELEMENT_ARRAY_BUFFER,
0,
- bytemuck::cast_slice(&indices),
+ bytemuck::cast_slice(indices),
);
gl.draw_elements(
diff --git a/glow/src/quad/core.rs b/glow/src/quad/core.rs
index f37300f6..3e51b1ca 100644
--- a/glow/src/quad/core.rs
+++ b/glow/src/quad/core.rs
@@ -154,7 +154,7 @@ impl Pipeline {
gl.buffer_sub_data_u8_slice(
glow::ARRAY_BUFFER,
0,
- bytemuck::cast_slice(&instances),
+ bytemuck::cast_slice(instances),
);
gl.draw_arrays_instanced(