Skip to content

Commit bda0ca2

Browse files
committed
i2c/eeprom: lint
1 parent d2f8b60 commit bda0ca2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/eeprom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::i2c;
33

44
const I2C_ADDR: u8 = 0xa0;
55

6-
pub fn read_eui48<'a>(i2c: &pac::I2C2) -> Result<[u8; 6], i2c::Error> {
6+
pub fn read_eui48(i2c: &pac::I2C2) -> Result<[u8; 6], i2c::Error> {
77
let mut buffer = [0u8; 6];
88
i2c::write_read(i2c, I2C_ADDR, &[0xFAu8], &mut buffer)?;
99
Ok(buffer)

src/i2c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn poll_for_start_ack(
101101
}
102102
}
103103

104-
return Err(Error::Timeout);
104+
Err(Error::Timeout)
105105
}
106106

107107

@@ -111,10 +111,10 @@ pub fn write_read(
111111
bytes: &[u8],
112112
buffer: &mut [u8],
113113
) -> Result<(), Error> {
114-
assert!(bytes.len() < 256 && bytes.len() > 0);
115-
assert!(buffer.len() < 256 && buffer.len() > 0);
114+
assert!(bytes.len() < 256 && !bytes.is_empty());
115+
assert!(buffer.len() < 256 && !buffer.is_empty());
116116

117-
poll_for_start_ack(i2c, addr|0, false, bytes.len(), false, true)?;
117+
poll_for_start_ack(i2c, addr, false, bytes.len(), false, true)?;
118118

119119
for byte in bytes {
120120
// Wait until we are allowed to send data (START has been ACKed or last

0 commit comments

Comments
 (0)