Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
rewin123 committed Nov 11, 2023
1 parent 081aa3f commit 475c889
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions examples/platformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, *};

Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/editor/core/gltf_unpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn unpack_gltf_event(
assets: Res<AssetServer>,
mut queue: ResMut<GltfSceneQueue>,
) {
for event in events.iter() {
for event in events.read() {
queue.0.push(assets.load(event.path.clone()));
}
events.clear();
Expand Down Expand Up @@ -76,7 +76,7 @@ fn unpack_gltf(world: &mut World) {
let loaded_scenes = {
let mut events = world.resource_mut::<Events<GltfLoaded>>();
let mut reader = events.get_reader();
let loaded = reader.iter(&events).cloned().collect::<Vec<GltfLoaded>>();
let loaded = reader.read(&events).cloned().collect::<Vec<GltfLoaded>>();
events.clear();
loaded
};
Expand Down
2 changes: 1 addition & 1 deletion src/editor/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn editor_event_listener(
cache: ResMut<PrefabMemoryCache>,
mut gltf_events: EventWriter<gltf_unpack::EditorUnpackGltf>,
) {
for event in events.iter() {
for event in events.read() {
match event {
EditorEvent::Load(path) => match path {
EditorPrefabPath::File(path) => {
Expand Down
4 changes: 2 additions & 2 deletions src/editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -140,7 +140,7 @@ struct SelectEvent {
event: ListenerInput<Pointer<Down>>,
}

fn create_grid_lines(mut commands: Commands) {
fn create_grid_lines(commands: Commands) {
bevy_debug_grid::spawn_floor_grid(commands);
}

Expand Down
2 changes: 1 addition & 1 deletion src/editor/ui/bot_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/editor/ui/inspector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
Expand Down
2 changes: 1 addition & 1 deletion src/editor/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/editor_registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
2 changes: 1 addition & 1 deletion src/prefab/component/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct AutoStruct<T: Reflect + FromReflect + Default + Clone> {
}

impl<T: Reflect + FromReflect + Default + Clone> AutoStruct<T> {
pub fn new(data: &T, assets: &AssetServer) -> AutoStruct<T> {
pub fn new(data: &T, _assets: &AssetServer) -> AutoStruct<T> {
let mut paths = HashMap::new();

if let ReflectRef::Struct(s) = data.reflect_ref() {
Expand Down
6 changes: 3 additions & 3 deletions src/prefab/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
);
Expand Down Expand Up @@ -280,7 +280,7 @@ fn sync_asset_material(
.insert(assets.load::<StandardMaterial>(&material.path));
}

for e in deleted.iter() {
for e in deleted.read() {
if let Some(mut cmd) = commands.get_entity(e) {
cmd.remove::<Handle<StandardMaterial>>();
}
Expand Down
2 changes: 1 addition & 1 deletion src/prefab/spawn_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn editor_remove_mesh(
mut commands: Commands,
mut query: RemovedComponents<MeshPrimitivePrefab>,
) {
for e in query.iter() {
for e in query.read() {
if let Some(mut cmd) = commands.get_entity(e) {
cmd.remove::<Handle<Mesh>>();
info!("Removed mesh handle for {:?}", e);
Expand Down

0 comments on commit 475c889

Please sign in to comment.