From 68d64e08ce62605988a47e5d0a642cf8dc4b7ccb Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Fri, 15 Dec 2023 18:58:39 -0500 Subject: [PATCH] clippy --- token-lending/cli/src/lending_state.rs | 2 +- token-lending/cli/src/main.rs | 2 +- token-lending/program/tests/helpers/mock_pyth.rs | 2 +- .../program/tests/helpers/mock_switchboard.rs | 4 +++- .../program/tests/helpers/solend_program_test.rs | 12 +++++------- token-lending/program/tests/init_reserve.rs | 2 +- token-lending/program/tests/refresh_reserve.rs | 4 ++-- token-lending/program/tests/update_reserve_config.rs | 2 +- token-lending/sdk/src/oracles.rs | 6 +++++- token-lending/sdk/src/state/reserve.rs | 1 - 10 files changed, 20 insertions(+), 17 deletions(-) diff --git a/token-lending/cli/src/lending_state.rs b/token-lending/cli/src/lending_state.rs index f3c9441f440..25ccf760090 100644 --- a/token-lending/cli/src/lending_state.rs +++ b/token-lending/cli/src/lending_state.rs @@ -75,7 +75,7 @@ impl SolendState { *pubkey, reserve.liquidity.pyth_oracle_pubkey, reserve.liquidity.switchboard_oracle_pubkey, - reserve.config.extra_oracle_pubkey + reserve.config.extra_oracle_pubkey, ) })); diff --git a/token-lending/cli/src/main.rs b/token-lending/cli/src/main.rs index 05784725930..7e4c6a66a46 100644 --- a/token-lending/cli/src/main.rs +++ b/token-lending/cli/src/main.rs @@ -1546,7 +1546,7 @@ fn command_liquidate_obligation( *pubkey, reserve.liquidity.pyth_oracle_pubkey, reserve.liquidity.switchboard_oracle_pubkey, - reserve.config.extra_oracle_pubkey + reserve.config.extra_oracle_pubkey, ) })); diff --git a/token-lending/program/tests/helpers/mock_pyth.rs b/token-lending/program/tests/helpers/mock_pyth.rs index 05970d0afb0..55f177d05d8 100644 --- a/token-lending/program/tests/helpers/mock_pyth.rs +++ b/token-lending/program/tests/helpers/mock_pyth.rs @@ -34,7 +34,7 @@ pub enum MockPythInstruction { expo: i32, ema_price: i64, ema_conf: u64, - } + }, } pub fn process_instruction( diff --git a/token-lending/program/tests/helpers/mock_switchboard.rs b/token-lending/program/tests/helpers/mock_switchboard.rs index 53485a6ef31..ce8403f6057 100644 --- a/token-lending/program/tests/helpers/mock_switchboard.rs +++ b/token-lending/program/tests/helpers/mock_switchboard.rs @@ -114,7 +114,9 @@ pub fn set_switchboard_price( } pub fn init_switchboard(program_id: Pubkey, switchboard_feed: Pubkey) -> Instruction { - let data = MockSwitchboardInstruction::InitSwitchboard.try_to_vec().unwrap(); + let data = MockSwitchboardInstruction::InitSwitchboard + .try_to_vec() + .unwrap(); Instruction { program_id, accounts: vec![AccountMeta::new(switchboard_feed, false)], diff --git a/token-lending/program/tests/helpers/solend_program_test.rs b/token-lending/program/tests/helpers/solend_program_test.rs index 8a5869f39ed..4c42488ee48 100644 --- a/token-lending/program/tests/helpers/solend_program_test.rs +++ b/token-lending/program/tests/helpers/solend_program_test.rs @@ -414,9 +414,7 @@ impl SolendProgramTest { } pub async fn init_pyth_feed(&mut self, mint: &Pubkey) -> Pubkey { - let pyth_price_pubkey = self - .create_account(3312, &pyth_mainnet::id(), None) - .await; + let pyth_price_pubkey = self.create_account(3312, &pyth_mainnet::id(), None).await; let pyth_product_pubkey = self .create_account(PROD_ACCT_SIZE, &pyth_mainnet::id(), None) .await; @@ -807,7 +805,7 @@ impl Info { reserve.pubkey, reserve.account.liquidity.pyth_oracle_pubkey, reserve.account.liquidity.switchboard_oracle_pubkey, - reserve.account.config.extra_oracle_pubkey + reserve.account.config.extra_oracle_pubkey, ), redeem_reserve_collateral( solend_program::id(), @@ -903,7 +901,7 @@ impl Info { reserve.pubkey, reserve.account.liquidity.pyth_oracle_pubkey, reserve.account.liquidity.switchboard_oracle_pubkey, - reserve.account.config.extra_oracle_pubkey + reserve.account.config.extra_oracle_pubkey, ), ], None, @@ -949,7 +947,7 @@ impl Info { reserve.pubkey, reserve.account.liquidity.pyth_oracle_pubkey, reserve.account.liquidity.switchboard_oracle_pubkey, - reserve.account.config.extra_oracle_pubkey + reserve.account.config.extra_oracle_pubkey, ) }) .collect(); @@ -1076,7 +1074,7 @@ impl Info { reserve.pubkey, reserve.account.liquidity.pyth_oracle_pubkey, reserve.account.liquidity.switchboard_oracle_pubkey, - reserve.account.config.extra_oracle_pubkey + reserve.account.config.extra_oracle_pubkey, ), redeem_fees( solend_program::id(), diff --git a/token-lending/program/tests/init_reserve.rs b/token-lending/program/tests/init_reserve.rs index 33ed416c885..fc3754d3b76 100644 --- a/token-lending/program/tests/init_reserve.rs +++ b/token-lending/program/tests/init_reserve.rs @@ -1,7 +1,7 @@ #![cfg(feature = "test-bpf")] use crate::solend_program_test::PriceArgs; -use crate::solend_program_test::custom_scenario; + use crate::solend_program_test::BalanceChecker; use crate::solend_program_test::MintAccount; use crate::solend_program_test::MintSupplyChange; diff --git a/token-lending/program/tests/refresh_reserve.rs b/token-lending/program/tests/refresh_reserve.rs index 3401a0380e6..bb0ec1ec049 100644 --- a/token-lending/program/tests/refresh_reserve.rs +++ b/token-lending/program/tests/refresh_reserve.rs @@ -445,7 +445,7 @@ async fn test_use_price_weight() { #[tokio::test] async fn test_use_extra_oracle() { - let (mut test, lending_market, reserves, obligations, users, lending_market_owner) = + let (mut test, lending_market, reserves, _obligations, _users, lending_market_owner) = custom_scenario( &[ReserveArgs { mint: msol_mint::id(), @@ -610,7 +610,7 @@ async fn test_use_extra_oracle() { #[tokio::test] async fn test_use_extra_oracle_bad_cases() { - let (mut test, lending_market, reserves, obligations, users, lending_market_owner) = + let (mut test, lending_market, reserves, _obligations, _users, lending_market_owner) = custom_scenario( &[ReserveArgs { mint: msol_mint::id(), diff --git a/token-lending/program/tests/update_reserve_config.rs b/token-lending/program/tests/update_reserve_config.rs index 624a9380d90..97f63d2d41b 100644 --- a/token-lending/program/tests/update_reserve_config.rs +++ b/token-lending/program/tests/update_reserve_config.rs @@ -417,7 +417,7 @@ pub fn malicious_update_reserve_config( #[tokio::test] async fn test_add_extra_oracle() { - let (mut test, lending_market, reserves, obligations, users, lending_market_owner) = + let (mut test, lending_market, reserves, _obligations, _users, lending_market_owner) = custom_scenario( &[ReserveArgs { mint: msol_mint::id(), diff --git a/token-lending/sdk/src/oracles.rs b/token-lending/sdk/src/oracles.rs index c37c2b95f4e..7688a5feb82 100644 --- a/token-lending/sdk/src/oracles.rs +++ b/token-lending/sdk/src/oracles.rs @@ -26,7 +26,11 @@ pub fn get_oracle_type(extra_oracle_info: &AccountInfo) -> Result