diff --git a/examples/custom_shader.rs b/examples/custom_shader.rs index 5063c01841..21aaf8ebdd 100644 --- a/examples/custom_shader.rs +++ b/examples/custom_shader.rs @@ -74,10 +74,8 @@ fn main() { } fn setup(world: &mut World, resources: &mut Resources) { - let cube_handle = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - mesh_storage.add(Mesh::load(MeshType::Cube)) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); world .build() diff --git a/examples/entity_builder_comparison.rs b/examples/entity_builder_comparison.rs index de1ddd65b2..5e1bd2e035 100644 --- a/examples/entity_builder_comparison.rs +++ b/examples/entity_builder_comparison.rs @@ -161,13 +161,9 @@ fn create_entities_builder_archetype( } fn setup(world: &mut World, resources: &mut Resources) { - let cube = Mesh::load(MeshType::Cube); - let plane = Mesh::load(MeshType::Plane { size: 10.0 }); - - let (cube_handle, plane_handle) = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - (mesh_storage.add(cube), mesh_storage.add(plane)) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); + let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 })); // no-archetype precompile: 1.24 sec // archetype precompile: 1.07 sec diff --git a/examples/instancing.rs b/examples/instancing.rs index 36f96cc559..09ba4ea060 100644 --- a/examples/instancing.rs +++ b/examples/instancing.rs @@ -30,11 +30,8 @@ fn main() { } fn setup(world: &mut World, resources: &mut Resources) { - let cube = Mesh::load(MeshType::Cube); - let cube_handle = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - mesh_storage.add(cube) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); world.insert( (), diff --git a/examples/parenting.rs b/examples/parenting.rs index 7d91bdfc06..bdcb6b6712 100644 --- a/examples/parenting.rs +++ b/examples/parenting.rs @@ -23,9 +23,8 @@ fn build_rotator_system() -> Box { } fn setup(world: &mut World, resources: &mut Resources) { - let cube = Mesh::load(MeshType::Cube); let mut mesh_storage = resources.get_mut::>().unwrap(); - let cube_handle = mesh_storage.add(cube); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); world .build() diff --git a/examples/plugin_loading/example_plugin/src/lib.rs b/examples/plugin_loading/example_plugin/src/lib.rs index e39d9c492c..3fa1f5b861 100644 --- a/examples/plugin_loading/example_plugin/src/lib.rs +++ b/examples/plugin_loading/example_plugin/src/lib.rs @@ -15,13 +15,9 @@ impl AppPlugin for ExamplePlugin { } pub fn setup(world: &mut World, resources: &mut Resources) { - let cube = Mesh::load(MeshType::Cube); - let plane = Mesh::load(MeshType::Plane { size: 10.0 }); - - let (cube_handle, plane_handle) = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - (mesh_storage.add(cube), mesh_storage.add(plane)) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); + let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 })); world.build() // plane diff --git a/examples/simple.rs b/examples/simple.rs index 10c965c089..8ef89c1f98 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -5,13 +5,9 @@ fn main() { } fn setup(world: &mut World, resources: &mut Resources) { - let cube = Mesh::load(MeshType::Cube); - let plane = Mesh::load(MeshType::Plane { size: 10.0 }); - - let (cube_handle, plane_handle) = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - (mesh_storage.add(cube), mesh_storage.add(plane)) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); + let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 })); world .build() diff --git a/examples/spawner.rs b/examples/spawner.rs index 18194a2c8b..9b43892852 100644 --- a/examples/spawner.rs +++ b/examples/spawner.rs @@ -62,13 +62,9 @@ fn build_print_status_system() -> Box { } fn setup(world: &mut World, resources: &mut Resources) { - let cube = Mesh::load(MeshType::Cube); - let plane = Mesh::load(MeshType::Plane { size: 10.0 }); - - let (cube_handle, plane_handle) = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - (mesh_storage.add(cube), mesh_storage.add(plane)) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); + let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 })); let mut builder = world .build() diff --git a/examples/texture.rs b/examples/texture.rs index b8508cf259..3ca208eb4f 100644 --- a/examples/texture.rs +++ b/examples/texture.rs @@ -5,18 +5,14 @@ fn main() { } fn setup(world: &mut World, resources: &mut Resources) { - let cube_handle = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - mesh_storage.add(Mesh::load(MeshType::Cube)) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); - let texture_handle = { - let mut texture_storage = resources.get_mut::>().unwrap(); - let texture = Texture::load(TextureType::Png( - concat!(env!("CARGO_MANIFEST_DIR"), "/assets/temp_bevy_logo.png").to_string(), - )); - texture_storage.add(texture) - }; + let mut texture_storage = resources.get_mut::>().unwrap(); + let texture = Texture::load(TextureType::Png( + concat!(env!("CARGO_MANIFEST_DIR"), "/assets/temp_bevy_logo.png").to_string(), + )); + let texture_handle = texture_storage.add(texture); world .build() diff --git a/examples/ui.rs b/examples/ui.rs index 75a2e0b49d..94c685cf6d 100644 --- a/examples/ui.rs +++ b/examples/ui.rs @@ -5,11 +5,8 @@ fn main() { } fn setup(world: &mut World, resources: &mut Resources) { - let cube = Mesh::load(MeshType::Cube); - let cube_handle = { - let mut mesh_storage = resources.get_mut::>().unwrap(); - mesh_storage.add(cube) - }; + let mut mesh_storage = resources.get_mut::>().unwrap(); + let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube)); world .build()