Skip to content

Commit

Permalink
Use Integer::div_floor explicitly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JesseWright authored Sep 6, 2021
1 parent 0b32a89 commit 72b40be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rust-runtime/smithy-types/src/instant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<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)
Expand Down

0 comments on commit 72b40be

Please sign in to comment.