Skip to content

Commit 82f3a23

Browse files
Remove Duration::MIN entirely
Duration::ZERO supercedes it in effect.
1 parent af4d178 commit 82f3a23

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

library/core/src/time.rs

+4-17
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,6 @@ impl Duration {
123123
#[unstable(feature = "duration_zero", issue = "73544")]
124124
pub const ZERO: Duration = Duration::from_nanos(0);
125125

126-
/// The minimum duration.
127-
///
128-
/// # Examples
129-
///
130-
/// ```
131-
/// #![feature(duration_constants)]
132-
/// use std::time::Duration;
133-
///
134-
/// assert_eq!(Duration::MIN, Duration::new(0, 0));
135-
/// ```
136-
#[unstable(feature = "duration_constants", issue = "57391")]
137-
pub const MIN: Duration = Duration::from_nanos(0);
138-
139126
/// The maximum duration.
140127
///
141128
/// It is roughly equal to a duration of 584,942,417,355 years.
@@ -533,26 +520,26 @@ impl Duration {
533520
}
534521
}
535522

536-
/// Saturating `Duration` subtraction. Computes `self - other`, returning [`Duration::MIN`]
523+
/// Saturating `Duration` subtraction. Computes `self - other`, returning [`Duration::ZERO`]
537524
/// if the result would be negative or if overflow occurred.
538525
///
539526
/// # Examples
540527
///
541528
/// ```
542529
/// #![feature(duration_saturating_ops)]
543-
/// #![feature(duration_constants)]
530+
/// #![feature(duration_zero)]
544531
/// use std::time::Duration;
545532
///
546533
/// assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1));
547-
/// assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::MIN);
534+
/// assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO);
548535
/// ```
549536
#[unstable(feature = "duration_saturating_ops", issue = "76416")]
550537
#[inline]
551538
#[rustc_const_unstable(feature = "duration_consts_2", issue = "72440")]
552539
pub const fn saturating_sub(self, rhs: Duration) -> Duration {
553540
match self.checked_sub(rhs) {
554541
Some(res) => res,
555-
None => Duration::MIN,
542+
None => Duration::ZERO,
556543
}
557544
}
558545

0 commit comments

Comments
 (0)