From 921abe549ffb7be603c287e89ca0db1ae35565f9 Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 18 Jun 2021 19:09:14 -0600 Subject: [PATCH] lint src/entity/* --- src/entity/character.rs | 44 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/entity/character.rs b/src/entity/character.rs index c10bffd..6785322 100644 --- a/src/entity/character.rs +++ b/src/entity/character.rs @@ -44,9 +44,9 @@ impl From for CharacterClass { } } -impl Into for CharacterClass { - fn into(self) -> u8 { - match self { +impl From for u8 { + fn from(other: CharacterClass) -> u8 { + match other { CharacterClass::HUmar => 0, CharacterClass::HUnewearl => 1, CharacterClass::HUcast => 2, @@ -65,29 +65,27 @@ impl Into for CharacterClass { impl CharacterClass { pub fn is_human(&self) -> bool { - match self { - CharacterClass::HUmar | - CharacterClass::RAmar | CharacterClass::RAmarl | - CharacterClass::FOmar | CharacterClass::FOmarl => true, - - _ => false, - } + matches!(self, + CharacterClass::HUmar | + CharacterClass::RAmar | + CharacterClass::RAmarl | + CharacterClass::FOmar | + CharacterClass::FOmarl) } pub fn is_newman(&self) -> bool { - match self { - CharacterClass::HUnewearl | - CharacterClass::FOnewm | CharacterClass::FOnewearl => true, - _ => false, - } + matches!(self, + CharacterClass::HUnewearl | + CharacterClass::FOnewm | + CharacterClass::FOnewearl) } pub fn is_android(&self) -> bool { - match self { - CharacterClass::HUcast | CharacterClass::HUcaseal | - CharacterClass::RAcast | CharacterClass::RAcaseal => true, - _ => false, - } + matches!(self, + CharacterClass::HUcast | + CharacterClass::HUcaseal | + CharacterClass::RAcast | + CharacterClass::RAcaseal) } } @@ -124,9 +122,9 @@ impl From for SectionID { } } -impl Into for SectionID { - fn into(self) -> u8 { - match self { +impl From for u8 { + fn from(other: SectionID) -> u8 { + match other { SectionID::Viridia => 0, SectionID::Greenill => 1, SectionID::Skyly => 2,