mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 23:03:06 +03:00
Simplify lambdas
This commit is contained in:
+4
-4
@@ -247,7 +247,7 @@ pub fn elapsed(&self) -> Duration {
|
||||
/// 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 @@ pub fn checked_add(&self, duration: Duration) -> Option<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 @@ pub fn elapsed(&self) -> Result<Duration, SystemTimeError> {
|
||||
/// 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 @@ pub fn checked_add(&self, duration: Duration) -> Option<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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user