Skip to content

Commit d96233a

Browse files
committed
clippy fixes
1 parent 2d433f6 commit d96233a

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

src/exti.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,18 @@ impl ExtiExt for EXTI {
6868
let mask = 1 << line;
6969
match edge {
7070
SignalEdge::Rising => {
71-
self.rtsr1().modify(|r, w| unsafe { w.bits(r.bits() | mask) });
71+
self.rtsr1()
72+
.modify(|r, w| unsafe { w.bits(r.bits() | mask) });
7273
}
7374
SignalEdge::Falling => {
74-
self.ftsr1().modify(|r, w| unsafe { w.bits(r.bits() | mask) });
75+
self.ftsr1()
76+
.modify(|r, w| unsafe { w.bits(r.bits() | mask) });
7577
}
7678
SignalEdge::All => {
77-
self.rtsr1().modify(|r, w| unsafe { w.bits(r.bits() | mask) });
78-
self.ftsr1().modify(|r, w| unsafe { w.bits(r.bits() | mask) });
79+
self.rtsr1()
80+
.modify(|r, w| unsafe { w.bits(r.bits() | mask) });
81+
self.ftsr1()
82+
.modify(|r, w| unsafe { w.bits(r.bits() | mask) });
7983
}
8084
}
8185
self.wakeup(ev);
@@ -91,10 +95,13 @@ impl ExtiExt for EXTI {
9195

9296
let line = ev as u8;
9397
let mask = !(1 << line);
94-
self.imr1().modify(|r, w| unsafe { w.bits(r.bits() & mask) });
98+
self.imr1()
99+
.modify(|r, w| unsafe { w.bits(r.bits() & mask) });
95100
if line <= TRIGGER_MAX {
96-
self.rtsr1().modify(|r, w| unsafe { w.bits(r.bits() & mask) });
97-
self.ftsr1().modify(|r, w| unsafe { w.bits(r.bits() & mask) });
101+
self.rtsr1()
102+
.modify(|r, w| unsafe { w.bits(r.bits() & mask) });
103+
self.ftsr1()
104+
.modify(|r, w| unsafe { w.bits(r.bits() & mask) });
98105
}
99106
}
100107

src/rtc.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ impl Rtc {
114114

115115
pub fn set_hour_format(&mut self, fmt: RtcHourFormat) {
116116
self.modify(|rb| {
117-
rb.cr().modify(|_, w| w.fmt().bit(fmt == RtcHourFormat::H12));
117+
rb.cr()
118+
.modify(|_, w| w.fmt().bit(fmt == RtcHourFormat::H12));
118119
});
119120
}
120121

@@ -193,10 +194,10 @@ impl Rtc {
193194

194195
pub fn set_alarm_a(&mut self, alarm: impl Into<Alarm>) {
195196
let alarm = alarm.into();
196-
let (dt, du) = bcd2_encode(alarm.day.unwrap_or_default() as u32);
197-
let (ht, hu) = bcd2_encode(alarm.hours.unwrap_or_default() as u32);
198-
let (mt, mu) = bcd2_encode(alarm.minutes.unwrap_or_default() as u32);
199-
let (st, su) = bcd2_encode(alarm.seconds.unwrap_or_default() as u32);
197+
let (dt, du) = bcd2_encode(alarm.day.unwrap_or_default());
198+
let (ht, hu) = bcd2_encode(alarm.hours.unwrap_or_default());
199+
let (mt, mu) = bcd2_encode(alarm.minutes.unwrap_or_default());
200+
let (st, su) = bcd2_encode(alarm.seconds.unwrap_or_default());
200201

201202
self.modify(|rb| {
202203
rb.alrmassr().write(|w| unsafe {
@@ -391,7 +392,7 @@ fn bcd2_encode(word: u32) -> (u8, u8) {
391392
bcd_high += 1;
392393
value -= 10;
393394
}
394-
let bcd_low = ((bcd_high << 4) | value) as u8;
395+
let bcd_low = (bcd_high << 4) | value;
395396
(bcd_high, bcd_low)
396397
}
397398

0 commit comments

Comments
 (0)