Skip to content

Commit 9524c9d

Browse files
committed
1 parent 9433c06 commit 9524c9d

File tree

214 files changed

+1307
-1863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+1307
-1863
lines changed

account-decoder/src/parse_account_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn parse_account_data(
119119
ParsableAccount::Vote => serde_json::to_value(parse_vote(data)?)?,
120120
};
121121
Ok(ParsedAccount {
122-
program: format!("{:?}", program_name).to_kebab_case(),
122+
program: format!("{program_name:?}").to_kebab_case(),
123123
parsed: parsed_json,
124124
space: data.len() as u64,
125125
})

accounts-bench/src/main.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ fn main() {
6060
let num_accounts = value_t!(matches, "num_accounts", usize).unwrap_or(10_000);
6161
let iterations = value_t!(matches, "iterations", usize).unwrap_or(20);
6262
let clean = matches.is_present("clean");
63-
println!("clean: {:?}", clean);
63+
println!("clean: {clean:?}");
6464

6565
let path = PathBuf::from(env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_owned()))
6666
.join("accounts-bench");
67-
println!("cleaning file system: {:?}", path);
67+
println!("cleaning file system: {path:?}");
6868
if fs::remove_dir_all(path.clone()).is_err() {
69-
println!("Warning: Couldn't remove {:?}", path);
69+
println!("Warning: Couldn't remove {path:?}");
7070
}
7171
let accounts = Accounts::new_with_config_for_benches(
7272
vec![path],
@@ -75,7 +75,7 @@ fn main() {
7575
false,
7676
AccountShrinkThreshold::default(),
7777
);
78-
println!("Creating {} accounts", num_accounts);
78+
println!("Creating {num_accounts} accounts");
7979
let mut create_time = Measure::start("create accounts");
8080
let pubkeys: Vec<_> = (0..num_slots)
8181
.into_par_iter()
@@ -112,7 +112,7 @@ fn main() {
112112
let mut time = Measure::start("clean");
113113
accounts.accounts_db.clean_accounts_for_tests();
114114
time.stop();
115-
println!("{}", time);
115+
println!("{time}");
116116
for slot in 0..num_slots {
117117
update_accounts_bench(&accounts, &pubkeys, ((x + 1) * num_slots + slot) as u64);
118118
accounts.add_root((x * num_slots + slot) as u64);

accounts-cluster-bench/src/main.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,20 @@ pub fn airdrop_lamports(
6767
}
6868
if tries >= 5 {
6969
panic!(
70-
"Error requesting airdrop: to addr: {:?} amount: {} {:?}",
71-
faucet_addr, airdrop_amount, result
70+
"Error requesting airdrop: to addr: {faucet_addr:?} amount: {airdrop_amount} {result:?}"
7271
)
7372
}
7473
}
7574
}
7675
Err(err) => {
7776
panic!(
78-
"Error requesting airdrop: {:?} to addr: {:?} amount: {}",
79-
err, faucet_addr, airdrop_amount
77+
"Error requesting airdrop: {err:?} to addr: {faucet_addr:?} amount: {airdrop_amount}"
8078
);
8179
}
8280
};
8381

8482
let current_balance = client.get_balance(&id.pubkey()).unwrap_or_else(|e| {
85-
panic!("airdrop error {}", e);
83+
panic!("airdrop error {e}");
8684
});
8785
info!("current balance {}...", current_balance);
8886

@@ -575,14 +573,14 @@ fn main() {
575573
let mut entrypoint_addr = SocketAddr::from(([127, 0, 0, 1], port));
576574
if let Some(addr) = matches.value_of("entrypoint") {
577575
entrypoint_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
578-
eprintln!("failed to parse entrypoint address: {}", e);
576+
eprintln!("failed to parse entrypoint address: {e}");
579577
exit(1)
580578
});
581579
}
582580
let mut faucet_addr = SocketAddr::from(([127, 0, 0, 1], FAUCET_PORT));
583581
if let Some(addr) = matches.value_of("faucet_addr") {
584582
faucet_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
585-
eprintln!("failed to parse entrypoint address: {}", e);
583+
eprintln!("failed to parse entrypoint address: {e}");
586584
exit(1)
587585
});
588586
}
@@ -594,7 +592,7 @@ fn main() {
594592
let iterations = value_t!(matches, "iterations", usize).unwrap_or(10);
595593
let num_instructions = value_t!(matches, "num_instructions", usize).unwrap_or(1);
596594
if num_instructions == 0 || num_instructions > 500 {
597-
eprintln!("bad num_instructions: {}", num_instructions);
595+
eprintln!("bad num_instructions: {num_instructions}");
598596
exit(1);
599597
}
600598

@@ -604,7 +602,7 @@ fn main() {
604602
.iter()
605603
.map(|keypair_string| {
606604
read_keypair_file(keypair_string)
607-
.unwrap_or_else(|_| panic!("bad keypair {:?}", keypair_string))
605+
.unwrap_or_else(|_| panic!("bad keypair {keypair_string:?}"))
608606
})
609607
.collect();
610608
let mut payer_keypair_refs: Vec<&Keypair> = vec![];
@@ -626,7 +624,7 @@ fn main() {
626624
SocketAddrSpace::Unspecified,
627625
)
628626
.unwrap_or_else(|err| {
629-
eprintln!("Failed to discover {} node: {:?}", entrypoint_addr, err);
627+
eprintln!("Failed to discover {entrypoint_addr} node: {err:?}");
630628
exit(1);
631629
});
632630

banking-bench/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ fn main() {
384384
.iter()
385385
.for_each(|tx| {
386386
let res = bank.process_transaction(tx);
387-
assert!(res.is_ok(), "sanity test transactions error: {:?}", res);
387+
assert!(res.is_ok(), "sanity test transactions error: {res:?}");
388388
});
389389
});
390390
bank.clear_signatures();
@@ -395,7 +395,7 @@ fn main() {
395395
let res =
396396
bank.process_transactions(packets_for_single_iteration.transactions.iter());
397397
for r in res {
398-
assert!(r.is_ok(), "sanity parallel execution error: {:?}", r);
398+
assert!(r.is_ok(), "sanity parallel execution error: {r:?}");
399399
}
400400
bank.clear_signatures();
401401
});

bench-tps/src/bench_tps_client/bank_client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl BenchTpsClient for BankClient {
8989
.map_err(|err| err.into())
9090
.and_then(|account| {
9191
account.ok_or_else(|| {
92-
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
92+
BenchTpsError::Custom(format!("AccountNotFound: pubkey={pubkey}"))
9393
})
9494
})
9595
}
@@ -103,7 +103,7 @@ impl BenchTpsClient for BankClient {
103103
.map_err(|err| err.into())
104104
.and_then(|account| {
105105
account.ok_or_else(|| {
106-
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
106+
BenchTpsError::Custom(format!("AccountNotFound: pubkey={pubkey}"))
107107
})
108108
})
109109
}

bench-tps/src/bench_tps_client/rpc_client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl BenchTpsClient for RpcClient {
9595
.map_err(|err| err.into())
9696
.and_then(|account| {
9797
account.ok_or_else(|| {
98-
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
98+
BenchTpsError::Custom(format!("AccountNotFound: pubkey={pubkey}"))
9999
})
100100
})
101101
}

bench-tps/src/bench_tps_client/thin_client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl BenchTpsClient for ThinClient {
100100
.map_err(|err| err.into())
101101
.and_then(|account| {
102102
account.ok_or_else(|| {
103-
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
103+
BenchTpsError::Custom(format!("AccountNotFound: pubkey={pubkey}"))
104104
})
105105
})
106106
}

bench-tps/src/bench_tps_client/tpu_client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl BenchTpsClient for TpuClient {
112112
.map_err(|err| err.into())
113113
.and_then(|account| {
114114
account.ok_or_else(|| {
115-
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
115+
BenchTpsError::Custom(format!("AccountNotFound: pubkey={pubkey}"))
116116
})
117117
})
118118
}

bench-tps/src/cli.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ pub fn extract_args(matches: &ArgMatches) -> Config {
400400

401401
if let Some(addr) = matches.value_of("entrypoint") {
402402
args.entrypoint_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
403-
eprintln!("failed to parse entrypoint address: {}", e);
403+
eprintln!("failed to parse entrypoint address: {e}");
404404
exit(1)
405405
});
406406
}

bench-tps/src/keypairs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ where
5858
last_balance,
5959
)
6060
.unwrap_or_else(|e| {
61-
eprintln!("Error could not fund keys: {:?}", e);
61+
eprintln!("Error could not fund keys: {e:?}");
6262
exit(1);
6363
});
6464
keypairs
6565
} else {
6666
generate_and_fund_keypairs(client, id, keypair_count, num_lamports_per_account)
6767
.unwrap_or_else(|e| {
68-
eprintln!("Error could not fund keys: {:?}", e);
68+
eprintln!("Error could not fund keys: {e:?}");
6969
exit(1);
7070
})
7171
}

bench-tps/src/main.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,15 @@ fn create_client(
6262
let nodes =
6363
discover_cluster(entrypoint_addr, num_nodes, SocketAddrSpace::Unspecified)
6464
.unwrap_or_else(|err| {
65-
eprintln!("Failed to discover {} nodes: {:?}", num_nodes, err);
65+
eprintln!("Failed to discover {num_nodes} nodes: {err:?}");
6666
exit(1);
6767
});
6868
if multi_client {
6969
let (client, num_clients) =
7070
get_multi_client(&nodes, &SocketAddrSpace::Unspecified, connection_cache);
7171
if nodes.len() < num_clients {
7272
eprintln!(
73-
"Error: Insufficient nodes discovered. Expecting {} or more",
74-
num_nodes
73+
"Error: Insufficient nodes discovered. Expecting {num_nodes} or more"
7574
);
7675
exit(1);
7776
}
@@ -90,7 +89,7 @@ fn create_client(
9089
}
9190
}
9291
Arc::new(target_client.unwrap_or_else(|| {
93-
eprintln!("Target node {} not found", target_node);
92+
eprintln!("Target node {target_node} not found");
9493
exit(1);
9594
}))
9695
} else {
@@ -120,7 +119,7 @@ fn create_client(
120119
Arc::new(connection_cache),
121120
)
122121
.unwrap_or_else(|err| {
123-
eprintln!("Could not create TpuClient {:?}", err);
122+
eprintln!("Could not create TpuClient {err:?}");
124123
exit(1);
125124
}),
126125
)
@@ -198,14 +197,14 @@ fn main() {
198197
let rpc_tpu_sockets: Option<(SocketAddr, SocketAddr)> =
199198
if let Ok(rpc_addr) = value_t!(matches, "rpc_addr", String) {
200199
let rpc = rpc_addr.parse().unwrap_or_else(|e| {
201-
eprintln!("RPC address should parse as socketaddr {:?}", e);
200+
eprintln!("RPC address should parse as socketaddr {e:?}");
202201
exit(1);
203202
});
204203
let tpu = value_t!(matches, "tpu_addr", String)
205204
.unwrap()
206205
.parse()
207206
.unwrap_or_else(|e| {
208-
eprintln!("TPU address should parse to a socket: {:?}", e);
207+
eprintln!("TPU address should parse to a socket: {e:?}");
209208
exit(1);
210209
});
211210
Some((rpc, tpu))

bloom/src/bloom.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,15 @@ mod test {
308308
let mut b: Bloom<Hash> = Bloom::new(3, vec![100]);
309309
b.add(&Hash::default());
310310
assert_eq!(
311-
format!("{:?}", b),
311+
format!("{b:?}"),
312312
"Bloom { keys.len: 1 bits.len: 3 num_set: 1 bits: 001 }"
313313
);
314314

315315
let mut b: Bloom<Hash> = Bloom::new(1000, vec![100]);
316316
b.add(&Hash::default());
317317
b.add(&hash(&[1, 2]));
318318
assert_eq!(
319-
format!("{:?}", b),
319+
format!("{b:?}"),
320320
"Bloom { keys.len: 1 bits.len: 1000 num_set: 2 bits: 0000000000.. }"
321321
);
322322
}
@@ -345,7 +345,7 @@ mod test {
345345
.take(10_000)
346346
.filter(|hash_value| bloom.contains(hash_value))
347347
.count();
348-
assert!(false_positive < 2_000, "false_positive: {}", false_positive);
348+
assert!(false_positive < 2_000, "false_positive: {false_positive}");
349349
}
350350

351351
#[test]
@@ -360,7 +360,7 @@ mod test {
360360
bloom.add(hash_value);
361361
}
362362
let num_bits_set = bloom.num_bits_set;
363-
assert!(num_bits_set > 2000, "# bits set: {}", num_bits_set);
363+
assert!(num_bits_set > 2000, "# bits set: {num_bits_set}");
364364
// Round-trip with no inserts.
365365
let bloom: AtomicBloom<_> = bloom.into();
366366
assert_eq!(bloom.num_bits, 9731);
@@ -408,7 +408,7 @@ mod test {
408408
.take(10_000)
409409
.filter(|hash_value| bloom.contains(hash_value))
410410
.count();
411-
assert!(false_positive < 2000, "false_positive: {}", false_positive);
411+
assert!(false_positive < 2000, "false_positive: {false_positive}");
412412
let bloom: Bloom<_> = bloom.into();
413413
assert_eq!(bloom.bits.len(), 9731);
414414
assert!(bloom.num_bits_set > num_bits_set);
@@ -427,7 +427,7 @@ mod test {
427427
.take(10_000)
428428
.filter(|hash_value| bloom.contains(hash_value))
429429
.count();
430-
assert!(false_positive < 2000, "false_positive: {}", false_positive);
430+
assert!(false_positive < 2000, "false_positive: {false_positive}");
431431
// Assert that the bits vector precisely match if no atomic ops were
432432
// used.
433433
let bits = bloom.bits;

bucket_map/src/bucket_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ mod tests {
559559
map.insert(&k, (&v, rc))
560560
} else {
561561
map.update(&k, |current| {
562-
assert_eq!(current, v_old.map(|(v, rc)| (&v[..], *rc)), "{}", k);
562+
assert_eq!(current, v_old.map(|(v, rc)| (&v[..], *rc)), "{k}");
563563
Some((v.clone(), rc))
564564
})
565565
}

clap-utils/src/input_parsers.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ mod tests {
219219
use std::env;
220220
let out_dir = env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
221221

222-
format!("{}/tmp/{}-{}", out_dir, name, pubkey)
222+
format!("{out_dir}/tmp/{name}-{pubkey}")
223223
}
224224

225225
#[test]
@@ -338,8 +338,8 @@ mod tests {
338338
let key2 = solana_sdk::pubkey::new_rand();
339339
let sig1 = Keypair::new().sign_message(&[0u8]);
340340
let sig2 = Keypair::new().sign_message(&[1u8]);
341-
let signer1 = format!("{}={}", key1, sig1);
342-
let signer2 = format!("{}={}", key2, sig2);
341+
let signer1 = format!("{key1}={sig1}");
342+
let signer2 = format!("{key2}={sig2}");
343343
let matches = app().clone().get_matches_from(vec![
344344
"test",
345345
"--multiple",

0 commit comments

Comments
 (0)