From 331dbac270273889111a3cd4bb73d16eeaf5ebde Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 12 May 2020 14:03:57 +0200 Subject: use Display implementations from evtclib --- src/playerclass.rs | 41 ++++------------------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) (limited to 'src/playerclass.rs') diff --git a/src/playerclass.rs b/src/playerclass.rs index 247e8b1..31a49aa 100644 --- a/src/playerclass.rs +++ b/src/playerclass.rs @@ -67,43 +67,10 @@ impl From<&evtclib::Player> for PlayerClass { impl fmt::Display for PlayerClass { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use EliteSpec::*; - use Profession::*; - - let name = match *self { - PlayerClass::EliteSpec(elite) => match elite { - Dragonhunter => "Dragonhunter", - Firebrand => "Firebrand", - Berserker => "Berserker", - Spellbreaker => "Spellbreaker", - Herald => "Herald", - Renegade => "Renegade", - Scrapper => "Scrapper", - Holosmith => "Holosmith", - Druid => "Druid", - Soulbeast => "Soulbeast", - Daredevil => "Daredevil", - Deadeye => "Deadeye", - Tempest => "Tempest", - Weaver => "Weaver", - Chronomancer => "Chronomancer", - Mirage => "Mirage", - Reaper => "Reaper", - Scourge => "Scourge", - }, - PlayerClass::Profession(prof) => match prof { - Guardian => "Guardian", - Warrior => "Warrior", - Revenant => "Revenant", - Engineer => "Engineer", - Ranger => "Ranger", - Thief => "Thief", - Elementalist => "Elementalist", - Mesmer => "Mesmer", - Necromancer => "Necromancer", - }, - }; - write!(f, "{}", name) + match *self { + PlayerClass::EliteSpec(elite) => elite.fmt(f), + PlayerClass::Profession(prof) => prof.fmt(f), + } } } -- cgit v1.2.3