Skip to content

Commit f88d50e

Browse files
committed
Fix clippy manual_range_contains warnings
1 parent 56c743f commit f88d50e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rtc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl Rtcc for Rtc {
145145
}
146146

147147
fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error> {
148-
if (weekday < 1) || (weekday > 7) {
148+
if !(1..=7).contains(&weekday) {
149149
return Err(Error::InvalidInputData);
150150
}
151151
self.modify(|regs| regs.dr.modify(|_, w| unsafe { w.wdu().bits(weekday) }));
@@ -154,7 +154,7 @@ impl Rtcc for Rtc {
154154
}
155155

156156
fn set_day(&mut self, day: u8) -> Result<(), Self::Error> {
157-
if (day < 1) || (day > 31) {
157+
if !(1..=31).contains(&day) {
158158
return Err(Error::InvalidInputData);
159159
}
160160
let (dt, du) = bcd2_encode(day as u32)?;
@@ -164,7 +164,7 @@ impl Rtcc for Rtc {
164164
}
165165

166166
fn set_month(&mut self, month: u8) -> Result<(), Self::Error> {
167-
if (month < 1) || (month > 12) {
167+
if !(1..=12).contains(&month) {
168168
return Err(Error::InvalidInputData);
169169
}
170170
let (mt, mu) = bcd2_encode(month as u32)?;
@@ -174,7 +174,7 @@ impl Rtcc for Rtc {
174174
}
175175

176176
fn set_year(&mut self, year: u16) -> Result<(), Self::Error> {
177-
if (year < 1970) || (year > 2038) {
177+
if !(1970..=2038).contains(&year) {
178178
return Err(Error::InvalidInputData);
179179
}
180180
let (yt, yu) = bcd2_encode(year as u32)?;

0 commit comments

Comments
 (0)