Skip to content

Commit 6c0dcbc

Browse files
committed
rtc: Remove unnecessary unwrap calls
1 parent 969d634 commit 6c0dcbc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/rtc.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ impl Rtcc for Rtc {
271271

272272
fn get_time(&mut self) -> Result<NaiveTime, Self::Error> {
273273
self.set_24h_fmt();
274-
let seconds = self.get_seconds().unwrap();
275-
let minutes = self.get_minutes().unwrap();
274+
let seconds = self.get_seconds()?;
275+
let minutes = self.get_minutes()?;
276276
let hours = hours_to_u8(self.get_hours()?)?;
277277

278278
Ok(NaiveTime::from_hms(
@@ -308,22 +308,22 @@ impl Rtcc for Rtc {
308308
}
309309

310310
fn get_date(&mut self) -> Result<NaiveDate, Self::Error> {
311-
let day = self.get_day().unwrap();
312-
let month = self.get_month().unwrap();
313-
let year = self.get_year().unwrap();
311+
let day = self.get_day()?;
312+
let month = self.get_month()?;
313+
let year = self.get_year()?;
314314

315315
Ok(NaiveDate::from_ymd(year.into(), month.into(), day.into()))
316316
}
317317

318318
fn get_datetime(&mut self) -> Result<NaiveDateTime, Self::Error> {
319319
self.set_24h_fmt();
320320

321-
let day = self.get_day().unwrap();
322-
let month = self.get_month().unwrap();
323-
let year = self.get_year().unwrap();
321+
let day = self.get_day()?;
322+
let month = self.get_month()?;
323+
let year = self.get_year()?;
324324

325-
let seconds = self.get_seconds().unwrap();
326-
let minutes = self.get_minutes().unwrap();
325+
let seconds = self.get_seconds()?;
326+
let minutes = self.get_minutes()?;
327327
let hours = hours_to_u8(self.get_hours()?)?;
328328

329329
Ok(

0 commit comments

Comments
 (0)