From c2f6a6864846f6271f066516019b68219d56cc77 Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Wed, 1 May 2024 18:50:05 +0300 Subject: [PATCH] feat: make GameMode::as_str constant --- crates/lib/src/games/mindustry/types.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/lib/src/games/mindustry/types.rs b/crates/lib/src/games/mindustry/types.rs index fcb68a1..0bbf61d 100644 --- a/crates/lib/src/games/mindustry/types.rs +++ b/crates/lib/src/games/mindustry/types.rs @@ -52,14 +52,13 @@ impl TryFrom for GameMode { } impl GameMode { - fn as_str(&self) -> &'static str { - use GameMode::*; + const fn as_str(&self) -> &'static str { match self { - Survival => "survival", - Sandbox => "sandbox", - Attack => "attack", - PVP => "pvp", - Editor => "editor", + Self::Survival => "survival", + Self::Sandbox => "sandbox", + Self::Attack => "attack", + Self::PVP => "pvp", + Self::Editor => "editor", } } }