nit: better rust (#21058)
This commit is contained in:
parent
3140d7741c
commit
e16c060abf
|
@ -396,9 +396,9 @@ fn process_instruction(
|
||||||
);
|
);
|
||||||
// put the relavant account at the end of a larger account list
|
// put the relavant account at the end of a larger account list
|
||||||
let mut reordered_accounts = accounts.to_vec();
|
let mut reordered_accounts = accounts.to_vec();
|
||||||
let ai = reordered_accounts.remove(FROM_INDEX);
|
let account_info = reordered_accounts.remove(FROM_INDEX);
|
||||||
reordered_accounts.push(accounts[0].clone());
|
reordered_accounts.push(accounts[0].clone());
|
||||||
reordered_accounts.push(ai);
|
reordered_accounts.push(account_info);
|
||||||
invoke(&instruction, &reordered_accounts)?;
|
invoke(&instruction, &reordered_accounts)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2041,18 +2041,14 @@ where
|
||||||
// index starts at first instruction account
|
// index starts at first instruction account
|
||||||
index - keyed_accounts.len().saturating_sub(orig_data_lens.len())
|
index - keyed_accounts.len().saturating_sub(orig_data_lens.len())
|
||||||
})
|
})
|
||||||
|
.and_then(|index| {
|
||||||
|
if index >= orig_data_lens.len() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(index)
|
||||||
|
}
|
||||||
|
})
|
||||||
{
|
{
|
||||||
if orig_data_len_index >= orig_data_lens.len() {
|
|
||||||
ic_msg!(
|
|
||||||
invoke_context,
|
|
||||||
"Internal error: index mismatch for account {}",
|
|
||||||
account_key
|
|
||||||
);
|
|
||||||
return Err(SyscallError::InstructionError(
|
|
||||||
InstructionError::MissingAccount,
|
|
||||||
)
|
|
||||||
.into());
|
|
||||||
}
|
|
||||||
caller_account.original_data_len = orig_data_lens[orig_data_len_index];
|
caller_account.original_data_len = orig_data_lens[orig_data_len_index];
|
||||||
} else {
|
} else {
|
||||||
ic_msg!(
|
ic_msg!(
|
||||||
|
@ -2065,6 +2061,7 @@ where
|
||||||
)
|
)
|
||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(caller_account)
|
Some(caller_account)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Reference in New Issue