Skip to content

Commit 05d2dd9

Browse files
committed
Silent a Rust compiler warning on invalid reference casting
Using such a cast to set the `dr` register inside an `unsafe` block is an acceptable way to access the data.
1 parent 773836d commit 05d2dd9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/spi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ where
353353
unsafe { ptr::read_volatile(&self.spi.dr as *const _ as *const FrameSize) }
354354
}
355355

356+
#[allow(invalid_reference_casting)]
356357
fn write_data_reg(&mut self, data: FrameSize) {
357358
// NOTE(write_volatile) see note above
358359
unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut FrameSize, data) }

0 commit comments

Comments
 (0)