Skip to content

Commit e6145ef

Browse files
committed
update rustc version
1 parent e8cbec8 commit e6145ef

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/crc.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use crate::rcc::{Enable, Rcc, Reset};
2222
use crate::stm32::CRC;
2323
use core::hash::Hasher;
24-
use core::ptr;
2524

2625
/// Extension trait to constrain the CRC peripheral.
2726
pub trait CrcExt {
@@ -174,11 +173,8 @@ impl Crc {
174173
pub fn feed(&mut self, data: &[u8]) {
175174
let crc = unsafe { &(*CRC::ptr()) };
176175
for byte in data {
177-
unsafe {
178-
// Workaround with svd2rust, it does not generate the byte interface to the DR
179-
// register
180-
ptr::write_volatile(&crc.dr as *const _ as *mut u8, *byte);
181-
}
176+
let ptr = &crc.dr as *const _;
177+
unsafe { core::ptr::write_volatile(ptr as *mut u8, *byte) };
182178
}
183179
}
184180

src/gpio.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@ macro_rules! gpio {
445445
let _ = &(*$GPIOX::ptr()).pupdr.modify(|r, w| {
446446
w.bits(r.bits() & !(0b11 << offset))
447447
});
448-
&(*$GPIOX::ptr()).moder.modify(|r, w| {
448+
let _ = &(*$GPIOX::ptr()).moder.modify(|r, w| {
449449
w.bits(r.bits() & !(0b11 << offset))
450-
})
450+
});
451451
};
452452
let offset = ($i % 4) * 8;
453453
let mask = $Pxn << offset;
@@ -475,9 +475,9 @@ macro_rules! gpio {
475475
pub fn set_speed(self, speed: Speed) -> Self {
476476
let offset = 2 * $i;
477477
unsafe {
478-
&(*$GPIOX::ptr()).ospeedr.modify(|r, w| {
478+
let _ = &(*$GPIOX::ptr()).ospeedr.modify(|r, w| {
479479
w.bits((r.bits() & !(0b11 << offset)) | ((speed as u32) << offset))
480-
})
480+
});
481481
};
482482
self
483483
}

src/spi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ macro_rules! spi {
264264
} else if sr.crcerr().bit_is_set() {
265265
nb::Error::Other(Error::Crc)
266266
} else if sr.txe().bit_is_set() {
267-
// NOTE(write_volatile) see note above
268-
unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) }
267+
let ptr = &self.spi.dr as *const _;
268+
unsafe { core::ptr::write_volatile(ptr as *mut u8, byte) };
269269
return Ok(());
270270
} else {
271271
nb::Error::WouldBlock

0 commit comments

Comments
 (0)