forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 1k
clippy: uninlined_format_args #6854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,10 +61,7 @@ pub fn poll_slot_height(client: &RpcClient) -> Slot { | |
| return slot; | ||
| } else { | ||
| num_retries -= 1; | ||
| warn!( | ||
| "get_slot_height failure: {:?}. remaining retries {}", | ||
| response, num_retries | ||
| ); | ||
| warn!("get_slot_height failure: {response:?}. remaining retries {num_retries}"); | ||
| } | ||
| if num_retries == 0 { | ||
| panic!("failed to get_slot_height(), rpc node down?") | ||
|
|
@@ -81,10 +78,7 @@ pub fn poll_get_latest_blockhash(client: &RpcClient) -> Option<Hash> { | |
| return Some(blockhash); | ||
| } else { | ||
| num_retries -= 1; | ||
| warn!( | ||
| "get_latest_blockhash failure: {:?}. remaining retries {}", | ||
| response, num_retries | ||
| ); | ||
| warn!("get_latest_blockhash failure: {response:?}. remaining retries {num_retries}"); | ||
| } | ||
| if num_retries == 0 { | ||
| panic!("failed to get_latest_blockhash(), rpc node down?") | ||
|
|
@@ -102,10 +96,7 @@ pub fn poll_get_fee_for_message(client: &RpcClient, message: &mut Message) -> (O | |
| return (Some(fee), message.recent_blockhash); | ||
| } else { | ||
| num_retries -= 1; | ||
| warn!( | ||
| "get_fee_for_message failure: {:?}. remaining retries {}", | ||
| response, num_retries | ||
| ); | ||
| warn!("get_fee_for_message failure: {response:?}. remaining retries {num_retries}"); | ||
|
|
||
| let blockhash = poll_get_latest_blockhash(client).expect("blockhash"); | ||
| message.recent_blockhash = blockhash; | ||
|
|
@@ -119,7 +110,7 @@ pub fn poll_get_fee_for_message(client: &RpcClient, message: &mut Message) -> (O | |
|
|
||
| fn airdrop_lamports(client: &RpcClient, id: &Keypair, desired_balance: u64) -> bool { | ||
| let starting_balance = client.get_balance(&id.pubkey()).unwrap_or(0); | ||
| info!("starting balance {}", starting_balance); | ||
| info!("starting balance {starting_balance}"); | ||
|
|
||
| if starting_balance < desired_balance { | ||
| let airdrop_amount = desired_balance - starting_balance; | ||
|
|
@@ -143,7 +134,7 @@ fn airdrop_lamports(client: &RpcClient, id: &Keypair, desired_balance: u64) -> b | |
| let current_balance = client.get_balance(&id.pubkey()).unwrap_or_else(|e| { | ||
| panic!("airdrop error {e}"); | ||
| }); | ||
| info!("current balance {}...", current_balance); | ||
| info!("current balance {current_balance}..."); | ||
|
|
||
| if current_balance - starting_balance != airdrop_amount { | ||
| info!( | ||
|
|
@@ -396,10 +387,10 @@ fn process_get_multiple_accounts( | |
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| stats.errors += 1; | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("error: {:?}", e); | ||
| info!("error: {e:?}"); | ||
| *last_error = Instant::now(); | ||
| } | ||
| debug!("error: {:?}", e); | ||
| debug!("error: {e:?}"); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -519,7 +510,7 @@ fn run_rpc_bench_loop( | |
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| stats.errors += 1; | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get_account_info error: {:?}", e); | ||
| info!("get_account_info error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -545,7 +536,7 @@ fn run_rpc_bench_loop( | |
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| stats.errors += 1; | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get_block error: {:?}", e); | ||
| info!("get_block error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -569,7 +560,7 @@ fn run_rpc_bench_loop( | |
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| stats.errors += 1; | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get_blocks error: {:?}", e); | ||
| info!("get_blocks error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -588,7 +579,7 @@ fn run_rpc_bench_loop( | |
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| stats.errors += 1; | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get_first_available_block error: {:?}", e); | ||
| info!("get_first_available_block error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -607,7 +598,7 @@ fn run_rpc_bench_loop( | |
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| stats.errors += 1; | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get_slot error: {:?}", e); | ||
| info!("get_slot error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -626,7 +617,7 @@ fn run_rpc_bench_loop( | |
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| stats.errors += 1; | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get_token_supply error: {:?}", e); | ||
| info!("get_token_supply error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -659,7 +650,7 @@ fn run_rpc_bench_loop( | |
| stats.errors += 1; | ||
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get-program-accounts error: {:?}", e); | ||
| info!("get-program-accounts error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -679,7 +670,7 @@ fn run_rpc_bench_loop( | |
| stats.errors += 1; | ||
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get-token-accounts-by-delegate error: {:?}", e); | ||
| info!("get-token-accounts-by-delegate error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -699,7 +690,7 @@ fn run_rpc_bench_loop( | |
| stats.errors += 1; | ||
| stats.total_errors_time_us += rpc_time.as_us(); | ||
| if last_error.elapsed().as_secs() > 2 { | ||
| info!("get-token-accounts-by-owner error: {:?}", e); | ||
| info!("get-token-accounts-by-owner error: {e:?}"); | ||
| last_error = Instant::now(); | ||
| } | ||
| } | ||
|
|
@@ -781,7 +772,7 @@ fn make_rpc_bench_threads( | |
| let transaction_signature_tracker = transaction_signature_tracker.clone(); | ||
| let mint = *mint; | ||
| Builder::new() | ||
| .name(format!("rpc-bench-{}", thread)) | ||
| .name(format!("rpc-bench-{thread}")) | ||
| .spawn(move || { | ||
| start_bench.wait(); | ||
| run_rpc_bench_loop( | ||
|
|
@@ -853,7 +844,7 @@ fn run_accounts_bench( | |
| let transaction_signature_tracker = | ||
| TransactionSignatureTracker(Arc::new(RwLock::new(VecDeque::with_capacity(5000)))); | ||
|
|
||
| info!("Starting balance(s): {:?}", balances); | ||
| info!("Starting balance(s): {balances:?}"); | ||
|
|
||
| let executor = TransactionExecutor::new_with_rpc_client(client.clone()); | ||
|
|
||
|
|
@@ -917,10 +908,7 @@ fn run_accounts_bench( | |
| } | ||
| last_balance = Instant::now(); | ||
| if *balance < lamports * 2 { | ||
| info!( | ||
| "Balance {} is less than needed: {}, doing airdrop...", | ||
| balance, lamports | ||
| ); | ||
| info!("Balance {balance} is less than needed: {lamports}, doing airdrop..."); | ||
| if !airdrop_lamports(&client, payer_keypairs[i], lamports * 100_000) { | ||
| warn!("failed airdrop, exiting"); | ||
| return; | ||
|
|
@@ -934,7 +922,7 @@ fn run_accounts_bench( | |
| if sigs_len < batch_size { | ||
| let num_to_create = batch_size - sigs_len; | ||
| if num_to_create >= payer_keypairs.len() { | ||
| info!("creating {} new", num_to_create); | ||
| info!("creating {num_to_create} new"); | ||
| let chunk_size = num_to_create / payer_keypairs.len(); | ||
| if chunk_size > 0 { | ||
| for (i, keypair) in payer_keypairs.iter().enumerate() { | ||
|
|
@@ -1018,8 +1006,7 @@ fn run_accounts_bench( | |
| || max_accounts_met | ||
| { | ||
| info!( | ||
| "total_accounts_created: {} total_accounts_closed: {} tx_sent_count: {} loop_count: {} balance(s): {:?}", | ||
| total_accounts_created, total_accounts_closed, tx_sent_count, count, balances | ||
| "total_accounts_created: {total_accounts_created} total_accounts_closed: {total_accounts_closed} tx_sent_count: {tx_sent_count} loop_count: {count} balance(s): {balances:?}" | ||
| ); | ||
| last_log = Instant::now(); | ||
| } | ||
|
|
@@ -1061,9 +1048,9 @@ fn run_accounts_bench( | |
| (max_created_seed - max_closed_seed) as usize, | ||
| ); | ||
| if num_to_close >= payer_keypairs.len() { | ||
| info!("closing {} accounts", num_to_close); | ||
| info!("closing {num_to_close} accounts"); | ||
| let chunk_size = num_to_close / payer_keypairs.len(); | ||
| info!("{:?} chunk_size", chunk_size); | ||
| info!("{chunk_size:?} chunk_size"); | ||
| if chunk_size > 0 { | ||
| for (i, keypair) in payer_keypairs.iter().enumerate() { | ||
| let txs: Vec<_> = (0..chunk_size) | ||
|
|
@@ -1101,8 +1088,7 @@ fn run_accounts_bench( | |
| count += 1; | ||
| if last_log.elapsed().as_millis() > 3000 || max_closed_seed >= max_created_seed { | ||
| info!( | ||
| "total_accounts_closed: {} tx_sent_count: {} loop_count: {} balance(s): {:?}", | ||
| total_accounts_closed, tx_sent_count, count, balances | ||
| "total_accounts_closed: {total_accounts_closed} tx_sent_count: {tx_sent_count} loop_count: {count} balance(s): {balances:?}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Longer than 100 characters now, where as it wasn't before. |
||
| ); | ||
| last_log = Instant::now(); | ||
| } | ||
|
|
@@ -1333,7 +1319,7 @@ fn main() { | |
| Some( | ||
| solana_net_utils::get_cluster_shred_version(&entrypoint_addr).unwrap_or_else( | ||
| |err| { | ||
| eprintln!("Failed to get shred version: {}", err); | ||
| eprintln!("Failed to get shred version: {err}"); | ||
| exit(1); | ||
| }, | ||
| ), | ||
|
|
@@ -1344,7 +1330,7 @@ fn main() { | |
| }; | ||
|
|
||
| let rpc_addr = if !skip_gossip { | ||
| info!("Finding cluster entry: {:?}", entrypoint_addr); | ||
| info!("Finding cluster entry: {entrypoint_addr:?}"); | ||
| let (gossip_nodes, _validators) = discover( | ||
| None, // keypair | ||
| Some(&entrypoint_addr), | ||
|
|
@@ -1364,7 +1350,7 @@ fn main() { | |
| info!("done found {} nodes", gossip_nodes.len()); | ||
| gossip_nodes[0].rpc().unwrap() | ||
| } else { | ||
| info!("Using {:?} as the RPC address", entrypoint_addr); | ||
| info!("Using {entrypoint_addr:?} as the RPC address"); | ||
| entrypoint_addr | ||
| }; | ||
|
|
||
|
|
@@ -1500,7 +1486,7 @@ pub mod test { | |
| ); | ||
| let post_txs = client.get_transaction_count().unwrap(); | ||
| start.stop(); | ||
| info!("{} pre {} post {}", start, pre_txs, post_txs); | ||
| info!("{start} pre {pre_txs} post {post_txs}"); | ||
| } | ||
|
|
||
| #[test] | ||
|
|
@@ -1550,7 +1536,7 @@ pub mod test { | |
| ); | ||
| let post_txs = client.get_transaction_count().unwrap(); | ||
| start.stop(); | ||
| info!("{} pre {} post {}", start, pre_txs, post_txs); | ||
| info!("{start} pre {pre_txs} post {post_txs}"); | ||
| } | ||
|
|
||
| #[test] | ||
|
|
@@ -1649,6 +1635,6 @@ pub mod test { | |
| 0, | ||
| ); | ||
| start.stop(); | ||
| info!("{}", start); | ||
| info!("{start}"); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2048,7 +2048,7 @@ impl AccountsDb { | |||||
| MarkAccountsObsolete::No, | ||||||
| ); | ||||||
| measure.stop(); | ||||||
| debug!("{}", measure); | ||||||
| debug!("{measure}"); | ||||||
| self.clean_accounts_stats | ||||||
| .clean_old_root_reclaim_us | ||||||
| .fetch_add(measure.as_us(), Ordering::Relaxed); | ||||||
|
|
@@ -3757,7 +3757,7 @@ impl AccountsDb { | |||||
| } | ||||||
| let mut unique_accounts = | ||||||
| self.get_unique_accounts_from_storage_for_shrink(&store, &self.shrink_stats); | ||||||
| debug!("do_shrink_slot_store: slot: {}", slot); | ||||||
| debug!("do_shrink_slot_store: slot: {slot}"); | ||||||
| let shrink_collect = self.shrink_collect::<AliveAccounts<'_>>( | ||||||
| &store, | ||||||
| &mut unique_accounts, | ||||||
|
|
@@ -3939,7 +3939,7 @@ impl AccountsDb { | |||||
| // Reads all accounts in given slot's AppendVecs and filter only to alive, | ||||||
| // then create a minimum AppendVec filled with the alive. | ||||||
| fn shrink_slot_forced(&self, slot: Slot) { | ||||||
| debug!("shrink_slot_forced: slot: {}", slot); | ||||||
| debug!("shrink_slot_forced: slot: {slot}"); | ||||||
|
|
||||||
| if let Some(store) = self | ||||||
| .storage | ||||||
|
|
@@ -6767,7 +6767,7 @@ impl AccountsDb { | |||||
| .filter_map(|r| r.as_ref().err()) | ||||||
| .next() | ||||||
| { | ||||||
| panic!("failed generating accounts hash files: {:?}", err); | ||||||
| panic!("failed generating accounts hash files: {err:?}"); | ||||||
| } | ||||||
|
|
||||||
| // convert mmapped cache files into slices of data | ||||||
|
|
@@ -6874,8 +6874,7 @@ impl AccountsDb { | |||||
| self.calculate_accounts_hash(&calc_config, &sorted_storages, HashStats::default()); | ||||||
| if calculated_lamports != total_lamports { | ||||||
| warn!( | ||||||
| "Mismatched total lamports: {} calculated: {}", | ||||||
| total_lamports, calculated_lamports | ||||||
| "Mismatched total lamports: {total_lamports} calculated: {calculated_lamports}" | ||||||
| ); | ||||||
| return Err(AccountsHashVerificationError::MismatchedTotalLamports( | ||||||
| calculated_lamports, | ||||||
|
|
@@ -7416,7 +7415,7 @@ impl AccountsDb { | |||||
| "remove_dead_slots_metadata: {} dead slots", | ||||||
| dead_slots.len() | ||||||
| ); | ||||||
| trace!("remove_dead_slots_metadata: dead_slots: {:?}", dead_slots); | ||||||
| trace!("remove_dead_slots_metadata: dead_slots: {dead_slots:?}"); | ||||||
| } | ||||||
| self.accounts_index | ||||||
| .update_roots_stats(&mut accounts_index_root_stats); | ||||||
|
|
@@ -8506,7 +8505,7 @@ impl AccountsDb { | |||||
| .alive_bytes | ||||||
| .store(entry.stored_size, Ordering::Release); | ||||||
| } else { | ||||||
| trace!("id: {} clearing count", id); | ||||||
| trace!("id: {id} clearing count"); | ||||||
| store.count_and_status.lock_write().0 = 0; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -8523,7 +8522,7 @@ impl AccountsDb { | |||||
| let mut alive_roots: Vec<_> = self.accounts_index.all_alive_roots(); | ||||||
| #[allow(clippy::stable_sort_primitive)] | ||||||
| alive_roots.sort(); | ||||||
| info!("{}: accounts_index alive_roots: {:?}", label, alive_roots,); | ||||||
| info!("{label}: accounts_index alive_roots: {alive_roots:?}",); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: not caused by you, but the trailing comma.
Suggested change
|
||||||
| let full_pubkey_range = Pubkey::from([0; 32])..=Pubkey::from([0xff; 32]); | ||||||
|
|
||||||
| self.accounts_index.account_maps.iter().for_each(|map| { | ||||||
|
|
||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is significantly longer than 100 characters. Granted it was longer than 100 characters before too...