Fix some nightly warnings (#9672)
# Objective Fix some nightly warnings found by running `cargo +nightly clippy` ## Solution Fix the following warnings: - [x] [elided_lifetimes_in_associated_constant](https://github.com/rust-lang/rust/issues/115010)221986134d
- [x] [unwrap_or_default](https://rust-lang.github.io/rust-clippy/master/index.html#/unwrap_or_default)32e21c78f9
- [x] [needless_pass_by_ref_mut](https://rust-lang.github.io/rust-clippy/master/index.html#/needless_pass_by_ref_mut)c85d6d4a10
There is no breaking change, some internal `bevy_ecs` code no longer uses a few mutable references but I don't think it should cause any regression or be performance sensitive, but there might be some ECS magic I'm unaware of that could break because of those changes
This commit is contained in:
parent
ce1ac05c63
commit
a2b5d7a198
@ -349,7 +349,7 @@ impl BundleInfo {
|
|||||||
&'b self,
|
&'b self,
|
||||||
entities: &'a mut Entities,
|
entities: &'a mut Entities,
|
||||||
archetypes: &'a mut Archetypes,
|
archetypes: &'a mut Archetypes,
|
||||||
components: &mut Components,
|
components: &Components,
|
||||||
storages: &'a mut Storages,
|
storages: &'a mut Storages,
|
||||||
archetype_id: ArchetypeId,
|
archetype_id: ArchetypeId,
|
||||||
change_tick: Tick,
|
change_tick: Tick,
|
||||||
@ -409,7 +409,7 @@ impl BundleInfo {
|
|||||||
&'b self,
|
&'b self,
|
||||||
entities: &'a mut Entities,
|
entities: &'a mut Entities,
|
||||||
archetypes: &'a mut Archetypes,
|
archetypes: &'a mut Archetypes,
|
||||||
components: &mut Components,
|
components: &Components,
|
||||||
storages: &'a mut Storages,
|
storages: &'a mut Storages,
|
||||||
change_tick: Tick,
|
change_tick: Tick,
|
||||||
) -> BundleSpawner<'a, 'b> {
|
) -> BundleSpawner<'a, 'b> {
|
||||||
@ -495,7 +495,7 @@ impl BundleInfo {
|
|||||||
&self,
|
&self,
|
||||||
archetypes: &mut Archetypes,
|
archetypes: &mut Archetypes,
|
||||||
storages: &mut Storages,
|
storages: &mut Storages,
|
||||||
components: &mut Components,
|
components: &Components,
|
||||||
archetype_id: ArchetypeId,
|
archetype_id: ArchetypeId,
|
||||||
) -> ArchetypeId {
|
) -> ArchetypeId {
|
||||||
if let Some(add_bundle_id) = archetypes[archetype_id].edges().get_add_bundle(self.id) {
|
if let Some(add_bundle_id) = archetypes[archetype_id].edges().get_add_bundle(self.id) {
|
||||||
@ -853,7 +853,7 @@ impl Bundles {
|
|||||||
/// provided [`Components`].
|
/// provided [`Components`].
|
||||||
pub(crate) fn init_dynamic_info(
|
pub(crate) fn init_dynamic_info(
|
||||||
&mut self,
|
&mut self,
|
||||||
components: &mut Components,
|
components: &Components,
|
||||||
component_ids: &[ComponentId],
|
component_ids: &[ComponentId],
|
||||||
) -> (&BundleInfo, &Vec<StorageType>) {
|
) -> (&BundleInfo, &Vec<StorageType>) {
|
||||||
let bundle_infos = &mut self.bundle_infos;
|
let bundle_infos = &mut self.bundle_infos;
|
||||||
@ -883,7 +883,7 @@ impl Bundles {
|
|||||||
/// Panics if the provided [`ComponentId`] does not exist in the provided [`Components`].
|
/// Panics if the provided [`ComponentId`] does not exist in the provided [`Components`].
|
||||||
pub(crate) fn init_component_info(
|
pub(crate) fn init_component_info(
|
||||||
&mut self,
|
&mut self,
|
||||||
components: &mut Components,
|
components: &Components,
|
||||||
component_id: ComponentId,
|
component_id: ComponentId,
|
||||||
) -> (&BundleInfo, StorageType) {
|
) -> (&BundleInfo, StorageType) {
|
||||||
let bundle_infos = &mut self.bundle_infos;
|
let bundle_infos = &mut self.bundle_infos;
|
||||||
|
@ -576,7 +576,7 @@ impl<'w> EntityWorldMut<'w> {
|
|||||||
let mut bundle_inserter = bundle_info.get_bundle_inserter(
|
let mut bundle_inserter = bundle_info.get_bundle_inserter(
|
||||||
&mut self.world.entities,
|
&mut self.world.entities,
|
||||||
&mut self.world.archetypes,
|
&mut self.world.archetypes,
|
||||||
&mut self.world.components,
|
&self.world.components,
|
||||||
&mut self.world.storages,
|
&mut self.world.storages,
|
||||||
self.location.archetype_id,
|
self.location.archetype_id,
|
||||||
change_tick,
|
change_tick,
|
||||||
@ -613,7 +613,7 @@ impl<'w> EntityWorldMut<'w> {
|
|||||||
let bundle_inserter = bundle_info.get_bundle_inserter(
|
let bundle_inserter = bundle_info.get_bundle_inserter(
|
||||||
&mut self.world.entities,
|
&mut self.world.entities,
|
||||||
&mut self.world.archetypes,
|
&mut self.world.archetypes,
|
||||||
&mut self.world.components,
|
&self.world.components,
|
||||||
&mut self.world.storages,
|
&mut self.world.storages,
|
||||||
self.location.archetype_id,
|
self.location.archetype_id,
|
||||||
change_tick,
|
change_tick,
|
||||||
@ -656,7 +656,7 @@ impl<'w> EntityWorldMut<'w> {
|
|||||||
let bundle_inserter = bundle_info.get_bundle_inserter(
|
let bundle_inserter = bundle_info.get_bundle_inserter(
|
||||||
&mut self.world.entities,
|
&mut self.world.entities,
|
||||||
&mut self.world.archetypes,
|
&mut self.world.archetypes,
|
||||||
&mut self.world.components,
|
&self.world.components,
|
||||||
&mut self.world.storages,
|
&mut self.world.storages,
|
||||||
self.location.archetype_id,
|
self.location.archetype_id,
|
||||||
change_tick,
|
change_tick,
|
||||||
@ -1084,7 +1084,7 @@ unsafe fn insert_dynamic_bundle<
|
|||||||
unsafe fn remove_bundle_from_archetype(
|
unsafe fn remove_bundle_from_archetype(
|
||||||
archetypes: &mut Archetypes,
|
archetypes: &mut Archetypes,
|
||||||
storages: &mut Storages,
|
storages: &mut Storages,
|
||||||
components: &mut Components,
|
components: &Components,
|
||||||
archetype_id: ArchetypeId,
|
archetype_id: ArchetypeId,
|
||||||
bundle_info: &BundleInfo,
|
bundle_info: &BundleInfo,
|
||||||
intersection: bool,
|
intersection: bool,
|
||||||
|
@ -740,7 +740,7 @@ impl World {
|
|||||||
let mut spawner = bundle_info.get_bundle_spawner(
|
let mut spawner = bundle_info.get_bundle_spawner(
|
||||||
&mut self.entities,
|
&mut self.entities,
|
||||||
&mut self.archetypes,
|
&mut self.archetypes,
|
||||||
&mut self.components,
|
&self.components,
|
||||||
&mut self.storages,
|
&mut self.storages,
|
||||||
change_tick,
|
change_tick,
|
||||||
);
|
);
|
||||||
@ -1448,7 +1448,7 @@ impl World {
|
|||||||
let mut spawn_or_insert = SpawnOrInsert::Spawn(bundle_info.get_bundle_spawner(
|
let mut spawn_or_insert = SpawnOrInsert::Spawn(bundle_info.get_bundle_spawner(
|
||||||
&mut self.entities,
|
&mut self.entities,
|
||||||
&mut self.archetypes,
|
&mut self.archetypes,
|
||||||
&mut self.components,
|
&self.components,
|
||||||
&mut self.storages,
|
&mut self.storages,
|
||||||
change_tick,
|
change_tick,
|
||||||
));
|
));
|
||||||
@ -1471,7 +1471,7 @@ impl World {
|
|||||||
let mut inserter = bundle_info.get_bundle_inserter(
|
let mut inserter = bundle_info.get_bundle_inserter(
|
||||||
&mut self.entities,
|
&mut self.entities,
|
||||||
&mut self.archetypes,
|
&mut self.archetypes,
|
||||||
&mut self.components,
|
&self.components,
|
||||||
&mut self.storages,
|
&mut self.storages,
|
||||||
location.archetype_id,
|
location.archetype_id,
|
||||||
change_tick,
|
change_tick,
|
||||||
@ -1491,7 +1491,7 @@ impl World {
|
|||||||
let mut spawner = bundle_info.get_bundle_spawner(
|
let mut spawner = bundle_info.get_bundle_spawner(
|
||||||
&mut self.entities,
|
&mut self.entities,
|
||||||
&mut self.archetypes,
|
&mut self.archetypes,
|
||||||
&mut self.components,
|
&self.components,
|
||||||
&mut self.storages,
|
&mut self.storages,
|
||||||
change_tick,
|
change_tick,
|
||||||
);
|
);
|
||||||
|
@ -41,7 +41,7 @@ where
|
|||||||
let mut spawner = bundle_info.get_bundle_spawner(
|
let mut spawner = bundle_info.get_bundle_spawner(
|
||||||
&mut world.entities,
|
&mut world.entities,
|
||||||
&mut world.archetypes,
|
&mut world.archetypes,
|
||||||
&mut world.components,
|
&world.components,
|
||||||
&mut world.storages,
|
&mut world.storages,
|
||||||
change_tick,
|
change_tick,
|
||||||
);
|
);
|
||||||
|
@ -152,7 +152,7 @@ impl fmt::Display for Token<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'a> Token<'a> {
|
impl<'a> Token<'a> {
|
||||||
const SYMBOLS: &[u8] = b".#[]";
|
const SYMBOLS: &'static [u8] = b".#[]";
|
||||||
fn symbol_from_byte(byte: u8) -> Option<Self> {
|
fn symbol_from_byte(byte: u8) -> Option<Self> {
|
||||||
match byte {
|
match byte {
|
||||||
b'.' => Some(Self::Dot),
|
b'.' => Some(Self::Dot),
|
||||||
|
@ -139,7 +139,7 @@ impl SceneSpawner {
|
|||||||
let spawned = self
|
let spawned = self
|
||||||
.spawned_dynamic_scenes
|
.spawned_dynamic_scenes
|
||||||
.entry(scene_handle.clone())
|
.entry(scene_handle.clone())
|
||||||
.or_insert_with(Vec::new);
|
.or_default();
|
||||||
spawned.push(instance_id);
|
spawned.push(instance_id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -186,10 +186,7 @@ impl SceneSpawner {
|
|||||||
scene.write_to_world_with(world, &world.resource::<AppTypeRegistry>().clone())?;
|
scene.write_to_world_with(world, &world.resource::<AppTypeRegistry>().clone())?;
|
||||||
|
|
||||||
self.spawned_instances.insert(instance_id, instance_info);
|
self.spawned_instances.insert(instance_id, instance_info);
|
||||||
let spawned = self
|
let spawned = self.spawned_scenes.entry(scene_handle).or_default();
|
||||||
.spawned_scenes
|
|
||||||
.entry(scene_handle)
|
|
||||||
.or_insert_with(Vec::new);
|
|
||||||
spawned.push(instance_id);
|
spawned.push(instance_id);
|
||||||
Ok(instance_id)
|
Ok(instance_id)
|
||||||
})
|
})
|
||||||
|
@ -44,7 +44,7 @@ pub(crate) fn create_windows<'a>(
|
|||||||
mut winit_windows: NonSendMut<WinitWindows>,
|
mut winit_windows: NonSendMut<WinitWindows>,
|
||||||
mut adapters: NonSendMut<AccessKitAdapters>,
|
mut adapters: NonSendMut<AccessKitAdapters>,
|
||||||
mut handlers: ResMut<WinitActionHandlers>,
|
mut handlers: ResMut<WinitActionHandlers>,
|
||||||
mut accessibility_requested: ResMut<AccessibilityRequested>,
|
accessibility_requested: ResMut<AccessibilityRequested>,
|
||||||
#[cfg(target_arch = "wasm32")] event_channel: ResMut<CanvasParentResizeEventChannel>,
|
#[cfg(target_arch = "wasm32")] event_channel: ResMut<CanvasParentResizeEventChannel>,
|
||||||
) {
|
) {
|
||||||
for (entity, mut window) in created_windows {
|
for (entity, mut window) in created_windows {
|
||||||
@ -64,7 +64,7 @@ pub(crate) fn create_windows<'a>(
|
|||||||
&window,
|
&window,
|
||||||
&mut adapters,
|
&mut adapters,
|
||||||
&mut handlers,
|
&mut handlers,
|
||||||
&mut accessibility_requested,
|
&accessibility_requested,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(theme) = winit_window.theme() {
|
if let Some(theme) = winit_window.theme() {
|
||||||
|
@ -46,7 +46,7 @@ impl WinitWindows {
|
|||||||
window: &Window,
|
window: &Window,
|
||||||
adapters: &mut AccessKitAdapters,
|
adapters: &mut AccessKitAdapters,
|
||||||
handlers: &mut WinitActionHandlers,
|
handlers: &mut WinitActionHandlers,
|
||||||
accessibility_requested: &mut AccessibilityRequested,
|
accessibility_requested: &AccessibilityRequested,
|
||||||
) -> &winit::window::Window {
|
) -> &winit::window::Window {
|
||||||
let mut winit_window_builder = winit::window::WindowBuilder::new();
|
let mut winit_window_builder = winit::window::WindowBuilder::new();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user