Skip to content

Commit dcdfbf6

Browse files
committed
Add explicit type to avoid inference errors
This is needed as `serde_json` also implements `PartialEq` here and rustc does not do recursive checking to infer types. `serde_json`, while not a direct dependency, is capable of being enabled indirectly via feature unification when `wasm-bindgen` enables it.
1 parent f203852 commit dcdfbf6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

time/src/duration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ macro_rules! try_from_secs {
122122
// f32 does not have enough precision to trigger the second branch
123123
// since it can not represent numbers between 0.999_999_940_395 and 1.0.
124124
let nanos = nanos + add_ns as u32;
125-
if ($mant_bits == 23) || (nanos != Nanosecond::per_t(Second)) {
125+
if ($mant_bits == 23) || (nanos != Nanosecond::per_t::<u32>(Second)) {
126126
(0, nanos)
127127
} else {
128128
(1, 0)
@@ -147,7 +147,7 @@ macro_rules! try_from_secs {
147147
// and 2.0. Bigger values result in even smaller precision of the
148148
// fractional part.
149149
let nanos = nanos + add_ns as u32;
150-
if ($mant_bits == 23) || (nanos != Nanosecond::per_t(Second)) {
150+
if ($mant_bits == 23) || (nanos != Nanosecond::per_t::<u32>(Second)) {
151151
(secs, nanos)
152152
} else {
153153
(secs + 1, 0)

0 commit comments

Comments
 (0)