Skip to content

Commit 75f2c21

Browse files
authored
Rollup merge of rust-lang#37699 - alexcrichton:default-for-duration, r=brson
std: Derive `Default` for `Duration`. Discussed in rust-lang#37546 the libs team reached the conclusion that a default zero duration seems like a reasonable implementation of the `Default` trait. Closes rust-lang#37546
2 parents 35b0cf6 + 30502b8 commit 75f2c21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/time/duration.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const MILLIS_PER_SEC: u64 = 1_000;
3939
/// let ten_millis = Duration::from_millis(10);
4040
/// ```
4141
#[stable(feature = "duration", since = "1.3.0")]
42-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
42+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)]
4343
pub struct Duration {
4444
secs: u64,
4545
nanos: u32, // Always 0 <= nanos < NANOS_PER_SEC

0 commit comments

Comments
 (0)