Skip to content

Commit 302953f

Browse files
amaanqmaximeborges
authored andcommitted
fix: compilation on nightly
1 parent 08e313a commit 302953f

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

src/flash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<'a> EraseSequence<'a> {
202202
flash.check_locked_or_busy()?;
203203
flash.clear_errors();
204204

205-
flash.registers.cr.modify(|_, w| unsafe {
205+
flash.registers.cr.modify(|_, w| {
206206
#[cfg(any(
207207
feature = "stm32f765",
208208
feature = "stm32f767",

src/serial.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,7 @@ where
189189

190190
// Enable tx / rx, configure data bits and parity
191191
usart.cr1.modify(|_, w| {
192-
w
193-
.te().enabled()
194-
.re().enabled()
195-
.ue().enabled();
192+
w.te().enabled().re().enabled().ue().enabled();
196193

197194
// M[1:0] are used to set data bits
198195
// M[1:0] = 00: 1 Start bit, 8 data bits, n stop bits
@@ -206,7 +203,7 @@ where
206203

207204
match config.parity {
208205
Parity::ParityEven => w.ps().even().pce().enabled(),
209-
Parity::ParityOdd => w.ps().odd().pce().enabled(),
206+
Parity::ParityOdd => w.ps().odd().pce().enabled(),
210207
Parity::ParityNone => w.pce().disabled(),
211208
}
212209
});
@@ -444,7 +441,7 @@ where
444441
if isr.txe().bit_is_set() {
445442
// NOTE(unsafe) atomic write to stateless register
446443
// NOTE(write_volatile) 8-bit write that's not possible through the svd2rust API
447-
unsafe { ptr::write_volatile(&(*U::ptr()).tdr as *const _ as *mut _, byte) }
444+
unsafe { ptr::write_volatile(core::ptr::addr_of!((*U::ptr()).tdr) as *mut u8, byte) }
448445
Ok(())
449446
} else {
450447
Err(nb::Error::WouldBlock)
@@ -460,7 +457,6 @@ pub struct Config {
460457
pub sysclock: bool,
461458
pub parity: Parity,
462459
pub data_bits: DataBits,
463-
464460
}
465461

466462
pub enum Oversampling {

src/spi.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,7 @@ macro_rules! impl_instance {
386386
// to access it. This is safe, as `&self.dr` is a
387387
// memory-mapped register.
388388
let value = unsafe {
389-
ptr::read_volatile(
390-
&self.dr as *const _ as *const _,
391-
)
389+
ptr::read_volatile(self.dr_address() as *mut _)
392390
};
393391

394392
return Ok(value);
@@ -424,7 +422,7 @@ macro_rules! impl_instance {
424422
// memory-mapped register.
425423
unsafe {
426424
ptr::write_volatile(
427-
&self.dr as *const _ as *mut _,
425+
self.dr_address() as *mut _,
428426
word,
429427
);
430428
}
@@ -436,7 +434,7 @@ macro_rules! impl_instance {
436434
}
437435

438436
fn dr_address(&self) -> u32 {
439-
&self.dr as *const _ as _
437+
core::ptr::addr_of!(self.dr) as u32
440438
}
441439
}
442440

0 commit comments

Comments
 (0)