diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2020-10-21 18:18:18 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2020-10-21 20:44:03 -0700 |
| commit | ef027a1eed4cc8d34d1a4bf9222369e7fef48e93 (patch) | |
| tree | f414c2f25595c9ca75229a79c612ef3bd6423f4e /library/std/src/time | |
| parent | d72d5f48c2c534de7382a601e4619de923b7f6a9 (diff) | |
Duration::zero() -> Duration::ZERO
Duration::ZERO composes better with match and various other things, at the cost of an occasional parens, and results in less work for the optimizer, so let's use that instead.
Diffstat (limited to 'library/std/src/time')
| -rw-r--r-- | library/std/src/time/tests.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/time/tests.rs b/library/std/src/time/tests.rs index 44c06bac950..20c813fdc70 100644 --- a/library/std/src/time/tests.rs +++ b/library/std/src/time/tests.rs @@ -75,14 +75,14 @@ fn instant_checked_duration_since_nopanic() { let later = now + Duration::SECOND; assert_eq!(earlier.checked_duration_since(now), None); assert_eq!(later.checked_duration_since(now), Some(Duration::SECOND)); - assert_eq!(now.checked_duration_since(now), Some(Duration::zero())); + assert_eq!(now.checked_duration_since(now), Some(Duration::ZERO)); } #[test] fn instant_saturating_duration_since_nopanic() { let a = Instant::now(); let ret = (a - Duration::SECOND).saturating_duration_since(a); - assert_eq!(ret, Duration::zero()); + assert_eq!(ret, Duration::ZERO); } #[test] @@ -90,7 +90,7 @@ fn system_time_math() { let a = SystemTime::now(); let b = SystemTime::now(); match b.duration_since(a) { - Ok(dur) if dur == Duration::zero() => { + Ok(Duration::ZERO) => { assert_almost_eq!(a, b); } Ok(dur) => { |
