diff options
author | Guillaume Pasquet <dev@etenil.net> | 2019-11-17 02:08:03 +0000 |
---|---|---|
committer | Guillaume Pasquet <dev@etenil.net> | 2019-11-17 02:08:03 +0000 |
commit | 1ffd583bea0a88b727cb0dacfbdcfbc31ed99ca5 (patch) | |
tree | 753f2081e696d3f77fe851b646514a6c12c34421 | |
parent | 494037db77088b520909a78ec1d425de6fec27dc (diff) |
Clean up code with clippy
-rw-r--r-- | src/entities.rs | 14 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/tiling.rs | 2 | ||||
-rw-r--r-- | src/world.rs | 19 |
4 files changed, 15 insertions, 22 deletions
diff --git a/src/entities.rs b/src/entities.rs index 80e1235..b0169c8 100644 --- a/src/entities.rs +++ b/src/entities.rs @@ -123,7 +123,7 @@ impl Enemy for Character { luck,
level: 0,
xp: 0,
- location: location,
+ location,
previous_location: location,
tile_type: TileType::Character,
dirty: false,
@@ -145,13 +145,13 @@ impl Player for Character { luck: i32,
) -> Character {
Character {
- name: name,
- class: class,
+ name,
+ class,
max_health: health,
- health: health,
- attack: attack,
- dodge: dodge,
- luck: luck,
+ health,
+ attack,
+ dodge,
+ luck,
xp: 0,
level: 0,
location: (0, 0),
diff --git a/src/main.rs b/src/main.rs index 2e45c58..f890a27 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ mod state; mod tiling; mod world; -use entities::{Character, Entity, Player}; +use entities::{Entity, Player}; use pancurses::{endwin, initscr, noecho, Input}; use state::State; use std::env; diff --git a/src/tiling.rs b/src/tiling.rs index ef2b90b..2b6da80 100644 --- a/src/tiling.rs +++ b/src/tiling.rs @@ -18,7 +18,7 @@ impl TileGrid { grid.grid.push(subvec); } - return grid; + grid } pub fn set_tile(&mut self, x: usize, y: usize, tile: TileType) { diff --git a/src/world.rs b/src/world.rs index baddf48..328c15c 100644 --- a/src/world.rs +++ b/src/world.rs @@ -6,13 +6,6 @@ use std::cmp::min; pub type Point = (usize, usize); pub type Movement = (i8, i8); -pub enum Direction { - North, - South, - East, - West, -} - enum CorridorType { Horizontal, Vertical, @@ -283,15 +276,15 @@ impl Level { } pub fn get_start_point(&self) -> Point { - if self.rooms.len() > 0 { + if self.rooms.is_empty() { return self.rooms[0].center; } - return (0, 0); + (0, 0) } - pub fn get_entrance(&self) -> Point { - self.entrance - } + // pub fn get_entrance(&self) -> Point { + // self.entrance + // } pub fn get_exit(&self) -> Point { self.exit @@ -308,7 +301,7 @@ impl Level { } } - return false; + false } fn room_distances(&self, point: Point) -> Vec<(usize, f32)> { |