From df3c3eb90cbaaabf86eaf2a7d3ce8346ab34f969 Mon Sep 17 00:00:00 2001 From: bry Date: Wed, 4 Dec 2024 15:48:06 -0600 Subject: [PATCH] clippy --- .../src/instructions/initialize_shared_merkle_v0.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/programs/helium-entity-manager/src/instructions/initialize_shared_merkle_v0.rs b/programs/helium-entity-manager/src/instructions/initialize_shared_merkle_v0.rs index 9756dd70b..13c88bd19 100644 --- a/programs/helium-entity-manager/src/instructions/initialize_shared_merkle_v0.rs +++ b/programs/helium-entity-manager/src/instructions/initialize_shared_merkle_v0.rs @@ -44,6 +44,11 @@ pub struct InitializeSharedMerkleV0<'info> { pub const STARTING_DEPTH: u32 = 17; pub const BUFFER_SIZE: u32 = 64; +#[allow(clippy::manual_div_ceil)] +fn div_ceil(dividend: u64, divisor: u64) -> u64 { + (dividend + divisor - 1) / divisor +} + pub fn handler( ctx: Context, args: InitializeSharedMerkleArgsV0, @@ -52,7 +57,7 @@ pub fn handler( let total_lamports = ctx.accounts.merkle_tree.lamports() + ctx.accounts.tree_authority.lamports(); ctx.accounts.shared_merkle.set_inner(SharedMerkleV0 { proof_size: args.proof_size, - price_per_mint: total_lamports.div_ceil(2u64.pow(depth) - 3), // because we can swap with 3 left + price_per_mint: div_ceil(total_lamports, 2u64.pow(depth) - 3), // because we can swap with 3 left merkle_tree: ctx.accounts.merkle_tree.key(), bump_seed: ctx.bumps["shared_merkle"], });