From 2f2d49523a8a2cd4e3156dc2f810a83ef37e1872 Mon Sep 17 00:00:00 2001 From: Linus Färnstrand Date: Thu, 31 Jan 2019 23:18:07 +0100 Subject: Simplify lambdas --- src/libstd/time.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libstd') 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) } } -- cgit 1.4.1-3-g733a5