Skip to content

Commit 8cdc478

Browse files
authored
subghz: replace Debug impl with Display for some structs
This improves the formatting for nested structures.
1 parent 262a3bf commit 8cdc478

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Added alarm functionality to the RTC.
1111
- Added `Rtc.is_wakeup_timer_en`.
1212

13+
### Changed
14+
- Replaced `Debug` implementation with `Display` implementation for:
15+
- `subghz::FskPacketStatus`
16+
- `subghz::LoRaPacketStatus`
17+
- `subghz::Stats`
18+
- `subghz::Status`
19+
1320
## [0.3.0] - 2021-12-20
1421
### Added
1522
- Added `info::Core::CT` to get the CPU core at compile time.

hal/src/subghz/packet_status.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use super::Status;
77
/// Returned by [`fsk_packet_status`].
88
///
99
/// [`fsk_packet_status`]: super::SubGhz::fsk_packet_status
10-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10+
#[derive(Clone, Copy, PartialEq, Eq)]
1111
pub struct FskPacketStatus {
1212
buf: [u8; 4],
1313
}
@@ -149,7 +149,7 @@ impl defmt::Format for FskPacketStatus {
149149
}
150150
}
151151

152-
impl core::fmt::Display for FskPacketStatus {
152+
impl core::fmt::Debug for FskPacketStatus {
153153
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
154154
f.debug_struct("FskPacketStatus")
155155
.field("status", &self.status())
@@ -172,7 +172,7 @@ impl core::fmt::Display for FskPacketStatus {
172172
/// Returned by [`lora_packet_status`].
173173
///
174174
/// [`lora_packet_status`]: super::SubGhz::lora_packet_status
175-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
175+
#[derive(Clone, Copy, PartialEq, Eq)]
176176
pub struct LoRaPacketStatus {
177177
buf: [u8; 4],
178178
}
@@ -272,7 +272,7 @@ impl defmt::Format for LoRaPacketStatus {
272272
}
273273
}
274274

275-
impl core::fmt::Display for LoRaPacketStatus {
275+
impl core::fmt::Debug for LoRaPacketStatus {
276276
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
277277
f.debug_struct("LoRaPacketStatus")
278278
.field("status", &self.status())

hal/src/subghz/stats.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ typestate!(FskStats, "FSK stats");
99
///
1010
/// [`fsk_stats`]: super::SubGhz::fsk_stats
1111
/// [`lora_stats`]: super::SubGhz::lora_stats
12-
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
12+
#[derive(Eq, PartialEq, Clone, Copy)]
1313
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1414
pub struct Stats<ModType> {
1515
status: Status,
@@ -139,7 +139,7 @@ impl Stats<LoRaStats> {
139139
}
140140
}
141141

142-
impl core::fmt::Display for Stats<FskStats> {
142+
impl core::fmt::Debug for Stats<FskStats> {
143143
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
144144
f.debug_struct("Stats")
145145
.field("status", &self.status())

hal/src/subghz/status.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl CmdStatus {
116116
/// This is returned by [`status`].
117117
///
118118
/// [`status`]: super::SubGhz::status
119-
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
119+
#[derive(PartialEq, Eq, Clone, Copy)]
120120
pub struct Status(u8);
121121

122122
impl From<u8> for Status {
@@ -180,7 +180,7 @@ impl Status {
180180
}
181181
}
182182

183-
impl core::fmt::Display for Status {
183+
impl core::fmt::Debug for Status {
184184
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
185185
f.debug_struct("Status")
186186
.field("mode", &self.mode())

0 commit comments

Comments
 (0)