Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
0xripleys committed Dec 15, 2023
1 parent f2db807 commit 68d64e0
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion token-lending/cli/src/lending_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}));

Expand Down
2 changes: 1 addition & 1 deletion token-lending/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}));

Expand Down
2 changes: 1 addition & 1 deletion token-lending/program/tests/helpers/mock_pyth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum MockPythInstruction {
expo: i32,
ema_price: i64,
ema_conf: u64,
}
},
}

pub fn process_instruction(
Expand Down
4 changes: 3 additions & 1 deletion token-lending/program/tests/helpers/mock_switchboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down
12 changes: 5 additions & 7 deletions token-lending/program/tests/helpers/solend_program_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -807,7 +805,7 @@ impl Info<LendingMarket> {
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(),
Expand Down Expand Up @@ -903,7 +901,7 @@ impl Info<LendingMarket> {
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,
Expand Down Expand Up @@ -949,7 +947,7 @@ impl Info<LendingMarket> {
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();
Expand Down Expand Up @@ -1076,7 +1074,7 @@ impl Info<LendingMarket> {
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(),
Expand Down
2 changes: 1 addition & 1 deletion token-lending/program/tests/init_reserve.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions token-lending/program/tests/refresh_reserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion token-lending/program/tests/update_reserve_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
6 changes: 5 additions & 1 deletion token-lending/sdk/src/oracles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ pub fn get_oracle_type(extra_oracle_info: &AccountInfo) -> Result<OracleType, Pr
return Ok(OracleType::Switchboard);
}

msg!("Could not find oracle type for {:?} with owner {:?}", extra_oracle_info.key, extra_oracle_info.owner);
msg!(
"Could not find oracle type for {:?} with owner {:?}",
extra_oracle_info.key,
extra_oracle_info.owner
);
Err(LendingError::InvalidOracleConfig.into())
}

Expand Down
1 change: 0 additions & 1 deletion token-lending/sdk/src/state/reserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,6 @@ mod test {

result: Err(LendingError::BorrowTooLarge.into()),
}),

// borrow enough where it would be fine if we were just using the market + ema price but
// not fine when using market + ema + extra price
Just(CalculateBorrowTestCase {
Expand Down

0 comments on commit 68d64e0

Please sign in to comment.