@@ -337,10 +337,9 @@ impl Duration {
337337 /// not recommended to use the function to construct [`Duration`]s from user provided input.
338338 /// Instead, use [`Duration::from_str`] to parse human-readable duration strings.
339339 pub const fn from_minutes_unchecked ( minutes : u64 ) -> Self {
340- let millis = match minutes. checked_mul ( DurationUnit :: Minutes . millis ( ) ) {
341- Some ( millis) => millis,
342- None => panic ! ( "overflow in Duration::from_minutes" ) ,
343- } ;
340+ let millis = minutes
341+ . checked_mul ( DurationUnit :: Minutes . millis ( ) )
342+ . expect ( "overflow in Duration::from_minutes" ) ;
344343 Self :: from_millis ( millis)
345344 }
346345
@@ -352,10 +351,9 @@ impl Duration {
352351 /// not recommended to use the function to construct [`Duration`]s from user provided input.
353352 /// Instead, use [`Duration::from_str`] to parse human-readable duration strings.
354353 pub const fn from_hours_unchecked ( hours : u64 ) -> Self {
355- let millis = match hours. checked_mul ( DurationUnit :: Hours . millis ( ) ) {
356- Some ( millis) => millis,
357- None => panic ! ( "overflow in Duration::from_hours" ) ,
358- } ;
354+ let millis = hours
355+ . checked_mul ( DurationUnit :: Hours . millis ( ) )
356+ . expect ( "overflow in Duration::from_hours" ) ;
359357 Self :: from_millis ( millis)
360358 }
361359
@@ -367,10 +365,9 @@ impl Duration {
367365 /// not recommended to use the function to construct [`Duration`]s from user provided input.
368366 /// Instead, use [`Duration::from_str`] to parse human-readable duration strings.
369367 pub const fn from_days_unchecked ( days : u64 ) -> Self {
370- let millis = match days. checked_mul ( DurationUnit :: Days . millis ( ) ) {
371- Some ( millis) => millis,
372- None => panic ! ( "overflow in Duration::from_days" ) ,
373- } ;
368+ let millis = days
369+ . checked_mul ( DurationUnit :: Days . millis ( ) )
370+ . expect ( "overflow in Duration::from_days" ) ;
374371 Self :: from_millis ( millis)
375372 }
376373}
0 commit comments