Commit Graph

11 Commits

Author SHA1 Message Date
Deadbeef
4c6ddc036b fix library and rustdoc tests 2023-04-16 11:38:52 +00:00
Jacob Kiesel
9fd744b3e3 add tests for div_duration_* functions 2023-01-07 11:05:33 -07:00
beetrees
c9948f5c5f
Fix Duration::{try_,}from_secs_f{32,64}(-0.0) 2022-10-14 16:07:09 +01:00
beetrees
e409ce2159
Fix integer overflow in format!("{:.0?}", Duration::MAX) 2022-09-29 23:06:22 +01:00
Michiel De Muynck
77ceb2b5d8 Make Duration's Debug format pad to width
Duration's Debug formatting previously ignored the width parameter.
This commit fixes that.

Fixes issue #88059.
2021-09-16 03:09:31 +02:00
Jubilee Young
af4d1786e7 Fixup tests: Duration::MIN -> ::ZERO 2020-10-27 13:57:51 -07:00
Jubilee Young
ef027a1eed 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.
2020-10-21 20:44:03 -07:00
Jubilee Young
d72d5f48c2 Dogfood Duration API in std::time tests
This expands time's test suite to use more and in more places the
range of methods and constants added to Duration in recent
proposals for the sake of testing more API surface area and
improving legibility.
2020-10-21 20:03:56 -07:00
Christiaan Dirkx
73e0a56dde Make all methods of Duration const
Make the following methods of `Duration` unstable const under `duration_const_2`:
 - `from_secs_f64`
 - `from_secs_f32`
 - `mul_f64`
 - `mul_f32`
 - `div_f64`
 - `div_f32`

This results in all methods of `Duration` being (unstable) const.

Also adds tests for these methods in a const context, moved the test to `library` as part of #76268.

Possible because of #72449, which made the relevant `f32` and `f64` methods const.

Tracking issue: #72440
2020-09-12 15:14:58 +02:00
marmeladema
b869aa5f31 Add saturating methods for Duration 2020-09-08 00:42:56 +01:00
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00