Skip to content

Commit 005d863

Browse files
committed
Simplify MockApi implementation
1 parent f00b39d commit 005d863

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/std/src/testing/mock.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ impl Api for MockApi {
139139

140140
fn addr_humanize(&self, canonical: &CanonicalAddr) -> StdResult<Addr> {
141141
validate_length(canonical.as_ref())?;
142-
let Ok(encoded) = encode(
142+
143+
encode(
143144
self.bech32_prefix,
144145
canonical.as_slice().to_base32(),
145146
Variant::Bech32,
146-
) else {
147-
return Err(StdError::generic_err("Invalid canonical address"));
148-
};
149-
Ok(Addr::unchecked(encoded))
147+
)
148+
.map(Addr::unchecked)
149+
.map_err(|_| StdError::generic_err("Invalid canonical address"))
150150
}
151151

152152
fn secp256k1_verify(

0 commit comments

Comments
 (0)