Skip to content

Commit

Permalink
remove unnecessary lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Jan 23, 2024
1 parent 3157396 commit 125ba53
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions programs/drift/src/instructions/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ use anchor_lang::solana_program::sysvar::instructions;
use anchor_spl::associated_token::AssociatedToken;
use borsh::{BorshDeserialize, BorshSerialize};

pub fn handle_initialize_user<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, InitializeUser<'info>>,
pub fn handle_initialize_user<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, InitializeUser<'info>>,
sub_account_id: u16,
name: [u8; 32],
) -> Result<()> {
Expand Down Expand Up @@ -184,8 +184,8 @@ pub fn handle_initialize_user<'a, 'b, 'c: 'info, 'info>(
Ok(())
}

pub fn handle_initialize_user_stats<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, InitializeUserStats>,
pub fn handle_initialize_user_stats<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, InitializeUserStats>,
) -> Result<()> {
let clock = Clock::get()?;

Expand Down Expand Up @@ -249,8 +249,8 @@ pub fn handle_initialize_referrer_name(
#[access_control(
deposit_not_paused(&ctx.accounts.state)
)]
pub fn handle_deposit<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, Deposit<'info>>,
pub fn handle_deposit<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, Deposit<'info>>,
market_index: u16,
amount: u64,
reduce_only: bool,
Expand Down Expand Up @@ -416,8 +416,8 @@ pub fn handle_deposit<'a, 'b, 'c: 'info, 'info>(
#[access_control(
withdraw_not_paused(&ctx.accounts.state)
)]
pub fn handle_withdraw<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, Withdraw<'info>>,
pub fn handle_withdraw<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, Withdraw<'info>>,
market_index: u16,
amount: u64,
reduce_only: bool,
Expand Down Expand Up @@ -586,8 +586,8 @@ pub fn handle_withdraw<'a, 'b, 'c: 'info, 'info>(
deposit_not_paused(&ctx.accounts.state)
withdraw_not_paused(&ctx.accounts.state)
)]
pub fn handle_transfer_deposit<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, TransferDeposit<'info>>,
pub fn handle_transfer_deposit<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, TransferDeposit<'info>>,
market_index: u16,
amount: u64,
) -> anchor_lang::Result<()> {
Expand Down Expand Up @@ -790,8 +790,8 @@ pub fn handle_transfer_deposit<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_place_perp_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, PlaceOrder>,
pub fn handle_place_perp_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, PlaceOrder>,
params: OrderParams,
) -> Result<()> {
let clock = &Clock::get()?;
Expand Down Expand Up @@ -835,8 +835,8 @@ pub fn handle_place_perp_order<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_cancel_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, CancelOrder>,
pub fn handle_cancel_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, CancelOrder>,
order_id: Option<u32>,
) -> Result<()> {
let clock = &Clock::get()?;
Expand Down Expand Up @@ -874,8 +874,8 @@ pub fn handle_cancel_order<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_cancel_order_by_user_id<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, CancelOrder>,
pub fn handle_cancel_order_by_user_id<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, CancelOrder>,
user_order_id: u8,
) -> Result<()> {
let clock = &Clock::get()?;
Expand Down Expand Up @@ -908,8 +908,8 @@ pub fn handle_cancel_order_by_user_id<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_cancel_orders_by_ids<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, CancelOrder>,
pub fn handle_cancel_orders_by_ids<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, CancelOrder>,
order_ids: Vec<u32>,
) -> Result<()> {
let clock = &Clock::get()?;
Expand Down Expand Up @@ -944,8 +944,8 @@ pub fn handle_cancel_orders_by_ids<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_cancel_orders<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, CancelOrder<'info>>,
pub fn handle_cancel_orders<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, CancelOrder<'info>>,
market_type: Option<MarketType>,
market_index: Option<u16>,
direction: Option<PositionDirection>,
Expand Down Expand Up @@ -989,8 +989,8 @@ pub fn handle_cancel_orders<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_modify_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, CancelOrder<'info>>,
pub fn handle_modify_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, CancelOrder<'info>>,
order_id: Option<u32>,
modify_order_params: ModifyOrderParams,
) -> Result<()> {
Expand Down Expand Up @@ -1031,8 +1031,8 @@ pub fn handle_modify_order<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_modify_order_by_user_order_id<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, CancelOrder<'info>>,
pub fn handle_modify_order_by_user_order_id<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, CancelOrder<'info>>,
user_order_id: u8,
modify_order_params: ModifyOrderParams,
) -> Result<()> {
Expand Down Expand Up @@ -1068,8 +1068,8 @@ pub fn handle_modify_order_by_user_order_id<'a, 'b, 'c: 'info, 'info>(
#[access_control(
exchange_not_paused(&ctx.accounts.state)
)]
pub fn handle_place_orders<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, PlaceOrder>,
pub fn handle_place_orders<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, PlaceOrder>,
params: Vec<OrderParams>,
) -> Result<()> {
let clock = &Clock::get()?;
Expand Down Expand Up @@ -1144,8 +1144,8 @@ pub fn handle_place_orders<'a, 'b, 'c: 'info, 'info>(
#[access_control(
fill_not_paused(&ctx.accounts.state)
)]
pub fn handle_place_and_take_perp_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, PlaceAndTake<'info>>,
pub fn handle_place_and_take_perp_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, PlaceAndTake<'info>>,
params: OrderParams,
_maker_order_id: Option<u32>,
) -> Result<()> {
Expand Down Expand Up @@ -1242,8 +1242,8 @@ pub fn handle_place_and_take_perp_order<'a, 'b, 'c: 'info, 'info>(
#[access_control(
fill_not_paused(&ctx.accounts.state)
)]
pub fn handle_place_and_make_perp_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, PlaceAndMake<'info>>,
pub fn handle_place_and_make_perp_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, PlaceAndMake<'info>>,
params: OrderParams,
taker_order_id: u32,
) -> Result<()> {
Expand Down Expand Up @@ -1339,8 +1339,8 @@ pub fn handle_place_and_make_perp_order<'a, 'b, 'c: 'info, 'info>(
Ok(())
}

pub fn handle_place_spot_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, PlaceOrder>,
pub fn handle_place_spot_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, PlaceOrder>,
params: OrderParams,
) -> Result<()> {
let AccountMaps {
Expand Down Expand Up @@ -1381,8 +1381,8 @@ pub fn handle_place_spot_order<'a, 'b, 'c: 'info, 'info>(
#[access_control(
fill_not_paused(&ctx.accounts.state)
)]
pub fn handle_place_and_take_spot_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, PlaceAndTake<'info>>,
pub fn handle_place_and_take_spot_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, PlaceAndTake<'info>>,
params: OrderParams,
fulfillment_type: SpotFulfillmentType,
maker_order_id: Option<u32>,
Expand Down Expand Up @@ -1516,8 +1516,8 @@ pub fn handle_place_and_take_spot_order<'a, 'b, 'c: 'info, 'info>(
#[access_control(
fill_not_paused(&ctx.accounts.state)
)]
pub fn handle_place_and_make_spot_order<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, PlaceAndMake<'info>>,
pub fn handle_place_and_make_spot_order<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, PlaceAndMake<'info>>,
params: OrderParams,
taker_order_id: u32,
fulfillment_type: SpotFulfillmentType,
Expand Down Expand Up @@ -1645,8 +1645,8 @@ pub fn handle_place_and_make_spot_order<'a, 'b, 'c: 'info, 'info>(
#[access_control(
amm_not_paused(&ctx.accounts.state)
)]
pub fn handle_add_perp_lp_shares<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, AddRemoveLiquidity<'info>>,
pub fn handle_add_perp_lp_shares<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, AddRemoveLiquidity<'info>>,
n_shares: u64,
market_index: u16,
) -> Result<()> {
Expand Down Expand Up @@ -1744,8 +1744,8 @@ pub fn handle_add_perp_lp_shares<'a, 'b, 'c: 'info, 'info>(
Ok(())
}

pub fn handle_remove_perp_lp_shares_in_expiring_market<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, RemoveLiquidityInExpiredMarket<'info>>,
pub fn handle_remove_perp_lp_shares_in_expiring_market<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, RemoveLiquidityInExpiredMarket<'info>>,
shares_to_burn: u64,
market_index: u16,
) -> Result<()> {
Expand Down Expand Up @@ -1797,8 +1797,8 @@ pub fn handle_remove_perp_lp_shares_in_expiring_market<'a, 'b, 'c: 'info, 'info>
#[access_control(
amm_not_paused(&ctx.accounts.state)
)]
pub fn handle_remove_perp_lp_shares<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, AddRemoveLiquidity<'info>>,
pub fn handle_remove_perp_lp_shares<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, AddRemoveLiquidity<'info>>,
shares_to_burn: u64,
market_index: u16,
) -> Result<()> {
Expand Down Expand Up @@ -1857,8 +1857,8 @@ pub fn handle_update_user_custom_margin_ratio(
Ok(())
}

pub fn handle_update_user_margin_trading_enabled<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, UpdateUser<'info>>,
pub fn handle_update_user_margin_trading_enabled<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, UpdateUser<'info>>,
_sub_account_id: u16,
margin_trading_enabled: bool,
) -> Result<()> {
Expand Down Expand Up @@ -2381,8 +2381,8 @@ pub struct Swap<'info> {
#[access_control(
fill_not_paused(&ctx.accounts.state)
)]
pub fn handle_begin_swap<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, Swap<'info>>,
pub fn handle_begin_swap<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, Swap<'info>>,
in_market_index: u16,
out_market_index: u16,
amount_in: u64,
Expand Down Expand Up @@ -2631,8 +2631,8 @@ pub enum SwapReduceOnly {
#[access_control(
fill_not_paused(&ctx.accounts.state)
)]
pub fn handle_end_swap<'a, 'b, 'c: 'info, 'info>(
ctx: Context<'a, 'b, 'c, 'info, Swap<'info>>,
pub fn handle_end_swap<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, Swap<'info>>,
in_market_index: u16,
out_market_index: u16,
limit_price: Option<u64>,
Expand Down

0 comments on commit 125ba53

Please sign in to comment.