From 475c88995fc5063bba9603049bbd3d5165283ebf Mon Sep 17 00:00:00 2001 From: rewin Date: Sat, 11 Nov 2023 22:38:41 +0300 Subject: [PATCH] cargo clippy --- examples/platformer.rs | 3 +-- src/editor/core/gltf_unpack.rs | 4 ++-- src/editor/core/mod.rs | 2 +- src/editor/mod.rs | 4 ++-- src/editor/ui/bot_menu.rs | 2 +- src/editor/ui/inspector/mod.rs | 2 +- src/editor/ui/mod.rs | 2 +- src/editor_registry/mod.rs | 2 +- src/lib.rs | 2 +- src/prefab/component/mod.rs | 2 +- src/prefab/mod.rs | 6 +++--- src/prefab/spawn_system.rs | 2 +- 12 files changed, 16 insertions(+), 17 deletions(-) diff --git a/examples/platformer.rs b/examples/platformer.rs index f4a36bd1..5f48a07a 100644 --- a/examples/platformer.rs +++ b/examples/platformer.rs @@ -8,7 +8,6 @@ use bevy::{ }; use bevy_xpbd_3d::{ prelude::{AngularVelocity, LinearVelocity, Position, RayHits}, - PhysicsSchedule, PhysicsStepSet, }; use space_editor::prelude::{component::EntityLink, spatial_query::RayCasterPrefab, *}; @@ -100,7 +99,7 @@ fn move_player( ) { for (_e, mut vel, mut rot, mut controller, hits, tranform) in query.iter_mut() { //take 1th hit, because 0th hit is self hit - if let Some(hit) = hits.iter_sorted().nth(0) { + if let Some(hit) = hits.iter_sorted().next() { if hit.time_of_impact > 0.7 { continue; } diff --git a/src/editor/core/gltf_unpack.rs b/src/editor/core/gltf_unpack.rs index 1655f2ef..560db208 100644 --- a/src/editor/core/gltf_unpack.rs +++ b/src/editor/core/gltf_unpack.rs @@ -48,7 +48,7 @@ fn unpack_gltf_event( assets: Res, mut queue: ResMut, ) { - for event in events.iter() { + for event in events.read() { queue.0.push(assets.load(event.path.clone())); } events.clear(); @@ -76,7 +76,7 @@ fn unpack_gltf(world: &mut World) { let loaded_scenes = { let mut events = world.resource_mut::>(); let mut reader = events.get_reader(); - let loaded = reader.iter(&events).cloned().collect::>(); + let loaded = reader.read(&events).cloned().collect::>(); events.clear(); loaded }; diff --git a/src/editor/core/mod.rs b/src/editor/core/mod.rs index 19fd7390..700475c1 100644 --- a/src/editor/core/mod.rs +++ b/src/editor/core/mod.rs @@ -70,7 +70,7 @@ fn editor_event_listener( cache: ResMut, mut gltf_events: EventWriter, ) { - for event in events.iter() { + for event in events.read() { match event { EditorEvent::Load(path) => match path { EditorPrefabPath::File(path) => { diff --git a/src/editor/mod.rs b/src/editor/mod.rs index 6044135d..f023f32e 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -10,7 +10,7 @@ pub mod ui_registration; use bevy_egui::{EguiContext, EguiContexts}; use bevy_inspector_egui::{quick::WorldInspectorPlugin, DefaultInspectorConfigPlugin}; use bevy_mod_picking::{ - backends::raycast::{bevy_mod_raycast::prelude::RaycastSettings, RaycastPickable}, + backends::raycast::{RaycastPickable}, prelude::*, PickableBundle, }; @@ -140,7 +140,7 @@ struct SelectEvent { event: ListenerInput>, } -fn create_grid_lines(mut commands: Commands) { +fn create_grid_lines(commands: Commands) { bevy_debug_grid::spawn_floor_grid(commands); } diff --git a/src/editor/ui/bot_menu.rs b/src/editor/ui/bot_menu.rs index 21caed36..b5eabdae 100644 --- a/src/editor/ui/bot_menu.rs +++ b/src/editor/ui/bot_menu.rs @@ -184,7 +184,7 @@ pub fn bot_menu( }); }); - for event in events.iter() { + for event in events.read() { menu_state.path = event.path.clone(); editor_events.send(EditorEvent::Load(EditorPrefabPath::File(format!( "{}.scn.ron", diff --git a/src/editor/ui/inspector/mod.rs b/src/editor/ui/inspector/mod.rs index c141de07..02a0d5ae 100644 --- a/src/editor/ui/inspector/mod.rs +++ b/src/editor/ui/inspector/mod.rs @@ -265,7 +265,7 @@ pub fn inspect(ui: &mut egui::Ui, world: &mut World) { let _counter = 0; for idx in 0..components_id.len() { let c_id = components_id[idx]; - let t_id = types_id[idx]; + let _t_id = types_id[idx]; let name = pretty_type_name::pretty_type_name_str( cell.components().get_info(c_id).unwrap().name(), ); diff --git a/src/editor/ui/mod.rs b/src/editor/ui/mod.rs index 87913510..878e7bcb 100644 --- a/src/editor/ui/mod.rs +++ b/src/editor/ui/mod.rs @@ -62,7 +62,7 @@ impl Plugin for EditorUiPlugin { app.add_plugins(bot_menu::BotMenuPlugin); - app.configure_set( + app.configure_sets( Update, UiSystemSet .in_set(EditorSet::Editor) diff --git a/src/editor_registry/mod.rs b/src/editor_registry/mod.rs index e1f04aaa..e5887003 100644 --- a/src/editor_registry/mod.rs +++ b/src/editor_registry/mod.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use bevy::{ ecs::system::{EntityCommand, EntityCommands}, prelude::*, - reflect::{GetTypeRegistration, TypePath, TypeRegistry, TypeRegistryArc}, + reflect::{GetTypeRegistration, TypePath, TypeRegistryArc}, utils::{HashMap, HashSet}, }; diff --git a/src/lib.rs b/src/lib.rs index 9f2d0ddf..80e1c6e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,7 @@ use prefab::PrefabPlugin; /// Public usage of packages that used in this crate pub mod ext { pub use bevy::prelude::*; - pub use bevy_debug_grid::*; + pub use bevy_debug_grid; pub use bevy_egui::*; pub use bevy_inspector_egui::prelude::*; pub use bevy_mod_picking::prelude::*; diff --git a/src/prefab/component/mod.rs b/src/prefab/component/mod.rs index be37b024..2814e32b 100644 --- a/src/prefab/component/mod.rs +++ b/src/prefab/component/mod.rs @@ -54,7 +54,7 @@ pub struct AutoStruct { } impl AutoStruct { - pub fn new(data: &T, assets: &AssetServer) -> AutoStruct { + pub fn new(data: &T, _assets: &AssetServer) -> AutoStruct { let mut paths = HashMap::new(); if let ReflectRef::Struct(s) = data.reflect_ref() { diff --git a/src/prefab/mod.rs b/src/prefab/mod.rs index 11a65abf..774531f8 100644 --- a/src/prefab/mod.rs +++ b/src/prefab/mod.rs @@ -58,8 +58,8 @@ impl Plugin for BasePrefabPlugin { app.add_plugins(EditorRegistryPlugin); } - app.configure_set(Update, EditorSet::Game.run_if(in_state(EditorState::Game))); - app.configure_set( + app.configure_sets(Update, EditorSet::Game.run_if(in_state(EditorState::Game))); + app.configure_sets( Update, EditorSet::Editor.run_if(in_state(EditorState::Editor)), ); @@ -280,7 +280,7 @@ fn sync_asset_material( .insert(assets.load::(&material.path)); } - for e in deleted.iter() { + for e in deleted.read() { if let Some(mut cmd) = commands.get_entity(e) { cmd.remove::>(); } diff --git a/src/prefab/spawn_system.rs b/src/prefab/spawn_system.rs index bd8702e5..7d9e4915 100644 --- a/src/prefab/spawn_system.rs +++ b/src/prefab/spawn_system.rs @@ -88,7 +88,7 @@ pub fn editor_remove_mesh( mut commands: Commands, mut query: RemovedComponents, ) { - for e in query.iter() { + for e in query.read() { if let Some(mut cmd) = commands.get_entity(e) { cmd.remove::>(); info!("Removed mesh handle for {:?}", e);