From 194903c1cfd9410cada24da150a0dae1943a47a7 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:13:59 +0000 Subject: [PATCH] v1.17: Uses stable `u64::next_multiple_of()` (backport of #33549) (#33567) Uses stable `u64::next_multiple_of()` (#33549) (cherry picked from commit c8d545c5019507fc735893d6de36168c73deb792) Co-authored-by: Brooks --- core/tests/epoch_accounts_hash.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/core/tests/epoch_accounts_hash.rs b/core/tests/epoch_accounts_hash.rs index 1f6eb702769d3e..718e62688b8c4c 100755 --- a/core/tests/epoch_accounts_hash.rs +++ b/core/tests/epoch_accounts_hash.rs @@ -529,7 +529,7 @@ fn test_background_services_request_handling_for_epoch_accounts_hash() { // Based on the EAH start and snapshot interval, pick a slot to mass-root all the banks in // this range such that an EAH request will be sent and also a snapshot request. let eah_start_slot = epoch_accounts_hash_utils::calculation_start(&bank); - let set_root_slot = next_multiple_of(eah_start_slot, FULL_SNAPSHOT_INTERVAL); + let set_root_slot = eah_start_slot.next_multiple_of(FULL_SNAPSHOT_INTERVAL); if bank.block_height() == set_root_slot { info!("Calling set_root() on bank {}...", bank.slot()); @@ -661,16 +661,3 @@ fn test_epoch_accounts_hash_and_warping() { .wait_get_epoch_accounts_hash(); info!("Waiting for epoch accounts hash... DONE"); } - -// Copy the impl of `next_multiple_of` since it is nightly-only experimental. -// https://doc.rust-lang.org/std/primitive.u64.html#method.next_multiple_of -// https://github.com/rust-lang/rust/issues/88581 -// https://github.com/rust-lang/rust/pull/88582 -// https://github.com/jhpratt/rust/blob/727a4fc7e3f836938dfeb4a2ab237cfca612222d/library/core/src/num/uint_macros.rs#L1811-L1837 -const fn next_multiple_of(lhs: u64, rhs: u64) -> u64 { - #![allow(clippy::arithmetic_side_effects)] - match lhs % rhs { - 0 => lhs, - r => lhs + (rhs - r), - } -}