From 47439762114e1575ebc3c0d4259a1715ae92deab Mon Sep 17 00:00:00 2001 From: Michael Watzko Date: Fri, 21 Mar 2025 15:52:22 +0100 Subject: [PATCH] Apply clippy suggestions --- src/bus/four_wire.rs | 2 +- src/bus/three_wire.rs | 2 +- src/device.rs | 4 ++-- src/register.rs | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bus/four_wire.rs b/src/bus/four_wire.rs index 9aed0c3..b12483b 100644 --- a/src/bus/four_wire.rs +++ b/src/bus/four_wire.rs @@ -41,7 +41,7 @@ impl Bus for FourWire { } fn write_frame(&mut self, block: u8, address: u16, data: &[u8]) -> Result<(), SPI::Error> { - let control_phase = block << 3 | WRITE_MODE_MASK; + let control_phase = (block << 3) | WRITE_MODE_MASK; let address_phase = address.to_be_bytes(); self.spi.transaction(&mut [ diff --git a/src/bus/three_wire.rs b/src/bus/three_wire.rs index 111c6fc..6eb5e96 100644 --- a/src/bus/three_wire.rs +++ b/src/bus/three_wire.rs @@ -78,7 +78,7 @@ impl Bus for ThreeWire { } fn write_frame(&mut self, block: u8, mut address: u16, data: &[u8]) -> Result<(), Self::Error> { - let mut control_phase = block << 3 | WRITE_MODE_MASK; + let mut control_phase = (block << 3) | WRITE_MODE_MASK; let mut data_phase = data; let mut last_length_written: u16; diff --git a/src/device.rs b/src/device.rs index ba957d2..a984117 100644 --- a/src/device.rs +++ b/src/device.rs @@ -26,7 +26,7 @@ impl From for ResetError { mod private { pub trait Sealed {} - impl<'a, T: Sealed> Sealed for &'a mut T {} + impl Sealed for &'_ mut T {} } pub trait State: private::Sealed { @@ -73,7 +73,7 @@ impl State for DeviceState { } } -impl<'a, T: State> State for &'a mut T { +impl State for &'_ mut T { fn socket(&mut self) -> Option { T::socket(self) } diff --git a/src/register.rs b/src/register.rs index 03b885b..32a9fe8 100644 --- a/src/register.rs +++ b/src/register.rs @@ -418,14 +418,14 @@ pub mod socketn { /// > It should be read or to be updated like as follows. /// > 1. Read the starting address for saving the transmitting data. /// > 2. Save the transmitting data from the starting address of Socket n TX - /// > buffer. + /// > buffer. /// > 3. After saving the transmitting data, update Sn_TX_WR to the - /// > increased value as many as transmitting data size. If the increment value - /// > exceeds the maximum value 0xFFFF(greater than 0x10000 and the carry - /// > bit occurs), then the carry bit is ignored and will automatically update - /// > with the lower 16bits value. + /// > increased value as many as transmitting data size. If the increment value + /// > exceeds the maximum value 0xFFFF(greater than 0x10000 and the carry + /// > bit occurs), then the carry bit is ignored and will automatically update + /// > with the lower 16bits value. /// > 4. Transmit the saved data in Socket n TX Buffer by using SEND/SEND - /// command + /// > command pub const TX_DATA_WRITE_POINTER: u16 = 0x24; /// Socket n Received Size Register