Skip to content

Commit

Permalink
fix: Run clippy --fix
Browse files Browse the repository at this point in the history
Signed-off-by: Denton X <[email protected]>
  • Loading branch information
exdx committed Apr 5, 2024
1 parent 5904518 commit da203eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/state_engine/engine.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use solana_account_decoder::UiAccountEncoding;
use solana_account_decoder::UiDataSliceConfig;
use solana_sdk::bs58;
use std::{str::FromStr, sync::Arc};
use std::sync::Arc;

use anchor_client::anchor_lang::AccountDeserialize;
use anchor_client::anchor_lang::Discriminator;
Expand Down Expand Up @@ -211,7 +211,7 @@ impl StateEngineService {
.entry(*bank_address)
.and_modify(|bank_entry| match bank_entry.try_write() {
Ok(mut bank_wg) => {
bank_wg.bank = bank.clone();
bank_wg.bank = *bank;
}
Err(e) => {
error!("Failed to acquire write lock on bank: {}", e);
Expand All @@ -220,7 +220,7 @@ impl StateEngineService {
.or_insert_with(|| {
Arc::new(RwLock::new(BankWrapper::new(
*bank_address,
bank.clone(),
*bank,
OracleWrapper::new(
**oracle_address,
OraclePriceFeedAdapter::try_from_bank_config(
Expand Down Expand Up @@ -281,7 +281,7 @@ impl StateEngineService {
.entry(*bank_address)
.and_modify(|bank_entry| {
if let Ok(mut bank_entry) = bank_entry.try_write() {
bank_entry.bank = bank.clone();
bank_entry.bank = *bank;
} else {
warn!("Failed to acquire write lock on bank, bank update skipped");
}
Expand All @@ -297,7 +297,7 @@ impl StateEngineService {

Arc::new(RwLock::new(BankWrapper::new(
*bank_address,
bank.clone(),
*bank,
OracleWrapper::new(
oracle_address,
OraclePriceFeedAdapter::try_from_bank_config(
Expand Down Expand Up @@ -327,7 +327,7 @@ impl StateEngineService {
for mint in bank_mints.iter() {
let ata = spl_associated_token_account::get_associated_token_address(
&self.config.signer_pubkey,
&mint,
mint,
);
token_account_addresses.push(ata);
}
Expand Down Expand Up @@ -508,7 +508,7 @@ impl StateEngineService {
.entry(*marginfi_account_address)
.and_modify(|marginfi_account_ref| {
let marginfi_account_ref = Arc::clone(marginfi_account_ref);
let marginfi_account_updated = marginfi_account.clone();
let marginfi_account_updated = *marginfi_account;
tokio::spawn(async move {
let mut marginfi_account_guard = marginfi_account_ref.write().await;
marginfi_account_guard.account = marginfi_account_updated;
Expand All @@ -517,7 +517,7 @@ impl StateEngineService {
.or_insert_with(|| {
Arc::new(RwLock::new(MarginfiAccountWrapper::new(
*marginfi_account_address,
marginfi_account.clone(),
*marginfi_account,
Vec::new(),
)))
});
Expand All @@ -529,7 +529,7 @@ impl StateEngineService {
let marginfi_accounts = self.marginfi_accounts.clone();
for account_ref in marginfi_accounts.iter() {
let account = account_ref.value().read().await;
let marginfi_account = account.account.clone(); // clone the underlying data
let marginfi_account = account.account; // clone the underlying data
let address = account.address; // get the address from the account

let update_tasks = self.update_tasks.lock().await;
Expand Down
10 changes: 5 additions & 5 deletions src/state_engine/geyser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl GeyserService {
if let Ok(account_owner_pk) = Pubkey::try_from(account.owner.clone()) {
if account_owner_pk == state_engine.get_marginfi_program_id() {
let maybe_update =
Self::process_marginfi_account_update(state_engine, &account)?;
Self::process_marginfi_account_update(state_engine, account)?;
if let Some(update) = maybe_update {
geyser_update_request.merge(update);
}
Expand All @@ -173,12 +173,12 @@ impl GeyserService {

if let Ok(address) = Pubkey::try_from(account.pubkey.clone()) {
if state_engine.is_tracked_oracle(&address) {
Self::process_oracle_account_update(state_engine, &account)?;
Self::process_oracle_account_update(state_engine, account)?;
processed = true;
}

if state_engine.is_tracked_token_account(&address) {
Self::process_token_account_update(state_engine, &account)?;
Self::process_token_account_update(state_engine, account)?;
processed = true;
}
}
Expand Down Expand Up @@ -252,8 +252,8 @@ impl GeyserService {
Ok(())
}
fn process_token_account_update(
state_engine: &Arc<StateEngineService>,
account_update: &SubscribeUpdateAccountInfo,
_state_engine: &Arc<StateEngineService>,
_account_update: &SubscribeUpdateAccountInfo,
) -> Result<(), GeyserServiceError> {
Ok(())
}
Expand Down

0 comments on commit da203eb

Please sign in to comment.