Skip to content

Commit

Permalink
cli::checks: Remove allow(clippy::arithmetic_side_effects) (solana-…
Browse files Browse the repository at this point in the history
…labs#834)

Just a single missing case, and `arithmetic_side_effects` can now be re-enabled for this module again.
  • Loading branch information
ilya-bobyr authored Apr 18, 2024
1 parent dd51e61 commit 22f80c9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cli/src/checks.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::arithmetic_side_effects)]

use {
crate::cli::CliError,
solana_rpc_client::rpc_client::RpcClient,
Expand Down Expand Up @@ -84,10 +82,19 @@ pub fn check_account_for_spend_and_fee_with_commitment(
fee: u64,
commitment: CommitmentConfig,
) -> Result<(), CliError> {
let required_balance =
balance
.checked_add(fee)
.ok_or(CliError::InsufficientFundsForSpendAndFee(
lamports_to_sol(balance),
lamports_to_sol(fee),
*account_pubkey,
))?;

if !check_account_for_balance_with_commitment(
rpc_client,
account_pubkey,
balance + fee,
required_balance,
commitment,
)
.map_err(Into::<ClientError>::into)?
Expand Down

0 comments on commit 22f80c9

Please sign in to comment.