Unverified Commit 58461ea3 authored by Jesse Wright's avatar Jesse Wright Committed by GitHub
Browse files

Use `Integer::div_floor` explicitly (#694)



* Use `Integer::div_floor` explicitly

rust-lang/rust#88581 adds several new integer methods as inherent impls. These new methods are a breaking change accepted as a minor change. They already cause build failures with nightly and will eventually cause build failures with stable as well, unless rust-lang changes course. This uses `Integer::div_floor` explicitly to avoid accidentally calling the new nightly methods, same as done for rust-num/num-bigint#218.

* run cargo fmt

Co-authored-by: default avatarRussell Cohen <rcoh@amazon.com>
parent 7da5908b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -147,7 +147,8 @@ impl Instant {
    /// This is fallible since `Instant` holds more precision than an `i64`, and will
    /// return a `ConversionError` for `Instant` values that can't be converted.
    pub fn to_epoch_millis(&self) -> Result<i64, ConversionError> {
        let subsec_millis = i64::from(self.subsecond_nanos).div_floor(&(NANOS_PER_MILLI as i64));
        let subsec_millis =
            Integer::div_floor(&i64::from(self.subsecond_nanos), &(NANOS_PER_MILLI as i64));
        if self.seconds < 0 {
            self.seconds
                .checked_add(1)