From 3a66152d9e21c980ecace1a1ce55ea37bfd78dc9 Mon Sep 17 00:00:00 2001 From: Marek Date: Fri, 26 Apr 2024 14:21:47 +0200 Subject: [PATCH] Impl `From` for a reference type correctly The previous implementation called `into` on a reference without dereferencing it. I thought the compiler would implicitly dereference, but it didn't, which lead to infinite recursion since the fn ended up calling itself. --- zebra-chain/src/primitives/address.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zebra-chain/src/primitives/address.rs b/zebra-chain/src/primitives/address.rs index ddae0d605..86d524b8d 100644 --- a/zebra-chain/src/primitives/address.rs +++ b/zebra-chain/src/primitives/address.rs @@ -193,6 +193,6 @@ impl From for zcash_address::Network { impl From<&NetworkKind> for zcash_address::Network { fn from(network: &NetworkKind) -> Self { - network.into() + (*network).into() } }