Skip to content

Commit

Permalink
Remove redundant .into for mesh set_attributes with impl (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuajbouw authored Nov 15, 2020
1 parent 515d750 commit bb4a739
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions crates/bevy_render/src/mesh/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ impl Mesh {
pub fn set_attribute(
&mut self,
name: impl Into<Cow<'static, str>>,
values: VertexAttributeValues,
values: impl Into<VertexAttributeValues>,
) {
let values: VertexAttributeValues = values.into();
self.attributes.insert(name.into(), values);
}

Expand Down Expand Up @@ -294,9 +295,9 @@ pub mod shape {
]);

let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, positions.into());
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals.into());
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs.into());
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, positions);
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals);
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs);
mesh.set_indices(Some(indices));
mesh
}
Expand Down Expand Up @@ -391,9 +392,9 @@ pub mod shape {

let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
mesh.set_indices(Some(indices));
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, positions.into());
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals.into());
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs.into());
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, positions);
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals);
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs);
mesh
}
}
Expand Down Expand Up @@ -429,9 +430,9 @@ pub mod shape {

let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
mesh.set_indices(Some(indices));
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, positions.into());
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals.into());
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs.into());
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, positions);
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals);
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs);
mesh
}
}
Expand Down Expand Up @@ -500,9 +501,9 @@ pub mod shape {

let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
mesh.set_indices(Some(indices));
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, points.into());
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals.into());
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs.into());
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, points);
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals);
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs);
mesh
}
}
Expand Down

0 comments on commit bb4a739

Please sign in to comment.