From 91970c9d14a471184a327937b88cbb6227d072f1 Mon Sep 17 00:00:00 2001 From: Iago Garrido Date: Tue, 12 Nov 2019 15:05:03 +0100 Subject: rename property to clarify --- src/state.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/state.rs b/src/state.rs index 20b49d7..f2ec249 100644 --- a/src/state.rs +++ b/src/state.rs @@ -5,18 +5,18 @@ use crate::entities::{Character, Entity}; use crate::world::{Dungeon, Generatable, Level}; pub struct State { - pub character: Character, + pub player: Character, pub dungeon: Dungeon, pub level: usize, } impl State { pub fn new( - character: Character, + player: Character, dungeon: Dungeon, - ) -> State { + ) -> Self { State { - character: character, + player: player, dungeon: dungeon, level: 0, } @@ -24,7 +24,7 @@ impl State { pub fn init(&mut self) { self.dungeon.generate(); - self.character.place(self.current_level().get_start_point()); + self.player.place(self.current_level().get_start_point()); } pub fn debug(&self) { -- cgit v1.2.3 From e0eee2b14ebdc4727cf6e60a1e8af6ddec24c2f4 Mon Sep 17 00:00:00 2001 From: Iago Garrido Date: Tue, 12 Nov 2019 15:40:21 +0100 Subject: remove unnecesary explicit lifetime --- src/tiling.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tiling.rs b/src/tiling.rs index 139af24..9684302 100644 --- a/src/tiling.rs +++ b/src/tiling.rs @@ -2,7 +2,7 @@ pub struct TileGrid { grid: Vec> } -impl<'a> TileGrid { +impl TileGrid { pub fn new(xsize: usize, ysize: usize) -> TileGrid { let mut grid = TileGrid { grid: Vec::with_capacity(ysize) @@ -31,7 +31,7 @@ impl<'a> TileGrid { }) } - pub fn raw_data(&'a self) -> &'a Vec> { + pub fn raw_data(& self) -> & Vec> { &self.grid } } -- cgit v1.2.3