Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- uses: actions/checkout@v4
- name: Run clippy
run: cargo clippy --all -- -D warnings
run: cargo clippy --all --features defmt -- -D warnings

# No Default Features
no-default-features:
Expand Down
2 changes: 1 addition & 1 deletion src/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl StsLen {

// Compute the square root of the squared value with Newton's method
let sqrt = |x: u32| -> u32 {
let mut z = (x + 1) / 2;
let mut z = x.div_ceil(2);
let mut y = x;
while z < y {
y = z;
Expand Down
11 changes: 5 additions & 6 deletions src/hl/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ where
SPI: spi::ErrorType,
{
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
write!(f, "{:?}", self)
write!(f, "{self:?}")
}
}

Expand All @@ -124,19 +124,19 @@ where
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::Spi(error) => write!(f, "Spi({:?})", error),
Error::Spi(error) => write!(f, "Spi({error:?})"),
Error::Fcs => write!(f, "Fcs"),
Error::Phy => write!(f, "Phy"),
Error::BufferTooSmall { required_len } => {
write!(f, "BufferTooSmall {{ required_len: {:?} }}", required_len,)
write!(f, "BufferTooSmall {{ required_len: {required_len:?} }}")
}
Error::ReedSolomon => write!(f, "ReedSolomon"),
Error::FrameWaitTimeout => write!(f, "FrameWaitTimeout"),
Error::Overrun => write!(f, "Overrun"),
Error::PreambleDetectionTimeout => write!(f, "PreambleDetectionTimeout"),
Error::SfdTimeout => write!(f, "SfdTimeout"),
Error::FrameFilteringRejection => write!(f, "FrameFilteringRejection"),
Error::Frame(error) => write!(f, "Frame({:?})", error),
Error::Frame(error) => write!(f, "Frame({error:?})"),
Error::DelayedSendTooLate => write!(f, "DelayedSendTooLate"),
Error::DelayedSendPowerUpWarning => write!(f, "DelayedSendPowerUpWarning"),
Error::InvalidConfiguration => write!(f, "InvalidConfiguration"),
Expand All @@ -153,7 +153,6 @@ where
}

#[cfg(feature = "defmt")]

// We can't derive this implementation, as `Debug` is only implemented
// conditionally for `ll::Debug`.
impl<SPI> Format for Error<SPI>
Expand All @@ -167,7 +166,7 @@ where
Error::Fcs => defmt::write!(f, "Fcs"),
Error::Phy => defmt::write!(f, "Phy"),
Error::BufferTooSmall { required_len } => {
defmt::write!(f, "BufferTooSmall {{ required_len: {:?} }}", required_len,)
defmt::write!(f, "BufferTooSmall {{ required_len: {:?} }}", required_len)
}
Error::ReedSolomon => defmt::write!(f, "ReedSolomon"),
Error::FrameWaitTimeout => defmt::write!(f, "FrameWaitTimeout"),
Expand Down
12 changes: 6 additions & 6 deletions src/ll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ where
SPI::Error: core::fmt::Debug,
{
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
write!(f, "{:?}", self)
write!(f, "{self:?}")
}
}

Expand All @@ -169,7 +169,7 @@ where
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::Transfer(error) => write!(f, "Transfer({:?})", error),
Error::Transfer(error) => write!(f, "Transfer({error:?})"),
}
}
}
Expand Down Expand Up @@ -567,7 +567,7 @@ macro_rules! impl_register {
impl<SPI> DW3000<SPI> {
$(
#[$doc]
pub fn $name_lower(&mut self) -> RegAccessor<$name, SPI> {
pub fn $name_lower(&mut self) -> RegAccessor<'_, $name, SPI> {
RegAccessor(self, PhantomData)
}
)*
Expand Down Expand Up @@ -1679,7 +1679,7 @@ impl Writable for TX_BUFFER {

impl<SPI> DW3000<SPI> {
/// Transmit Data Buffer
pub fn tx_buffer(&mut self) -> RegAccessor<TX_BUFFER, SPI> {
pub fn tx_buffer(&mut self) -> RegAccessor<'_, TX_BUFFER, SPI> {
RegAccessor(self, PhantomData)
}
}
Expand Down Expand Up @@ -1728,7 +1728,7 @@ impl Readable for RX_BUFFER_0 {

impl<SPI> DW3000<SPI> {
/// Receive Data Buffer
pub fn rx_buffer_0(&mut self) -> RegAccessor<RX_BUFFER_0, SPI> {
pub fn rx_buffer_0(&mut self) -> RegAccessor<'_, RX_BUFFER_0, SPI> {
RegAccessor(self, PhantomData)
}
}
Expand Down Expand Up @@ -1789,7 +1789,7 @@ impl Readable for RX_BUFFER_1 {

impl<SPI> DW3000<SPI> {
/// Receive Data Buffer1
pub fn rx_buffer_1(&mut self) -> RegAccessor<RX_BUFFER_1, SPI> {
pub fn rx_buffer_1(&mut self) -> RegAccessor<'_, RX_BUFFER_1, SPI> {
RegAccessor(self, PhantomData)
}
}
Expand Down