Skip to content

Commit 87b0445

Browse files
committed
chore: fix warnings
1 parent 5a51547 commit 87b0445

File tree

7 files changed

+34
-32
lines changed

7 files changed

+34
-32
lines changed

src/agent/dashboard.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub fn build_dashboard_data(
255255
let price_global_metadata =
256256
global_metadata.price_accounts_metadata.remove(&price_key);
257257

258-
let price_identifier = Identifier::new(price_key.clone().to_bytes());
258+
let price_identifier = Identifier::new(price_key.to_bytes());
259259
let price_local_data = local_data.remove(&price_identifier);
260260

261261
prices.insert(
@@ -308,5 +308,5 @@ pub fn build_dashboard_data(
308308
"remaining_price_ids" => format!("{:?}", remaining_prices));
309309
}
310310

311-
return ret;
311+
ret
312312
}

src/agent/metrics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl ProductGlobalMetrics {
182182
}
183183

184184
pub fn update(&self, product_key: &Pubkey, maybe_symbol: Option<String>) {
185-
let symbol_string = maybe_symbol.unwrap_or(format!("unknown_{}", product_key.to_string()));
185+
let symbol_string = maybe_symbol.unwrap_or(format!("unknown_{}", product_key));
186186

187187
#[deny(unused_variables)]
188188
let Self { update_count } = self;
@@ -413,7 +413,7 @@ impl PriceLocalMetrics {
413413
update_count,
414414
} = self;
415415

416-
let price_key = Pubkey::new(price_id.to_bytes().as_slice());
416+
let price_key = Pubkey::from(price_id.to_bytes());
417417

418418
price
419419
.get_or_create(&PriceLocalLabels {

src/agent/pythd/adapter.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ impl Adapter {
257257
let subscription_id = self
258258
.handle_subscribe_price_sched(&account.parse()?, notify_price_sched_tx)
259259
.await;
260-
let res = self.send(result_tx, Ok(subscription_id));
261-
res
260+
self.send(result_tx, Ok(subscription_id))
262261
}
263262
Message::UpdatePrice {
264263
account,
@@ -618,7 +617,10 @@ mod tests {
618617
PublisherAccount,
619618
},
620619
},
621-
solana,
620+
solana::{
621+
self,
622+
network::Network,
623+
},
622624
store::{
623625
global,
624626
global::AllAccountsData,
@@ -1559,9 +1561,10 @@ mod tests {
15591561

15601562
// Return the account data to the adapter, from the global store
15611563
match test_adapter.global_store_lookup_rx.recv().await.unwrap() {
1562-
global::Lookup::LookupAllAccountsData { result_tx } => {
1563-
result_tx.send(Ok(get_all_accounts_data())).unwrap()
1564-
}
1564+
global::Lookup::LookupAllAccountsData {
1565+
network: Network::Primary,
1566+
result_tx,
1567+
} => result_tx.send(Ok(get_all_accounts_data())).unwrap(),
15651568
_ => panic!("Uexpected message received from adapter"),
15661569
};
15671570

@@ -1784,9 +1787,10 @@ mod tests {
17841787

17851788
// Return the account data to the adapter, from the global store
17861789
match test_adapter.global_store_lookup_rx.recv().await.unwrap() {
1787-
global::Lookup::LookupAllAccountsData { result_tx } => {
1788-
result_tx.send(Ok(get_all_accounts_data())).unwrap()
1789-
}
1790+
global::Lookup::LookupAllAccountsData {
1791+
network: Network::Primary,
1792+
result_tx,
1793+
} => result_tx.send(Ok(get_all_accounts_data())).unwrap(),
17901794
_ => panic!("Uexpected message received from adapter"),
17911795
};
17921796

src/agent/remote_keypair_loader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl RemoteKeypairLoader {
8989
config: Config,
9090
logger: Logger,
9191
) -> Vec<JoinHandle<()>> {
92-
let bind_address = config.bind_address.clone();
92+
let bind_address = config.bind_address;
9393

9494
let ip = bind_address.ip();
9595

@@ -181,7 +181,7 @@ impl RemoteKeypairLoader {
181181
);
182182

183183
// WARNING: All jobs spawned here must report their join handles in this vec
184-
return vec![request_handler_jh, http_api_jh];
184+
vec![request_handler_jh, http_api_jh]
185185
}
186186

187187
/// Validate and apply a keypair to the specified mut reference,

src/agent/solana/exporter.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ use {
3535
solana_client::{
3636
nonblocking::rpc_client::RpcClient,
3737
rpc_config::RpcSendTransactionConfig,
38-
rpc_response::RpcPrioritizationFee,
3938
},
4039
solana_sdk::{
41-
bs58,
4240
commitment_config::CommitmentConfig,
4341
compute_budget::ComputeBudgetInstruction,
4442
hash::Hash,
@@ -334,7 +332,7 @@ impl Exporter {
334332
let permissioned_updates = self.get_permissioned_updates().await?;
335333
let price_accounts = permissioned_updates
336334
.iter()
337-
.map(|(identifier, _)| Pubkey::new(&identifier.to_bytes()))
335+
.map(|(identifier, _)| Pubkey::from(identifier.to_bytes()))
338336
.collect::<Vec<_>>();
339337
self.recent_compute_unit_price_micro_lamports = self
340338
.estimate_compute_unit_price_micro_lamports(&price_accounts)
@@ -470,7 +468,7 @@ impl Exporter {
470468
Ok(fresh_updates
471469
.into_iter()
472470
.filter(|(id, _data)| {
473-
let key_from_id = Pubkey::new((*id).clone().to_bytes().as_slice());
471+
let key_from_id = Pubkey::from((*id).clone().to_bytes());
474472
if self.our_prices.contains(&key_from_id) {
475473
true
476474
} else {
@@ -628,7 +626,7 @@ impl Exporter {
628626
});
629627
let price_accounts = refreshed_batch
630628
.clone()
631-
.map(|(identifier, _)| Pubkey::new(&identifier.to_bytes()))
629+
.map(|(identifier, _)| Pubkey::from(identifier.to_bytes()))
632630
.collect::<Vec<_>>();
633631

634632
let network_state = *self.network_state_rx.borrow();
@@ -645,16 +643,16 @@ impl Exporter {
645643
{
646644
self.create_instruction_with_accumulator(
647645
publish_keypair.pubkey(),
648-
Pubkey::new(&identifier.to_bytes()),
649-
&price_info,
646+
Pubkey::from(identifier.to_bytes()),
647+
price_info,
650648
network_state.current_slot,
651649
accumulator_program_key,
652650
)?
653651
} else {
654652
self.create_instruction_without_accumulator(
655653
publish_keypair.pubkey(),
656-
Pubkey::new(&identifier.to_bytes()),
657-
&price_info,
654+
Pubkey::from(identifier.to_bytes()),
655+
price_info,
658656
network_state.current_slot,
659657
)?
660658
};

src/agent/solana/oracle.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn spawn_oracle(
148148
wss_url.to_string(),
149149
rpc_timeout,
150150
config.commitment,
151-
key_store.program_key.clone(),
151+
key_store.program_key,
152152
updates_tx,
153153
logger.clone(),
154154
);
@@ -322,7 +322,7 @@ impl Oracle {
322322
) -> Result<()> {
323323
self.global_store_tx
324324
.send(global::Update::ProductAccountUpdate {
325-
account_key: account_key.clone(),
325+
account_key: *account_key,
326326
account: account.clone(),
327327
})
328328
.await
@@ -336,8 +336,8 @@ impl Oracle {
336336
) -> Result<()> {
337337
self.global_store_tx
338338
.send(global::Update::PriceAccountUpdate {
339-
account_key: account_key.clone(),
340-
account: account.clone(),
339+
account_key: *account_key,
340+
account: *account,
341341
})
342342
.await
343343
.map_err(|_| anyhow!("failed to notify price account update"))
@@ -437,7 +437,7 @@ impl Poller {
437437
.entry(component.publisher)
438438
.or_insert(HashSet::new());
439439

440-
component_pub_entry.insert(price_key.clone());
440+
component_pub_entry.insert(*price_key);
441441
}
442442
}
443443

@@ -488,7 +488,7 @@ impl Poller {
488488
.iter()
489489
.filter(|pubkey| **pubkey != Pubkey::default())
490490
{
491-
product_keys.push(account_key.clone());
491+
product_keys.push(*account_key);
492492
}
493493
}
494494

@@ -578,7 +578,7 @@ impl Poller {
578578
}
579579

580580
if price.next != Pubkey::default() {
581-
next_todo.push(price.next.clone());
581+
next_todo.push(price.next);
582582
}
583583
} else {
584584
warn!(self.logger, "Could not look up price account on chain, skipping"; "price_key" => price_key.to_string(),);

src/bin/agent_migrate_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn main() -> Result<()> {
6666
eprintln!("Migration OK. Result:");
6767
std::io::stderr().flush()?;
6868

69-
println!("{}", doc.to_string());
69+
println!("{}", doc);
7070

7171
Ok(())
7272
}

0 commit comments

Comments
 (0)