From 72b40be23794aeffebc6e76d1cde9efe570f8bc7 Mon Sep 17 00:00:00 2001 From: Jesse Wright Date: Mon, 6 Sep 2021 20:26:14 +0000 Subject: [PATCH 1/2] 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. --- rust-runtime/smithy-types/src/instant/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-runtime/smithy-types/src/instant/mod.rs b/rust-runtime/smithy-types/src/instant/mod.rs index 80ab795344..7e6d9caf31 100644 --- a/rust-runtime/smithy-types/src/instant/mod.rs +++ b/rust-runtime/smithy-types/src/instant/mod.rs @@ -147,7 +147,7 @@ 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 { - 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) From fada16c1d1ac31942d39ff7c8fd59720d92247a2 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Wed, 15 Sep 2021 08:15:01 -0400 Subject: [PATCH 2/2] run cargo fmt --- rust-runtime/smithy-types/src/instant/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-runtime/smithy-types/src/instant/mod.rs b/rust-runtime/smithy-types/src/instant/mod.rs index 7e6d9caf31..3274ac9cca 100644 --- a/rust-runtime/smithy-types/src/instant/mod.rs +++ b/rust-runtime/smithy-types/src/instant/mod.rs @@ -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 { - let subsec_millis = Integer::div_floor(&i64::from(self.subsecond_nanos), &(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)