Skip to content

Commit 7eace3e

Browse files
cs2dsbTheZoq2
authored andcommitted
Removed crate level allow(unused_unsafe) in favour of attributes on the specific instances (#140)
1 parent e4e4233 commit 7eace3e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@
9494
9595
#![no_std]
9696

97-
// Some pac crates have fields specified in such a way that they are safe and other
98-
// have them unsafe (likely an SVD error that needs patching). Unsafe blocks for
99-
// one device cause warnings for the safe devices. This disables that warning.
100-
#![allow(unused_unsafe)]
101-
10297
// If no target specified, print error message.
10398
#[cfg(not(any(feature = "stm32f100", feature = "stm32f101", feature = "stm32f103")))]
10499
compile_error!("Target not found. A `--feature <target-name>` is required.");

src/rtc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ impl Rtc {
103103
// Set alarm time
104104
// See section 18.3.5 for explanation
105105
let alarm_value = counter_value - 1;
106+
107+
// TODO: Remove this `allow` once these fields are made safe for stm32f100
108+
#[allow(unused_unsafe)]
106109
self.perform_write(|s| {
107110
s.regs.alrh.write(|w| unsafe{w.alrh().bits((alarm_value >> 16) as u16)});
108111
s.regs.alrl.write(|w| unsafe{w.alrl().bits(alarm_value as u16)});

src/timer.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ macro_rules! hal {
289289

290290
let (psc, arr) = compute_arr_presc(timeout.into().0, self.clk.0);
291291
self.tim.psc.write(|w| w.psc().bits(psc) );
292+
293+
// TODO: Remove this `allow` once this field is made safe for stm32f100
294+
#[allow(unused_unsafe)]
292295
self.tim.arr.write(|w| unsafe { w.arr().bits(arr) });
293296

294297
// Trigger an update event to load the prescaler value to the clock

0 commit comments

Comments
 (0)