Skip to content

Commit d4d4d0b

Browse files
committed
[FIX] clippy warnings on formatting and add clippy for defmt
Signed-off-by: Silvano Cortesi <silvano.cortesi@hotmail.com>
1 parent 2151ba1 commit d4d4d0b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- uses: actions/checkout@v4
2929
- name: Run clippy
3030
run: cargo clippy --all -- -D warnings
31+
run: cargo clippy --all --features defmt -- -D warnings
3132

3233
# No Default Features
3334
no-default-features:

src/hl/error.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ where
108108
SPI: spi::ErrorType,
109109
{
110110
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
111-
write!(f, "{:?}", self)
111+
write!(f, "{self:?}")
112112
}
113113
}
114114

@@ -124,19 +124,19 @@ where
124124
{
125125
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
126126
match self {
127-
Error::Spi(error) => write!(f, "Spi({:?})", error),
127+
Error::Spi(error) => write!(f, "Spi({error:?})"),
128128
Error::Fcs => write!(f, "Fcs"),
129129
Error::Phy => write!(f, "Phy"),
130130
Error::BufferTooSmall { required_len } => {
131-
write!(f, "BufferTooSmall {{ required_len: {:?} }}", required_len,)
131+
write!(f, "BufferTooSmall {{ required_len: {required_len:?} }}")
132132
}
133133
Error::ReedSolomon => write!(f, "ReedSolomon"),
134134
Error::FrameWaitTimeout => write!(f, "FrameWaitTimeout"),
135135
Error::Overrun => write!(f, "Overrun"),
136136
Error::PreambleDetectionTimeout => write!(f, "PreambleDetectionTimeout"),
137137
Error::SfdTimeout => write!(f, "SfdTimeout"),
138138
Error::FrameFilteringRejection => write!(f, "FrameFilteringRejection"),
139-
Error::Frame(error) => write!(f, "Frame({:?})", error),
139+
Error::Frame(error) => write!(f, "Frame({error:?})"),
140140
Error::DelayedSendTooLate => write!(f, "DelayedSendTooLate"),
141141
Error::DelayedSendPowerUpWarning => write!(f, "DelayedSendPowerUpWarning"),
142142
Error::InvalidConfiguration => write!(f, "InvalidConfiguration"),
@@ -153,7 +153,6 @@ where
153153
}
154154

155155
#[cfg(feature = "defmt")]
156-
157156
// We can't derive this implementation, as `Debug` is only implemented
158157
// conditionally for `ll::Debug`.
159158
impl<SPI> Format for Error<SPI>
@@ -167,7 +166,7 @@ where
167166
Error::Fcs => defmt::write!(f, "Fcs"),
168167
Error::Phy => defmt::write!(f, "Phy"),
169168
Error::BufferTooSmall { required_len } => {
170-
defmt::write!(f, "BufferTooSmall {{ required_len: {:?} }}", required_len,)
169+
defmt::write!(f, "BufferTooSmall {{ required_len: {:?} }}", required_len)
171170
}
172171
Error::ReedSolomon => defmt::write!(f, "ReedSolomon"),
173172
Error::FrameWaitTimeout => defmt::write!(f, "FrameWaitTimeout"),

src/ll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ where
153153
SPI::Error: core::fmt::Debug,
154154
{
155155
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
156-
write!(f, "{:?}", self)
156+
write!(f, "{self:?}")
157157
}
158158
}
159159

@@ -169,7 +169,7 @@ where
169169
{
170170
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
171171
match self {
172-
Error::Transfer(error) => write!(f, "Transfer({:?})", error),
172+
Error::Transfer(error) => write!(f, "Transfer({error:?})"),
173173
}
174174
}
175175
}

0 commit comments

Comments
 (0)