mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-26 20:00:27 +00:00
Clippy fixes
This commit is contained in:
parent
6c801a0dba
commit
b794997c56
@ -119,7 +119,7 @@ mod tests {
|
||||
let mut read_buf = [0; 8];
|
||||
partition.read(4, &mut read_buf).await.unwrap();
|
||||
|
||||
assert!(read_buf.iter().position(|&x| x != 0xAA).is_none());
|
||||
assert!(!read_buf.iter().any(|&x| x != 0xAA));
|
||||
}
|
||||
|
||||
#[futures_test::test]
|
||||
@ -133,7 +133,7 @@ mod tests {
|
||||
partition.write(4, &write_buf).await.unwrap();
|
||||
|
||||
let flash = flash.try_lock().unwrap();
|
||||
assert!(flash.mem[132..132 + 8].iter().position(|&x| x != 0xAA).is_none());
|
||||
assert!(!flash.mem[132..132 + 8].iter().any(|&x| x != 0xAA));
|
||||
}
|
||||
|
||||
#[futures_test::test]
|
||||
@ -146,6 +146,6 @@ mod tests {
|
||||
partition.erase(0, 128).await.unwrap();
|
||||
|
||||
let flash = flash.try_lock().unwrap();
|
||||
assert!(flash.mem[128..256].iter().position(|&x| x != 0xFF).is_none());
|
||||
assert!(!flash.mem[128..256].iter().any(|&x| x != 0xFF));
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ mod tests {
|
||||
let mut read_buf = [0; 8];
|
||||
partition.read(4, &mut read_buf).unwrap();
|
||||
|
||||
assert!(read_buf.iter().position(|&x| x != 0xAA).is_none());
|
||||
assert!(!read_buf.iter().any(|&x| x != 0xAA));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -143,7 +143,7 @@ mod tests {
|
||||
partition.write(4, &write_buf).unwrap();
|
||||
|
||||
let flash = flash.into_inner().take();
|
||||
assert!(flash.mem[132..132 + 8].iter().position(|&x| x != 0xAA).is_none());
|
||||
assert!(!flash.mem[132..132 + 8].iter().any(|&x| x != 0xAA));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -156,6 +156,6 @@ mod tests {
|
||||
partition.erase(0, 128).unwrap();
|
||||
|
||||
let flash = flash.into_inner().take();
|
||||
assert!(flash.mem[128..256].iter().position(|&x| x != 0xFF).is_none());
|
||||
assert!(!flash.mem[128..256].iter().any(|&x| x != 0xFF));
|
||||
}
|
||||
}
|
||||
|
@ -112,11 +112,11 @@ where
|
||||
cs_drop.defuse();
|
||||
let cs_res = self.cs.set_high();
|
||||
|
||||
let op_res = op_res.map_err(SpiDeviceError::Spi)?;
|
||||
op_res.map_err(SpiDeviceError::Spi)?;
|
||||
flush_res.map_err(SpiDeviceError::Spi)?;
|
||||
cs_res.map_err(SpiDeviceError::Cs)?;
|
||||
|
||||
Ok(op_res)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,10 +203,10 @@ where
|
||||
cs_drop.defuse();
|
||||
let cs_res = self.cs.set_high();
|
||||
|
||||
let op_res = op_res.map_err(SpiDeviceError::Spi)?;
|
||||
op_res.map_err(SpiDeviceError::Spi)?;
|
||||
flush_res.map_err(SpiDeviceError::Spi)?;
|
||||
cs_res.map_err(SpiDeviceError::Cs)?;
|
||||
|
||||
Ok(op_res)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -81,33 +81,33 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M, BUS, E> embedded_hal_02::blocking::i2c::Write for I2cDevice<'_, M, BUS>
|
||||
impl<M, BUS, E> embedded_hal_02::blocking::i2c::Write for I2cDevice<'_, M, BUS>
|
||||
where
|
||||
M: RawMutex,
|
||||
BUS: embedded_hal_02::blocking::i2c::Write<Error = E>,
|
||||
{
|
||||
type Error = I2cDeviceError<E>;
|
||||
|
||||
fn write<'w>(&mut self, addr: u8, bytes: &'w [u8]) -> Result<(), Self::Error> {
|
||||
fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error> {
|
||||
self.bus
|
||||
.lock(|bus| bus.borrow_mut().write(addr, bytes).map_err(I2cDeviceError::I2c))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M, BUS, E> embedded_hal_02::blocking::i2c::Read for I2cDevice<'_, M, BUS>
|
||||
impl<M, BUS, E> embedded_hal_02::blocking::i2c::Read for I2cDevice<'_, M, BUS>
|
||||
where
|
||||
M: RawMutex,
|
||||
BUS: embedded_hal_02::blocking::i2c::Read<Error = E>,
|
||||
{
|
||||
type Error = I2cDeviceError<E>;
|
||||
|
||||
fn read<'w>(&mut self, addr: u8, bytes: &'w mut [u8]) -> Result<(), Self::Error> {
|
||||
fn read(&mut self, addr: u8, bytes: &mut [u8]) -> Result<(), Self::Error> {
|
||||
self.bus
|
||||
.lock(|bus| bus.borrow_mut().read(addr, bytes).map_err(I2cDeviceError::I2c))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M, BUS, E> embedded_hal_02::blocking::i2c::WriteRead for I2cDevice<'_, M, BUS>
|
||||
impl<M, BUS, E> embedded_hal_02::blocking::i2c::WriteRead for I2cDevice<'_, M, BUS>
|
||||
where
|
||||
M: RawMutex,
|
||||
BUS: embedded_hal_02::blocking::i2c::WriteRead<Error = E>,
|
||||
|
@ -82,11 +82,11 @@ where
|
||||
let flush_res = bus.flush();
|
||||
let cs_res = self.cs.set_high();
|
||||
|
||||
let op_res = op_res.map_err(SpiDeviceError::Spi)?;
|
||||
op_res.map_err(SpiDeviceError::Spi)?;
|
||||
flush_res.map_err(SpiDeviceError::Spi)?;
|
||||
cs_res.map_err(SpiDeviceError::Cs)?;
|
||||
|
||||
Ok(op_res)
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -158,10 +158,10 @@ where
|
||||
let flush_res = bus.flush();
|
||||
let cs_res = self.cs.set_high();
|
||||
|
||||
let op_res = op_res.map_err(SpiDeviceError::Spi)?;
|
||||
op_res.map_err(SpiDeviceError::Spi)?;
|
||||
flush_res.map_err(SpiDeviceError::Spi)?;
|
||||
cs_res.map_err(SpiDeviceError::Cs)?;
|
||||
Ok(op_res)
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user