diff options
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/character.rs | 2 | ||||
-rw-r--r-- | src/entities/creature.rs | 2 | ||||
-rw-r--r-- | src/entities/entity.rs | 2 | ||||
-rw-r--r-- | src/entities/raws.rs | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/entities/character.rs b/src/entities/character.rs index 59d4d00a4b65..2b1b6efe47de 100644 --- a/src/entities/character.rs +++ b/src/entities/character.rs @@ -30,7 +30,7 @@ impl Character { 1 } - pub fn name<'a>(&'a self) -> &'a str { + pub fn name(&self) -> &str { self.o_name .as_ref() .expect("Character name not initialized") diff --git a/src/entities/creature.rs b/src/entities/creature.rs index 4cf6f60bdc6c..87ffda161e1c 100644 --- a/src/entities/creature.rs +++ b/src/entities/creature.rs @@ -44,7 +44,7 @@ impl Creature { /// Returns true if this creature has died pub fn dead(&self) -> bool { - self.hitpoints <= 0 + self.hitpoints == 0 } } diff --git a/src/entities/entity.rs b/src/entities/entity.rs index 0043a83ecd54..e43175931b68 100644 --- a/src/entities/entity.rs +++ b/src/entities/entity.rs @@ -13,7 +13,7 @@ pub trait Identified<ID>: Debug { fn id(&self) -> ID { self.opt_id() - .expect(format!("Entity ({:?}) is not in the game", self).as_str()) + .unwrap_or_else(|| panic!("Entity ({:?}) is not in the game", self)) } } diff --git a/src/entities/raws.rs b/src/entities/raws.rs index 2c4a8203cb17..061e29a84037 100644 --- a/src/entities/raws.rs +++ b/src/entities/raws.rs @@ -22,8 +22,8 @@ lazy_static! { pub fn raw(name: &'static str) -> &'static EntityRaw<'static> { RAWS_BY_NAME .get(name) - .map(|e| *e) - .expect(format!("Raw not found: {}", name).as_str()) + .copied() + .unwrap_or_else(|| panic!("Raw not found: {}", name)) } #[cfg(test)] |