From b03809ebe3345866ac2e6d61a583d2ba0994bd0a Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 18 Dec 2020 17:33:21 +1000 Subject: [PATCH] Add the invalid state to an unreachable panic message --- zebra-network/src/peer/connection.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zebra-network/src/peer/connection.rs b/zebra-network/src/peer/connection.rs index 736c4f3f..904cdd97 100644 --- a/zebra-network/src/peer/connection.rs +++ b/zebra-network/src/peer/connection.rs @@ -36,6 +36,7 @@ use crate::{ use super::{ClientRequest, ErrorSlot, PeerError, SharedPeerError}; +#[derive(Debug)] pub(super) enum Handler { /// Indicates that the handler has finished processing the request. /// An error here is scoped to the request. @@ -303,6 +304,7 @@ impl Handler { } } +#[derive(Debug)] #[must_use = "AwaitingResponse.tx.send() must be called before drop"] pub(super) enum State { /// Awaiting a client request or a peer message. @@ -710,9 +712,9 @@ where Ok((AwaitingRequest, None)) => unreachable!( "successful AwaitingRequest states must send a response on tx, but tx is None", ), - Ok((AwaitingResponse { .. }, Some(tx))) => unreachable!( - "successful AwaitingResponse states must keep tx, but tx is Some: {:?}", - tx + Ok((new_state @ AwaitingResponse { .. }, Some(tx))) => unreachable!( + "successful AwaitingResponse states must keep tx, but tx is Some: {:?} for: {:?}", + tx, new_state, ), }; }