Simplify lambdas
This commit is contained in:
parent
f841ff4a7b
commit
2f2d49523a
@ -247,7 +247,7 @@ impl Instant {
|
|||||||
/// otherwise.
|
/// otherwise.
|
||||||
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
||||||
pub fn checked_add(&self, duration: Duration) -> Option<Instant> {
|
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
|
/// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as
|
||||||
@ -255,7 +255,7 @@ impl Instant {
|
|||||||
/// otherwise.
|
/// otherwise.
|
||||||
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
||||||
pub fn checked_sub(&self, duration: Duration) -> Option<Instant> {
|
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.
|
/// otherwise.
|
||||||
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
||||||
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime> {
|
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
|
/// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as
|
||||||
@ -428,7 +428,7 @@ impl SystemTime {
|
|||||||
/// otherwise.
|
/// otherwise.
|
||||||
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
#[stable(feature = "time_checked_add", since = "1.34.0")]
|
||||||
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime> {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user