Skip to content

Commit 787104b

Browse files
committed
Add panic lint exceptions for infallible unwraps
1 parent cf41147 commit 787104b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,14 @@ impl<I2C: embedded_hal_async::i2c::I2c, DELAY: embedded_hal_async::delay::DelayN
180180
let mut acc_bytes: [u8; 6] = [0; 6];
181181
self.read_regs(Register::XOutLow, &mut acc_bytes).await?;
182182
Ok((
183+
#[allow(clippy::unwrap_used)]
184+
// panic safety: slice is always of length 2
183185
i16::from_le_bytes(acc_bytes[0..2].try_into().unwrap()),
186+
#[allow(clippy::unwrap_used)]
187+
// panic safety: slice is always of length 2
184188
i16::from_le_bytes(acc_bytes[2..4].try_into().unwrap()),
189+
#[allow(clippy::unwrap_used)]
190+
// panic safety: slice is always of length 2
185191
i16::from_le_bytes(acc_bytes[4..6].try_into().unwrap()),
186192
))
187193
}

0 commit comments

Comments
 (0)