Clippy: Address issues

This commit is contained in:
Christian Kamm 2022-04-01 10:42:33 +02:00
parent 833a909aa4
commit f48a7f5ed9
5 changed files with 6 additions and 6 deletions

View File

@ -120,7 +120,7 @@ pub fn register_token(
oracle: ctx.accounts.oracle.key(),
bank: ctx.accounts.bank.key(),
token_index,
address_lookup_table: address_lookup_table,
address_lookup_table,
address_lookup_table_bank_index: alt_previous_size as u8,
address_lookup_table_oracle_index: alt_previous_size as u8 + 1,
reserved: Default::default(),

View File

@ -240,7 +240,7 @@ pub fn serum3_place_order(
//
let account = ctx.accounts.account.load()?;
let health =
compute_health_from_fixed_accounts(&account, HealthType::Init, &ctx.remaining_accounts)?;
compute_health_from_fixed_accounts(&account, HealthType::Init, ctx.remaining_accounts)?;
msg!("health: {}", health);
require!(health >= 0, MangoError::HealthMustBePositive);

View File

@ -105,7 +105,7 @@ pub fn withdraw(ctx: Context<Withdraw>, amount: u64, allow_borrow: bool) -> Resu
// Health check
//
let health =
compute_health_from_fixed_accounts(&account, HealthType::Init, &ctx.remaining_accounts)?;
compute_health_from_fixed_accounts(&account, HealthType::Init, ctx.remaining_accounts)?;
msg!("health: {}", health);
require!(health >= 0, MangoError::HealthMustBePositive);

View File

@ -160,10 +160,10 @@ pub enum HealthType {
/// Computes health for a mango account given a set of account infos
///
/// These account infos must fit the fixed layout defined by FixedOrderAccountRetriever.
pub fn compute_health_from_fixed_accounts<'a, 'b>(
pub fn compute_health_from_fixed_accounts(
account: &MangoAccount,
health_type: HealthType,
ais: &'a [AccountInfo<'b>],
ais: &[AccountInfo],
) -> Result<I80F48> {
let active_token_len = account.token_account_map.iter_active().count();
let active_serum_len = account.serum3_account_map.iter_active().count();

View File

@ -335,7 +335,7 @@ impl<'a> Book<'a> {
let owner_slot = mango_account
.next_order_slot()
.ok_or(error!(MangoError::SomeError))?;
.ok_or_else(|| error!(MangoError::SomeError))?;
let new_order = LeafNode::new(
owner_slot as u8,
order_id,