summaryrefslogtreecommitdiffstats
path: root/src/player.rs
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2023-07-21 22:42:51 -0700
committerRose Hogenson <rosehogenson@posteo.net>2023-07-21 22:42:51 -0700
commit1ecadfb0adf839c719ba50914c7336488ca55a47 (patch)
tree5d7419007e983c2ba684b89f402615205345fef6 /src/player.rs
parentd075c455b1ed5fe89fb949ca1f019de97ffb832a (diff)
downloadstallman-shooter-1ecadfb0adf839c719ba50914c7336488ca55a47.tar.zst
Fix clippy warnings.
Diffstat (limited to 'src/player.rs')
-rw-r--r--src/player.rs12
1 files changed, 4 insertions, 8 deletions
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
}
}