diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 6685ee20265..b63d816ce44 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -247,7 +247,7 @@ impl Instant { /// otherwise. #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_add(&self, duration: Duration) -> Option { - self.0.checked_add_duration(&duration).map(|t| Instant(t)) + self.0.checked_add_duration(&duration).map(Instant) } /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as @@ -255,7 +255,7 @@ impl Instant { /// otherwise. #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_sub(&self, duration: Duration) -> Option { - self.0.checked_sub_duration(&duration).map(|t| Instant(t)) + self.0.checked_sub_duration(&duration).map(Instant) } } @@ -420,7 +420,7 @@ impl SystemTime { /// otherwise. #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_add(&self, duration: Duration) -> Option { - self.0.checked_add_duration(&duration).map(|t| SystemTime(t)) + self.0.checked_add_duration(&duration).map(SystemTime) } /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as @@ -428,7 +428,7 @@ impl SystemTime { /// otherwise. #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_sub(&self, duration: Duration) -> Option { - self.0.checked_sub_duration(&duration).map(|t| SystemTime(t)) + self.0.checked_sub_duration(&duration).map(SystemTime) } }