diff options
| author | Linus Färnstrand <faern@faern.net> | 2019-01-31 23:18:07 +0100 |
|---|---|---|
| committer | Linus Färnstrand <faern@faern.net> | 2019-01-31 23:18:07 +0100 |
| commit | 2f2d49523a8a2cd4e3156dc2f810a83ef37e1872 (patch) | |
| tree | 30fca0f1131a30561b09ff12e5c8d97f73d2f24c /src/libstd/time.rs | |
| parent | f841ff4a7b8227f17e0fa056c6a73ba549f2872e (diff) | |
| download | rust-2f2d49523a8a2cd4e3156dc2f810a83ef37e1872.tar.gz rust-2f2d49523a8a2cd4e3156dc2f810a83ef37e1872.zip | |
Simplify lambdas
Diffstat (limited to 'src/libstd/time.rs')
| -rw-r--r-- | src/libstd/time.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<Instant> { - 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<Instant> { - 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<SystemTime> { - 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<SystemTime> { - self.0.checked_sub_duration(&duration).map(|t| SystemTime(t)) + self.0.checked_sub_duration(&duration).map(SystemTime) } } |
