Resolve nightly-2021-10-05 clippy complaints
This commit is contained in:
@@ -99,9 +99,9 @@ pub fn parse_token(
|
||||
"destination": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
"amount": amount.to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -120,9 +120,9 @@ pub fn parse_token(
|
||||
"delegate": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
"amount": amount.to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -139,9 +139,9 @@ pub fn parse_token(
|
||||
let mut value = json!({
|
||||
"source": account_keys[instruction.accounts[0] as usize].to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
1,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -170,9 +170,9 @@ pub fn parse_token(
|
||||
COption::None => None,
|
||||
},
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
1,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -191,9 +191,9 @@ pub fn parse_token(
|
||||
"account": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
"amount": amount.to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -212,9 +212,9 @@ pub fn parse_token(
|
||||
"mint": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
"amount": amount.to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -232,9 +232,9 @@ pub fn parse_token(
|
||||
"account": account_keys[instruction.accounts[0] as usize].to_string(),
|
||||
"destination": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -252,9 +252,9 @@ pub fn parse_token(
|
||||
"account": account_keys[instruction.accounts[0] as usize].to_string(),
|
||||
"mint": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -272,9 +272,9 @@ pub fn parse_token(
|
||||
"account": account_keys[instruction.accounts[0] as usize].to_string(),
|
||||
"mint": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -294,9 +294,9 @@ pub fn parse_token(
|
||||
"destination": account_keys[instruction.accounts[2] as usize].to_string(),
|
||||
"tokenAmount": token_amount_to_ui_amount(amount, decimals),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
3,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -316,9 +316,9 @@ pub fn parse_token(
|
||||
"delegate": account_keys[instruction.accounts[2] as usize].to_string(),
|
||||
"tokenAmount": token_amount_to_ui_amount(amount, decimals),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
3,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -337,9 +337,9 @@ pub fn parse_token(
|
||||
"account": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
"tokenAmount": token_amount_to_ui_amount(amount, decimals),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
@@ -358,9 +358,9 @@ pub fn parse_token(
|
||||
"mint": account_keys[instruction.accounts[1] as usize].to_string(),
|
||||
"tokenAmount": token_amount_to_ui_amount(amount, decimals),
|
||||
});
|
||||
let mut map = value.as_object_mut().unwrap();
|
||||
let map = value.as_object_mut().unwrap();
|
||||
parse_signers(
|
||||
&mut map,
|
||||
map,
|
||||
2,
|
||||
account_keys,
|
||||
&instruction.accounts,
|
||||
|
@@ -51,7 +51,7 @@ fn get_mint_decimals(bank: &Bank, mint: &Pubkey) -> Option<u8> {
|
||||
pub fn collect_token_balances(
|
||||
bank: &Bank,
|
||||
batch: &TransactionBatch,
|
||||
mut mint_decimals: &mut HashMap<Pubkey, u8>,
|
||||
mint_decimals: &mut HashMap<Pubkey, u8>,
|
||||
) -> TransactionTokenBalances {
|
||||
let mut balances: TransactionTokenBalances = vec![];
|
||||
|
||||
@@ -59,7 +59,7 @@ pub fn collect_token_balances(
|
||||
let has_token_program = transaction
|
||||
.message()
|
||||
.account_keys_iter()
|
||||
.any(|p| is_token_program(p));
|
||||
.any(is_token_program);
|
||||
|
||||
let mut transaction_balances: Vec<TransactionTokenBalance> = vec![];
|
||||
if has_token_program {
|
||||
@@ -69,7 +69,7 @@ pub fn collect_token_balances(
|
||||
}
|
||||
|
||||
if let Some((mint, ui_token_amount)) =
|
||||
collect_token_balance_from_account(bank, account_id, &mut mint_decimals)
|
||||
collect_token_balance_from_account(bank, account_id, mint_decimals)
|
||||
{
|
||||
transaction_balances.push(TransactionTokenBalance {
|
||||
account_index: index as u8,
|
||||
|
Reference in New Issue
Block a user