@@ -271,8 +271,8 @@ impl Rtcc for Rtc {
271
271
272
272
fn get_time ( & mut self ) -> Result < NaiveTime , Self :: Error > {
273
273
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 ( ) ? ;
276
276
let hours = hours_to_u8 ( self . get_hours ( ) ?) ?;
277
277
278
278
Ok ( NaiveTime :: from_hms (
@@ -308,22 +308,22 @@ impl Rtcc for Rtc {
308
308
}
309
309
310
310
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 ( ) ? ;
314
314
315
315
Ok ( NaiveDate :: from_ymd ( year. into ( ) , month. into ( ) , day. into ( ) ) )
316
316
}
317
317
318
318
fn get_datetime ( & mut self ) -> Result < NaiveDateTime , Self :: Error > {
319
319
self . set_24h_fmt ( ) ;
320
320
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 ( ) ? ;
324
324
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 ( ) ? ;
327
327
let hours = hours_to_u8 ( self . get_hours ( ) ?) ?;
328
328
329
329
Ok (
0 commit comments