Skip to content

Commit c7b6bae

Browse files
authored
Make debug display of LaneId compatible with its previous version (#1740)
* make {:?} of LaneId compatible with its previous version * fmt * apply review suggestions
1 parent 221e4e8 commit c7b6bae

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

primitives/messages/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,16 @@ impl OperatingMode for MessagesOperatingMode {
6969

7070
/// Lane id which implements `TypeId`.
7171
#[derive(
72-
Clone,
73-
Copy,
74-
Decode,
75-
Default,
76-
Encode,
77-
Eq,
78-
Ord,
79-
PartialOrd,
80-
PartialEq,
81-
RuntimeDebug,
82-
TypeInfo,
83-
MaxEncodedLen,
72+
Clone, Copy, Decode, Default, Encode, Eq, Ord, PartialOrd, PartialEq, TypeInfo, MaxEncodedLen,
8473
)]
8574
pub struct LaneId(pub [u8; 4]);
8675

76+
impl core::fmt::Debug for LaneId {
77+
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
78+
self.0.fmt(fmt)
79+
}
80+
}
81+
8782
impl AsRef<[u8]> for LaneId {
8883
fn as_ref(&self) -> &[u8] {
8984
&self.0
@@ -458,4 +453,9 @@ mod tests {
458453
assert!(delivered_messages.contains_message(150));
459454
assert!(!delivered_messages.contains_message(151));
460455
}
456+
457+
#[test]
458+
fn lane_id_debug_format_matches_inner_array_format() {
459+
assert_eq!(format!("{:?}", LaneId([0, 0, 0, 0])), format!("{:?}", [0, 0, 0, 0]),);
460+
}
461461
}

0 commit comments

Comments
 (0)