diff --git a/crates/bevy_ecs/examples/events.rs b/crates/bevy_ecs/examples/events.rs index 02bc0f5071368..45410653a64eb 100644 --- a/crates/bevy_ecs/examples/events.rs +++ b/crates/bevy_ecs/examples/events.rs @@ -1,4 +1,4 @@ -use bevy_ecs::{event::Events, prelude::*}; +use bevy_ecs::prelude::*; // In this example a system sends a custom event with a 50/50 chance during any frame. // If an event was send, it will be printed by the console in a receiving system. diff --git a/crates/bevy_ecs/src/event.rs b/crates/bevy_ecs/src/event.rs index 47972a4fa46ee..c46a9584ff27a 100644 --- a/crates/bevy_ecs/src/event.rs +++ b/crates/bevy_ecs/src/event.rs @@ -207,9 +207,8 @@ impl<'w, 's, E: Event> EventReader<'w, 's, E> { &mut self, ) -> impl DoubleEndedIterator)> + ExactSizeIterator)> { - self.reader.iter_with_id(&self.events).map(|r @ (_, id)| { + self.reader.iter_with_id(&self.events).inspect(|(_, id)| { trace!("EventReader::iter() -> {}", id); - r }) } @@ -313,7 +312,7 @@ impl<'w, 's, E: Event> EventWriter<'w, 's, E> { self.events.send(event); } - pub fn send_batch(&mut self, events: impl Iterator) { + pub fn send_batch(&mut self, events: impl IntoIterator) { self.events.extend(events); } diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index 88a0ef1bc2659..15d1a9fb0fa1a 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -615,35 +615,35 @@ impl VertexAttributeValues { /// mesh, all of the [`VertexAttributeValues`] must have the same length. #[allow(clippy::match_same_arms)] pub fn len(&self) -> usize { - match *self { - VertexAttributeValues::Float32(ref values) => values.len(), - VertexAttributeValues::Sint32(ref values) => values.len(), - VertexAttributeValues::Uint32(ref values) => values.len(), - VertexAttributeValues::Float32x2(ref values) => values.len(), - VertexAttributeValues::Sint32x2(ref values) => values.len(), - VertexAttributeValues::Uint32x2(ref values) => values.len(), - VertexAttributeValues::Float32x3(ref values) => values.len(), - VertexAttributeValues::Sint32x3(ref values) => values.len(), - VertexAttributeValues::Uint32x3(ref values) => values.len(), - VertexAttributeValues::Float32x4(ref values) => values.len(), - VertexAttributeValues::Sint32x4(ref values) => values.len(), - VertexAttributeValues::Uint32x4(ref values) => values.len(), - VertexAttributeValues::Sint16x2(ref values) => values.len(), - VertexAttributeValues::Snorm16x2(ref values) => values.len(), - VertexAttributeValues::Uint16x2(ref values) => values.len(), - VertexAttributeValues::Unorm16x2(ref values) => values.len(), - VertexAttributeValues::Sint16x4(ref values) => values.len(), - VertexAttributeValues::Snorm16x4(ref values) => values.len(), - VertexAttributeValues::Uint16x4(ref values) => values.len(), - VertexAttributeValues::Unorm16x4(ref values) => values.len(), - VertexAttributeValues::Sint8x2(ref values) => values.len(), - VertexAttributeValues::Snorm8x2(ref values) => values.len(), - VertexAttributeValues::Uint8x2(ref values) => values.len(), - VertexAttributeValues::Unorm8x2(ref values) => values.len(), - VertexAttributeValues::Sint8x4(ref values) => values.len(), - VertexAttributeValues::Snorm8x4(ref values) => values.len(), - VertexAttributeValues::Uint8x4(ref values) => values.len(), - VertexAttributeValues::Unorm8x4(ref values) => values.len(), + match self { + VertexAttributeValues::Float32(values) => values.len(), + VertexAttributeValues::Sint32(values) => values.len(), + VertexAttributeValues::Uint32(values) => values.len(), + VertexAttributeValues::Float32x2(values) => values.len(), + VertexAttributeValues::Sint32x2(values) => values.len(), + VertexAttributeValues::Uint32x2(values) => values.len(), + VertexAttributeValues::Float32x3(values) => values.len(), + VertexAttributeValues::Sint32x3(values) => values.len(), + VertexAttributeValues::Uint32x3(values) => values.len(), + VertexAttributeValues::Float32x4(values) => values.len(), + VertexAttributeValues::Sint32x4(values) => values.len(), + VertexAttributeValues::Uint32x4(values) => values.len(), + VertexAttributeValues::Sint16x2(values) => values.len(), + VertexAttributeValues::Snorm16x2(values) => values.len(), + VertexAttributeValues::Uint16x2(values) => values.len(), + VertexAttributeValues::Unorm16x2(values) => values.len(), + VertexAttributeValues::Sint16x4(values) => values.len(), + VertexAttributeValues::Snorm16x4(values) => values.len(), + VertexAttributeValues::Uint16x4(values) => values.len(), + VertexAttributeValues::Unorm16x4(values) => values.len(), + VertexAttributeValues::Sint8x2(values) => values.len(), + VertexAttributeValues::Snorm8x2(values) => values.len(), + VertexAttributeValues::Uint8x2(values) => values.len(), + VertexAttributeValues::Unorm8x2(values) => values.len(), + VertexAttributeValues::Sint8x4(values) => values.len(), + VertexAttributeValues::Snorm8x4(values) => values.len(), + VertexAttributeValues::Uint8x4(values) => values.len(), + VertexAttributeValues::Unorm8x4(values) => values.len(), } } @@ -666,34 +666,34 @@ impl VertexAttributeValues { #[allow(clippy::match_same_arms)] pub fn get_bytes(&self) -> &[u8] { match self { - VertexAttributeValues::Float32(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint32(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint32(values) => cast_slice(&values[..]), - VertexAttributeValues::Float32x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint32x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint32x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Float32x3(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint32x3(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint32x3(values) => cast_slice(&values[..]), - VertexAttributeValues::Float32x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint32x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint32x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint16x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Snorm16x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint16x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Unorm16x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint16x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Snorm16x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint16x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Unorm16x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint8x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Snorm8x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint8x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Unorm8x2(values) => cast_slice(&values[..]), - VertexAttributeValues::Sint8x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Snorm8x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Uint8x4(values) => cast_slice(&values[..]), - VertexAttributeValues::Unorm8x4(values) => cast_slice(&values[..]), + VertexAttributeValues::Float32(values) => cast_slice(values), + VertexAttributeValues::Sint32(values) => cast_slice(values), + VertexAttributeValues::Uint32(values) => cast_slice(values), + VertexAttributeValues::Float32x2(values) => cast_slice(values), + VertexAttributeValues::Sint32x2(values) => cast_slice(values), + VertexAttributeValues::Uint32x2(values) => cast_slice(values), + VertexAttributeValues::Float32x3(values) => cast_slice(values), + VertexAttributeValues::Sint32x3(values) => cast_slice(values), + VertexAttributeValues::Uint32x3(values) => cast_slice(values), + VertexAttributeValues::Float32x4(values) => cast_slice(values), + VertexAttributeValues::Sint32x4(values) => cast_slice(values), + VertexAttributeValues::Uint32x4(values) => cast_slice(values), + VertexAttributeValues::Sint16x2(values) => cast_slice(values), + VertexAttributeValues::Snorm16x2(values) => cast_slice(values), + VertexAttributeValues::Uint16x2(values) => cast_slice(values), + VertexAttributeValues::Unorm16x2(values) => cast_slice(values), + VertexAttributeValues::Sint16x4(values) => cast_slice(values), + VertexAttributeValues::Snorm16x4(values) => cast_slice(values), + VertexAttributeValues::Uint16x4(values) => cast_slice(values), + VertexAttributeValues::Unorm16x4(values) => cast_slice(values), + VertexAttributeValues::Sint8x2(values) => cast_slice(values), + VertexAttributeValues::Snorm8x2(values) => cast_slice(values), + VertexAttributeValues::Uint8x2(values) => cast_slice(values), + VertexAttributeValues::Unorm8x2(values) => cast_slice(values), + VertexAttributeValues::Sint8x4(values) => cast_slice(values), + VertexAttributeValues::Snorm8x4(values) => cast_slice(values), + VertexAttributeValues::Uint8x4(values) => cast_slice(values), + VertexAttributeValues::Unorm8x4(values) => cast_slice(values), } } } diff --git a/examples/ecs/custom_query_param.rs b/examples/ecs/custom_query_param.rs index 8f8c4e13e71e8..d7cb8cb1e9bcb 100644 --- a/examples/ecs/custom_query_param.rs +++ b/examples/ecs/custom_query_param.rs @@ -12,10 +12,7 @@ //! //! For more details on the `WorldQuery` derive macro, see the trait documentation. -use bevy::{ - ecs::{component::Component, query::WorldQuery}, - prelude::*, -}; +use bevy::{ecs::query::WorldQuery, prelude::*}; use std::fmt::Debug; fn main() { diff --git a/examples/ecs/iter_combinations.rs b/examples/ecs/iter_combinations.rs index b66f9148b33a1..21dcac8b58c6d 100644 --- a/examples/ecs/iter_combinations.rs +++ b/examples/ecs/iter_combinations.rs @@ -1,6 +1,6 @@ //! Shows how to iterate over combinations of query results. -use bevy::{pbr::AmbientLight, prelude::*, render::camera::Camera, time::FixedTimestep}; +use bevy::{pbr::AmbientLight, prelude::*, time::FixedTimestep}; use rand::{thread_rng, Rng}; #[derive(Debug, Hash, PartialEq, Eq, Clone, StageLabel)] diff --git a/examples/input/keyboard_input.rs b/examples/input/keyboard_input.rs index b235ae0c01136..27c2592927698 100644 --- a/examples/input/keyboard_input.rs +++ b/examples/input/keyboard_input.rs @@ -1,9 +1,6 @@ //! Demonstrates handling a key press/release. -use bevy::{ - input::{keyboard::KeyCode, Input}, - prelude::*, -}; +use bevy::prelude::*; fn main() { App::new() diff --git a/examples/input/keyboard_modifiers.rs b/examples/input/keyboard_modifiers.rs index b36660fd0ff6b..a7242e7d5fb81 100644 --- a/examples/input/keyboard_modifiers.rs +++ b/examples/input/keyboard_modifiers.rs @@ -1,9 +1,6 @@ //! Demonstrates using key modifiers (ctrl, shift). -use bevy::{ - input::{keyboard::KeyCode, Input}, - prelude::*, -}; +use bevy::prelude::*; fn main() { App::new() diff --git a/examples/input/mouse_input_events.rs b/examples/input/mouse_input_events.rs index 547038f40cb32..3d3cf40e34940 100644 --- a/examples/input/mouse_input_events.rs +++ b/examples/input/mouse_input_events.rs @@ -3,7 +3,6 @@ use bevy::{ input::mouse::{MouseButtonInput, MouseMotion, MouseWheel}, prelude::*, - window::CursorMoved, }; fn main() { diff --git a/examples/shader/shader_instancing.rs b/examples/shader/shader_instancing.rs index b3ec34d00b361..8f9d9b7888326 100644 --- a/examples/shader/shader_instancing.rs +++ b/examples/shader/shader_instancing.rs @@ -3,7 +3,6 @@ use bevy::{ core_pipeline::core_3d::Transparent3d, ecs::system::{lifetimeless::*, SystemParamItem}, - math::prelude::*, pbr::{MeshPipeline, MeshPipelineKey, MeshUniform, SetMeshBindGroup, SetMeshViewBindGroup}, prelude::*, render::{ @@ -16,7 +15,7 @@ use bevy::{ }, render_resource::*, renderer::RenderDevice, - view::{ComputedVisibility, ExtractedView, Msaa, NoFrustumCulling, Visibility}, + view::{ExtractedView, NoFrustumCulling}, RenderApp, RenderStage, }, }; diff --git a/examples/stress_tests/many_sprites.rs b/examples/stress_tests/many_sprites.rs index 3fb2b94d8066b..c58ea82d2dbf4 100644 --- a/examples/stress_tests/many_sprites.rs +++ b/examples/stress_tests/many_sprites.rs @@ -9,9 +9,7 @@ use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, - math::Quat, prelude::*, - render::camera::Camera, window::PresentMode, }; diff --git a/examples/window/low_power.rs b/examples/window/low_power.rs index d9db6b15fb822..e22f1d2fffce5 100644 --- a/examples/window/low_power.rs +++ b/examples/window/low_power.rs @@ -3,10 +3,9 @@ //! This is useful for making desktop applications, or any other program that doesn't need to be //! running the event loop non-stop. -use std::time::Duration; - use bevy::{ prelude::*, + utils::Duration, window::{PresentMode, RequestRedraw}, winit::WinitSettings, };