Skip to content

Commit

Permalink
Fix clippy (#229)
Browse files Browse the repository at this point in the history
* Add `RenderAssetPersistencePolicy` to `Mesh::new` call

* Use built-in `Name` component in `svg` example
  • Loading branch information
Nilirad authored Jan 6, 2024
1 parent 77999ac commit b4f1aaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 2 additions & 5 deletions examples/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ fn main() {
.run();
}

#[derive(Component)]
struct Name(String);

#[derive(Component)]
struct BlacksmithMarker;

Expand All @@ -25,7 +22,7 @@ fn setup_system(mut commands: Commands) {

commands
.spawn((
Name("Blacksmith".to_owned()),
Name::new("Blacksmith"),
BlacksmithMarker,
SpatialBundle {
transform: Transform::from_translation(Vec3::new(-50., 0., 0.)),
Expand Down Expand Up @@ -62,7 +59,7 @@ fn setup_system(mut commands: Commands) {

commands
.spawn((
Name("Shack".to_owned()),
Name::new("Shack"),
ToolShackMarker,
SpatialBundle {
transform: Transform {
Expand Down
10 changes: 8 additions & 2 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
use bevy::{
prelude::*,
render::{mesh::Indices, render_resource::PrimitiveTopology},
render::{
mesh::Indices, render_asset::RenderAssetPersistencePolicy,
render_resource::PrimitiveTopology,
},
sprite::Mesh2dHandle,
};
use lyon_tessellation::{self as tess, BuffersBuilder};
Expand Down Expand Up @@ -127,7 +130,10 @@ fn stroke(
}

fn build_mesh(buffers: &VertexBuffers) -> Mesh {
let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
let mut mesh = Mesh::new(
PrimitiveTopology::TriangleList,
RenderAssetPersistencePolicy::Unload,
);
mesh.set_indices(Some(Indices::U32(buffers.indices.clone())));
mesh.insert_attribute(
Mesh::ATTRIBUTE_POSITION,
Expand Down

0 comments on commit b4f1aaa

Please sign in to comment.