From 073ff81536e7a24883d6470ecf3054f4b7263186 Mon Sep 17 00:00:00 2001 From: Max Fang Date: Mon, 18 Nov 2024 17:52:11 -0800 Subject: [PATCH] address: Simplify `Address::assume_checked` impl Removes an unnecessary `match`. --- bitcoin/src/address/mod.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/bitcoin/src/address/mod.rs b/bitcoin/src/address/mod.rs index cc948ad1e..1169e631a 100644 --- a/bitcoin/src/address/mod.rs +++ b/bitcoin/src/address/mod.rs @@ -795,16 +795,7 @@ impl Address { /// For details about this mechanism, see section [*Parsing addresses*](Address#parsing-addresses) /// on [`Address`]. #[inline] - pub fn assume_checked(self) -> Address { - use AddressInner::*; - - let inner = match self.0 { - P2pkh { hash, network } => P2pkh { hash, network }, - P2sh { hash, network } => P2sh { hash, network }, - Segwit { program, hrp } => Segwit { program, hrp }, - }; - Address(inner, PhantomData) - } + pub fn assume_checked(self) -> Address { Address(self.0, PhantomData) } /// Parse a bech32 Address string pub fn from_bech32_str(s: &str) -> Result, Bech32Error> {