From 4b35cd04e499ad1d7f71f392a599bce1fdc9c294 Mon Sep 17 00:00:00 2001 From: J Date: Wed, 17 Jul 2024 10:25:02 +0200 Subject: [PATCH] fix: clippy --- src/liquidator.rs | 5 +---- src/transaction_manager.rs | 15 +++++---------- src/wrappers/liquidator_account.rs | 8 ++++---- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/liquidator.rs b/src/liquidator.rs index 36291b0..bd6c5ff 100644 --- a/src/liquidator.rs +++ b/src/liquidator.rs @@ -10,10 +10,7 @@ use crate::{ }; use anchor_client::Program; use anchor_lang::Discriminator; -use crossbeam::{ - channel::{Receiver, Sender}, - epoch::Atomic, -}; +use crossbeam::channel::{Receiver, Sender}; use fixed::types::I80F48; use fixed_macro::types::I80F48; use log::{debug, error, info}; diff --git a/src/transaction_manager.rs b/src/transaction_manager.rs index 3a78dcb..25a3d90 100644 --- a/src/transaction_manager.rs +++ b/src/transaction_manager.rs @@ -1,13 +1,11 @@ use crate::config::GeneralConfig; -use core::panic; use crossbeam::channel::Receiver; use jito_protos::searcher::{ searcher_service_client::SearcherServiceClient, GetTipAccountsRequest, NextScheduledLeaderRequest, SubscribeBundleResultsRequest, }; use jito_searcher_client::{get_searcher_client_no_auth, send_bundle_with_confirmation}; -use log::{error, info}; -use rayon::iter::IntoParallelRefIterator; +use log::error; use solana_address_lookup_table_program::state::AddressLookupTable; use solana_client::{ nonblocking::rpc_client::RpcClient, rpc_client::RpcClient as NonBlockRpc, @@ -24,12 +22,9 @@ use solana_sdk::{ system_instruction::transfer, transaction::VersionedTransaction, }; -use std::{ - collections::{HashMap, HashSet}, - sync::{ - atomic::{AtomicBool, Ordering}, - Arc, - }, +use std::sync::{ + atomic::{AtomicBool, Ordering}, + Arc, }; use std::{error::Error, str::FromStr}; use tonic::transport::Channel; @@ -136,7 +131,7 @@ impl TransactionManager { tokio::time::sleep(SLEEP_DURATION).await; } for tx in transactions { - let mut transaction = Self::send_transaction( + let transaction = Self::send_transaction( tx.clone(), self.searcher_client.clone(), self.rpc.clone(), diff --git a/src/wrappers/liquidator_account.rs b/src/wrappers/liquidator_account.rs index e6f4f0d..506f338 100644 --- a/src/wrappers/liquidator_account.rs +++ b/src/wrappers/liquidator_account.rs @@ -110,7 +110,7 @@ impl LiquidatorAccount { bank_liquidaity_vault_authority, bank_liquidaity_vault, bank_insurante_vault, - self.token_program_per_mint.get(&liab_mint).unwrap().clone(), + *self.token_program_per_mint.get(&liab_mint).unwrap(), liquidator_observation_accounts, liquidatee_observation_accounts, asset_bank.bank.config.oracle_keys[0], @@ -148,7 +148,7 @@ impl LiquidatorAccount { .get_observation_accounts(&[], &banks_to_exclude, banks); let mint = bank.bank.mint; - let token_program = self.token_program_per_mint.get(&mint).unwrap().clone(); + let token_program = *self.token_program_per_mint.get(&mint).unwrap(); let withdraw_ix = make_withdraw_ix( self.program_id, @@ -189,7 +189,7 @@ impl LiquidatorAccount { let signer_pk = self.signer_keypair.pubkey(); let mint = bank.bank.mint; - let token_program = self.token_program_per_mint.get(&mint).unwrap().clone(); + let token_program = *self.token_program_per_mint.get(&mint).unwrap(); let repay_ix = make_repay_ix( self.program_id, @@ -222,7 +222,7 @@ impl LiquidatorAccount { let signer_pk = self.signer_keypair.pubkey(); let mint = bank.bank.mint; - let token_program = self.token_program_per_mint.get(&mint).unwrap().clone(); + let token_program = *self.token_program_per_mint.get(&mint).unwrap(); let deposit_ix = make_deposit_ix( self.program_id,