Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
clinuxrulz committed Mar 23, 2024
1 parent 4fe2e10 commit cf45c5b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/action.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::marker::PhantomData;

use bevy::ecs::{all_tuples, entity::Entity, world::World};
use bevy::ecs::{entity::Entity, world::World};

use crate::VirtualJoystickState;

Expand Down
2 changes: 1 addition & 1 deletion src/behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl VirtualJoystickBehavior for JoystickVerticalOnly {

impl VirtualJoystickBehavior for JoystickInvisible {
fn update(&self, world: &mut World, entity: Entity) {
let joystick_state = world.get::<VirtualJoystickState>(entity).map(|x| x.clone());
let joystick_state = world.get::<VirtualJoystickState>(entity).cloned();
let Some(joystick_state) = joystick_state else {
return;
};
Expand Down
2 changes: 1 addition & 1 deletion src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<S: VirtualJoystickID> Default for VirtualJoystickNode<S> {
Self {
id: Default::default(),
behavior: Arc::new(JoystickFloating),
action: Arc::new(NoAction::default()),
action: Arc::new(NoAction),
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ pub fn update_action<S: VirtualJoystickID>(world: &mut World) {
joystick_entities.push(joystick_entity);
}
enum DragAction {
OnStartDrag,
OnDrag,
OnEndDrag,
StartDrag,
Drag,
EndDrag,
}
for joystick_entity in joystick_entities {
let drag_action: Option<DragAction>;
Expand All @@ -186,12 +186,12 @@ pub fn update_action<S: VirtualJoystickID>(world: &mut World) {
continue;
};
if joystick_state.just_released {
drag_action = Some(DragAction::OnEndDrag);
drag_action = Some(DragAction::EndDrag);
} else if let Some(touch_state) = &joystick_state.touch_state {
if touch_state.just_pressed {
drag_action = Some(DragAction::OnStartDrag);
drag_action = Some(DragAction::StartDrag);
} else {
drag_action = Some(DragAction::OnDrag);
drag_action = Some(DragAction::Drag);
}
} else {
drag_action = None;
Expand All @@ -214,13 +214,13 @@ pub fn update_action<S: VirtualJoystickID>(world: &mut World) {
joystick_state = joystick_state_2.clone();
}
match drag_action {
DragAction::OnStartDrag => {
DragAction::StartDrag => {
action.on_start_drag(id, joystick_state, world, joystick_entity);
}
DragAction::OnDrag => {
DragAction::Drag => {
action.on_drag(id, joystick_state, world, joystick_entity);
}
DragAction::OnEndDrag => {
DragAction::EndDrag => {
action.on_end_drag(id, joystick_state, world, joystick_entity);
}
}
Expand Down

0 comments on commit cf45c5b

Please sign in to comment.