From 5063ff8a678e1e54aeb47dc1b64ebda4e13e23ca Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Fri, 30 Dec 2022 15:26:20 +0300 Subject: [PATCH] Make debug display of LaneId compatible with its previous version (#1740) * make {:?} of LaneId compatible with its previous version * fmt * apply review suggestions --- bridges/primitives/messages/src/lib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bridges/primitives/messages/src/lib.rs b/bridges/primitives/messages/src/lib.rs index 7775b3e7dbcc..8262586567f1 100644 --- a/bridges/primitives/messages/src/lib.rs +++ b/bridges/primitives/messages/src/lib.rs @@ -69,21 +69,16 @@ impl OperatingMode for MessagesOperatingMode { /// Lane id which implements `TypeId`. #[derive( - Clone, - Copy, - Decode, - Default, - Encode, - Eq, - Ord, - PartialOrd, - PartialEq, - RuntimeDebug, - TypeInfo, - MaxEncodedLen, + Clone, Copy, Decode, Default, Encode, Eq, Ord, PartialOrd, PartialEq, TypeInfo, MaxEncodedLen, )] pub struct LaneId(pub [u8; 4]); +impl core::fmt::Debug for LaneId { + fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { + self.0.fmt(fmt) + } +} + impl AsRef<[u8]> for LaneId { fn as_ref(&self) -> &[u8] { &self.0 @@ -458,4 +453,9 @@ mod tests { assert!(delivered_messages.contains_message(150)); assert!(!delivered_messages.contains_message(151)); } + + #[test] + fn lane_id_debug_format_matches_inner_array_format() { + assert_eq!(format!("{:?}", LaneId([0, 0, 0, 0])), format!("{:?}", [0, 0, 0, 0]),); + } }