address: Simplify `Address::assume_checked` impl
Removes an unnecessary `match`.
This commit is contained in:
parent
e4cf8ebc20
commit
073ff81536
|
@ -795,16 +795,7 @@ impl Address<NetworkUnchecked> {
|
|||
/// 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<Address<NetworkUnchecked>, Bech32Error> {
|
||||
|
|
Loading…
Reference in New Issue