From 3c36ee7fd35bbd4ab5a0068a172842ad187cee3a Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 3 Jan 2022 10:58:20 -0500 Subject: [PATCH] Fix a clippy warning, complete section 5.6 --- src/player.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/player.rs b/src/player.rs index a30ba52..cb970e8 100644 --- a/src/player.rs +++ b/src/player.rs @@ -58,18 +58,16 @@ pub fn try_move_player(delta_x: i32, delta_y: i32, ecs: &mut World) { let mut ppos = ecs.write_resource::(); ppos.x = pos.x; ppos.y = pos.y - } else { - if combat_stats.get(*potential_target).is_some() { - wants_to_melee - .insert( - entity, - WantsToMelee { - target: *potential_target, - }, - ) - .expect("Add target failed"); - return; - } + } else if combat_stats.get(*potential_target).is_some() { + wants_to_melee + .insert( + entity, + WantsToMelee { + target: *potential_target, + }, + ) + .expect("Add target failed"); + return; } if let Some(door) = doors.get_mut(*potential_target) {