From 1c29e6fa7204265b67e9c6ada21c4a6ae626ca82 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sat, 9 Mar 2024 00:34:50 -0500 Subject: [PATCH] cleanup some simple compiler warnings --- examples/testbed/src/main.rs | 4 +-- lyra-game/src/input/action.rs | 11 +------- lyra-game/src/input/events.rs | 2 +- lyra-reflect/lyra-reflect-derive/src/lib.rs | 2 +- lyra-reflect/src/lib.rs | 3 --- lyra-reflect/src/reflected_field.rs | 30 --------------------- lyra-scene/src/lib.rs | 4 +-- 7 files changed, 7 insertions(+), 49 deletions(-) delete mode 100644 lyra-reflect/src/reflected_field.rs diff --git a/examples/testbed/src/main.rs b/examples/testbed/src/main.rs index b33a539..abe3d54 100644 --- a/examples/testbed/src/main.rs +++ b/examples/testbed/src/main.rs @@ -1,6 +1,6 @@ use std::ptr::NonNull; -use lyra_engine::{assets::gltf::Gltf, ecs::{system::{BatchedSystem, Criteria, CriteriaSchedule, IntoSystem}, Component, World}, game::Game, input::{Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput}, math::{self, Transform, Vec3}, render::light::{directional::DirectionalLight, PointLight, SpotLight}, scene::{CameraComponent, MeshComponent}, DeltaTime}; +use lyra_engine::{assets::gltf::Gltf, ecs::{system::{BatchedSystem, Criteria, CriteriaSchedule, IntoSystem}, Component, World}, game::Game, input::{Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput}, math::{self, Transform, Vec3}, render::light::{directional::DirectionalLight, SpotLight}, scene::CameraComponent, DeltaTime}; use lyra_engine::assets::ResourceManager; mod free_fly_camera; @@ -89,7 +89,7 @@ async fn main() { window_options.cursor_visible = false; */ } - let mut resman = world.get_resource_mut::(); + let resman = world.get_resource_mut::(); //let diffuse_texture = resman.request::("assets/happy-tree.png").unwrap(); //let antique_camera_model = resman.request::("assets/AntiqueCamera.glb").unwrap(); //let cube_model = resman.request::("assets/cube-texture-bin.glb").unwrap(); diff --git a/lyra-game/src/input/action.rs b/lyra-game/src/input/action.rs index bbb5f10..a99d1dc 100644 --- a/lyra-game/src/input/action.rs +++ b/lyra-game/src/input/action.rs @@ -6,7 +6,7 @@ use lyra_reflect::Reflect; use crate::{plugin::Plugin, game::GameStages, EventQueue}; -use super::{Button, KeyCode, InputButtons, MouseMotion}; +use super::{Button, InputButtons, KeyCode, MouseButton, MouseMotion}; pub trait ActionLabel: Debug { /// Returns a unique hash of the label. @@ -105,15 +105,6 @@ pub enum GamepadInput { Axis(GamepadAxis), } -#[allow(dead_code)] -#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub enum MouseButton { - Left, - Right, - Middle, - Other(u16), -} - #[allow(dead_code)] #[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] pub enum MouseAxis { diff --git a/lyra-game/src/input/events.rs b/lyra-game/src/input/events.rs index 3124a8d..ec061e9 100644 --- a/lyra-game/src/input/events.rs +++ b/lyra-game/src/input/events.rs @@ -83,7 +83,7 @@ impl Touches { /// A mouse button event /// /// Translated `WindowEvent::MouseButton` from `winit` crate -#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] pub enum MouseButton { Left, Right, diff --git a/lyra-reflect/lyra-reflect-derive/src/lib.rs b/lyra-reflect/lyra-reflect-derive/src/lib.rs index a8b8ff0..e340ade 100644 --- a/lyra-reflect/lyra-reflect-derive/src/lib.rs +++ b/lyra-reflect/lyra-reflect-derive/src/lib.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use proc_macro2::Ident; -use quote::{quote, ToTokens}; +use quote::quote; use syn::{Generics, Path, Attribute, GenericParam, parse_macro_input, DeriveInput, TypeParamBound}; mod enum_derive; diff --git a/lyra-reflect/src/lib.rs b/lyra-reflect/src/lib.rs index 6389a0a..4d0a7cb 100644 --- a/lyra-reflect/src/lib.rs +++ b/lyra-reflect/src/lib.rs @@ -33,9 +33,6 @@ pub use reflected_list::*; pub mod dynamic_tuple; pub use dynamic_tuple::*; -pub mod reflected_field; -pub use reflected_field::*; - pub mod component; pub use component::*; diff --git a/lyra-reflect/src/reflected_field.rs b/lyra-reflect/src/reflected_field.rs deleted file mode 100644 index 89065d3..0000000 --- a/lyra-reflect/src/reflected_field.rs +++ /dev/null @@ -1,30 +0,0 @@ -use super::Reflect; - -/// A struct that can set fields on different types of reflected values. -pub struct ReflectField<'a> { - val: &'a dyn Reflect, - getter: fn() -> &'a dyn Reflect, - setter: fn(new_val: &'a dyn Reflect), -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum FieldType { - Struct, - Enum, - Tuple, -} - -enum FieldIdent { - Index(usize), - Named(String) -} - -impl<'a> ReflectField<'a> { - pub fn new(reflect: &'a dyn Reflect, getter: fn() -> &'a dyn Reflect, setter: fn(new_val: &'a dyn Reflect)) -> Self { - Self { - val: reflect, - getter, - setter - } - } -} \ No newline at end of file diff --git a/lyra-scene/src/lib.rs b/lyra-scene/src/lib.rs index dde3c66..345b2a1 100644 --- a/lyra-scene/src/lib.rs +++ b/lyra-scene/src/lib.rs @@ -216,10 +216,10 @@ pub(crate) fn world_add_child_node(world: &mut World, parent: &SceneN #[cfg(test)] pub mod tests { - use lyra_ecs::{query::Entities, relation::ChildOf, Component, World}; + use lyra_ecs::Component; use lyra_math::{Transform, Vec3}; - use crate::{lyra_engine, SceneGraph, SceneNodeRoot}; + use crate::{lyra_engine, SceneGraph}; #[derive(Component)] pub struct FakeMesh;