From 1ecadfb0adf839c719ba50914c7336488ca55a47 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Fri, 21 Jul 2023 22:42:51 -0700 Subject: Fix clippy warnings. --- src/player.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/player.rs') diff --git a/src/player.rs b/src/player.rs index 06ca0e1..1490a56 100644 --- a/src/player.rs +++ b/src/player.rs @@ -130,20 +130,16 @@ impl Player { self.y_d = 0; } /* Don't go off the side */ - if self.x_d < 0 && self.x <= 0 { - self.x_d = 0; - } else if self.x >= constants::X_DIM as i32 && self.x_d > 0 { + if self.x_d < 0 && self.x <= 0 || self.x >= constants::X_DIM as i32 && self.x_d > 0 { self.x_d = 0; } - if self.y <= 0 && self.y_d < 0 { - self.y_d = 0; - } else if self.y >= constants::Y_DIM as i32 && self.y_d > 0 { + if self.y <= 0 && self.y_d < 0 || self.y >= constants::Y_DIM as i32 && self.y_d > 0 { self.y_d = 0; } self.x += if self.shift_p { self.x_d } else { self.x_d * 3 }; self.y += if self.shift_p { self.y_d } else { self.y_d * 3 }; - return Ok(()); + Ok(()) } } @@ -154,7 +150,7 @@ impl state::Positioned for Player { fn y(&self) -> i32 { self.y } - fn radius() -> u32 { + fn radius() -> i32 { 3 } } -- cgit v1.3.1