From 623ba49bb119e61b0fbd0389709c2b8b8ef69bca Mon Sep 17 00:00:00 2001 From: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com> Date: Tue, 5 Nov 2024 02:21:38 +0000 Subject: [PATCH] fix cargo hack --- helper/src/network.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/helper/src/network.rs b/helper/src/network.rs index 2836781d..d2961170 100644 --- a/helper/src/network.rs +++ b/helper/src/network.rs @@ -6,7 +6,8 @@ //! //! `#[no_std]` compatible. // TODO: move to types crate. -use std::{ + +use core::{ fmt::{Display, Formatter}, str::FromStr, }; @@ -52,17 +53,16 @@ impl FromStr for Network { type Err = ParseNetworkError; fn from_str(s: &str) -> Result<Self, Self::Err> { - match s.to_lowercase().as_str() { - "mainnet" => Ok(Self::Mainnet), - "testnet" => Ok(Self::Testnet), - "stagenet" => Ok(Self::Stagenet), + match s { + "mainnet" | "Mainnet" => Ok(Self::Mainnet), + "testnet" | "Testnet" => Ok(Self::Testnet), + "stagenet" | "Stagenet" => Ok(Self::Stagenet), _ => Err(ParseNetworkError), } } } - impl Display for Network { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { f.write_str(match self { Self::Mainnet => "mainnet", Self::Testnet => "testnet",