From 97d924dab892a34f9b6d2af43790d28214dd2a76 Mon Sep 17 00:00:00 2001 From: Fabien Penso Date: Mon, 30 Oct 2023 23:22:55 +0100 Subject: [PATCH] Update cosmrs/src/base/account_id.rs Co-authored-by: Tony Arcieri (iqlusion) --- cosmrs/src/base/account_id.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cosmrs/src/base/account_id.rs b/cosmrs/src/base/account_id.rs index 2776ba57..05e91070 100644 --- a/cosmrs/src/base/account_id.rs +++ b/cosmrs/src/base/account_id.rs @@ -79,12 +79,11 @@ impl FromStr for AccountId { type Err = ErrorReport; fn from_str(s: &str) -> Result { - if s.starts_with(|c: char| c.is_uppercase()) { - let (hrp, bytes) = - bech32::decode_upper(s).wrap_err(format!("invalid uppercase bech32: '{}'", s))?; - return Self::new(&hrp, &bytes); - } - let (hrp, bytes) = bech32::decode(s).wrap_err(format!("invalid bech32: '{}'", s))?; + let (hrp, bytes) = if s.starts_with(|c: char| c.is_uppercase()) { + bech32::decode_upper(s) + } else + bech32::decode(s) + }.wrap_err(format!("invalid uppercase bech32: '{}'", s))?; Self::new(&hrp, &bytes) } }