@@ -73,7 +73,7 @@ impl Duration {
7373 /// ```
7474 #[ stable( feature = "duration" , since = "1.3.0" ) ]
7575 #[ inline]
76- pub const fn new ( secs : u64 , nanos : u32 ) -> Duration {
76+ pub fn new ( secs : u64 , nanos : u32 ) -> Duration {
7777 let secs = secs. checked_add ( ( nanos / NANOS_PER_SEC ) as u64 )
7878 . expect ( "overflow in Duration::new" ) ;
7979 let nanos = nanos % NANOS_PER_SEC ;
@@ -113,9 +113,10 @@ impl Duration {
113113 #[ stable( feature = "duration" , since = "1.3.0" ) ]
114114 #[ inline]
115115 pub const fn from_millis ( millis : u64 ) -> Duration {
116- let secs = millis / MILLIS_PER_SEC ;
117- let nanos = ( ( millis % MILLIS_PER_SEC ) as u32 ) * NANOS_PER_MILLI ;
118- Duration { secs : secs, nanos : nanos }
116+ Duration {
117+ secs : millis / MILLIS_PER_SEC ,
118+ nanos : ( ( millis % MILLIS_PER_SEC ) as u32 ) * NANOS_PER_MILLI ,
119+ }
119120 }
120121
121122 /// Creates a new `Duration` from the specified number of microseconds.
@@ -134,9 +135,10 @@ impl Duration {
134135 #[ unstable( feature = "duration_from_micros" , issue = "44400" ) ]
135136 #[ inline]
136137 pub const fn from_micros ( micros : u64 ) -> Duration {
137- let secs = micros / MICROS_PER_SEC ;
138- let nanos = ( ( micros % MICROS_PER_SEC ) as u32 ) * NANOS_PER_MICRO ;
139- Duration { secs : secs, nanos : nanos }
138+ Duration {
139+ secs : micros / MICROS_PER_SEC ,
140+ nanos : ( ( micros % MICROS_PER_SEC ) as u32 ) * NANOS_PER_MICRO ,
141+ }
140142 }
141143
142144 /// Creates a new `Duration` from the specified number of nanoseconds.
@@ -155,9 +157,10 @@ impl Duration {
155157 #[ unstable( feature = "duration_extras" , issue = "46507" ) ]
156158 #[ inline]
157159 pub const fn from_nanos ( nanos : u64 ) -> Duration {
158- let secs = nanos / ( NANOS_PER_SEC as u64 ) ;
159- let nanos = ( nanos % ( NANOS_PER_SEC as u64 ) ) as u32 ;
160- Duration { secs : secs, nanos : nanos }
160+ Duration {
161+ secs : nanos / ( NANOS_PER_SEC as u64 ) ,
162+ nanos : ( nanos % ( NANOS_PER_SEC as u64 ) ) as u32 ,
163+ }
161164 }
162165
163166 /// Returns the number of _whole_ seconds contained by this `Duration`.
0 commit comments