clippy fixes

This commit is contained in:
TovarishFin 2024-06-12 14:53:19 +02:00
parent f750037166
commit 1009f856be
4 changed files with 9 additions and 11 deletions

View File

@ -77,9 +77,9 @@ pub fn try_parse_env() -> Result<ParsedConfig> {
let helius_url = env::var("HELIUS_URL")?;
let user_key = env::var("USER_KEY")?;
let urls_by_label_labels = env::var("URLS_BY_LABEL_LABELS")?;
let urls_by_label_labels: Vec<&str> = urls_by_label_labels.split(",").collect();
let urls_by_label_labels: Vec<&str> = urls_by_label_labels.split(',').collect();
let urls_by_label_urls = env::var("URLS_BY_LABEL_URLS")?;
let urls_by_label_urls: Vec<&str> = urls_by_label_urls.split(",").collect();
let urls_by_label_urls: Vec<&str> = urls_by_label_urls.split(',').collect();
if urls_by_label_urls.len() != urls_by_label_labels.len() {
bail!("urls_by_label_urls len != urls_by_label_labels len");
}
@ -119,5 +119,5 @@ pub fn setup() -> Result<ParsedConfig> {
.expect("DISCORD_WEBHOOK_URL previously unset");
}
return Ok(config);
Ok(config)
}

View File

@ -143,7 +143,7 @@ pub fn watch_slots_retry(
atomic_slot: Arc<AtomicU64>,
slot_notifier: Arc<Notify>,
) -> JoinHandle<()> {
let handle = tokio::spawn(async move {
tokio::spawn(async move {
loop {
let ps_url = ps_url.clone();
let a_slot = Arc::clone(&atomic_slot);
@ -156,9 +156,7 @@ pub fn watch_slots_retry(
}
}
}
});
handle
})
}
async fn send_and_confirm_self_transfer_tx(
@ -290,7 +288,7 @@ pub async fn watch_measure_txs(
.fold((0, 0), |(sum, count), diff| (sum + diff, count + 1));
let lifetime_avg = if count > 0 { sum / count } else { u64::MAX };
let lifetime_fails = fails_by_label.entry(label.clone()).or_insert(0).clone();
let lifetime_fails = *fails_by_label.entry(label.clone()).or_insert(0);
notify_results.push(WatchTxResult {
label: label.clone(),
@ -316,7 +314,7 @@ pub async fn watch_measure_txs(
.fold((0, 0), |(sum, count), diff| (sum + diff, count + 1));
let lifetime_avg = if count > 0 { sum / count } else { u64::MAX };
let lifetime_fails = fails_by_label.entry(label.clone()).or_insert(0).clone();
let lifetime_fails = *fails_by_label.entry(label.clone()).or_insert(0);
notify_results.push(WatchTxResult {
label: label.clone(),

View File

@ -133,7 +133,7 @@ pub async fn check(
"failed to complete all checks: {:?}",
incomplete_checks
.into_iter()
.map(|c| Into::<String>::into(c))
.map(Into::<String>::into)
.join(", ")
);
}

View File

@ -22,7 +22,7 @@ type Slot = u64;
pub async fn measure_slot_latency() -> Result<()> {
tracing_subscriber::fmt::init();
let ws_url1 = format!("wss://api.mainnet-beta.solana.com");
let ws_url1 = String::from("wss://api.mainnet-beta.solana.com");
let ws_url2 = format!(
"wss://mango.rpcpool.com/{MAINNET_API_TOKEN}",
MAINNET_API_TOKEN = std::env::var("MAINNET_API_TOKEN").unwrap()