Skip to content

Commit 30502b8

Browse files
committed
std: Derive Default for Duration.
Discussed in #37546 the libs team reached the conclusion that a default zero duration seems like a reasonable implementation of the `Default` trait. Closes #37546
1 parent 3dced6f commit 30502b8

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)