use else if in std library

Clippy: Decreases indentation and improves readability

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
This commit is contained in:
wcampbell 2021-05-02 20:06:17 -04:00
parent e10cbc33c1
commit 2e559c8e10
No known key found for this signature in database
GPG key ID: A040F4DAFC68FFE8

View file

@ -518,13 +518,11 @@ impl Duration {
if let Some(mut secs) = self.secs.checked_sub(rhs.secs) {
let nanos = if self.nanos >= rhs.nanos {
self.nanos - rhs.nanos
} else if let Some(sub_secs) = secs.checked_sub(1) {
secs = sub_secs;
self.nanos + NANOS_PER_SEC - rhs.nanos
} else {
if let Some(sub_secs) = secs.checked_sub(1) {
secs = sub_secs;
self.nanos + NANOS_PER_SEC - rhs.nanos
} else {
return None;
}
return None;
};
debug_assert!(nanos < NANOS_PER_SEC);
Some(Duration { secs, nanos })