clippy: uninlined_format_args#6854
Conversation
|
The Firedancer team maintains a line-for-line reimplementation of the |
steviez
left a comment
There was a problem hiding this comment.
Build is currently failing since fmt differs; however, I think the change it wants to adopt is kind of ridiculous. See here:
https://buildkite.com/anza/agave/builds/26034#0197e23a-a436-4805-ad12-6f69c1e9500f
Note the misalignment of the parentheses for trace!; might play around with it for a little but also might cave and just let it go with the misalignment:

| debug!( | ||
| "Loaded Programs Cache Stats -- Hits: {}, Misses: {}, Evictions: {}, Reloads: {}, Insertions: {}, Lost-Insertions: {}, Replacements: {}, One-Hit-Wonders: {}, Prunes-Orphan: {}, Prunes-Environment: {}, Empty: {}, Water-Level: {}", | ||
| hits, misses, evictions, reloads, insertions, lost_insertions, replacements, one_hit_wonders, prunes_orphan, prunes_environment, empty_entries, water_level | ||
| "Loaded Programs Cache Stats -- Hits: {hits}, Misses: {misses}, Evictions: {evictions}, Reloads: {reloads}, Insertions: {insertions}, Lost-Insertions: {lost_insertions}, Replacements: {replacements}, One-Hit-Wonders: {one_hit_wonders}, Prunes-Orphan: {prunes_orphan}, Prunes-Environment: {prunes_environment}, Empty: {empty_entries}, Water-Level: {water_level}" |
There was a problem hiding this comment.
Not going to touch it as part of this PR, but this string is clearly too long and could be causing issues with cargo fmt for the whole file. Just calling out
| debug!( | ||
| "Too many requests: server responded with {:?}, {} retries left, pausing for {:?}", | ||
| response, too_many_requests_retries, duration | ||
| "Too many requests: server responded with {response:?}, {too_many_requests_retries} retries left, pausing for {duration:?}" |
There was a problem hiding this comment.
Another malformed line that we should clean up after this PR
| max_streams_per_interval: {max_streams_per_throttling_interval}, read_interval_streams: {streams_read_in_throttle_interval} \ | ||
| throttle_duration: {throttle_duration:?}", | ||
| peer_type, total_stake); | ||
| throttle_duration: {throttle_duration:?}"); |
There was a problem hiding this comment.
Another case: the indentation on these subsequent line looks off
| error!("Failed to deploy the program: {}", e); | ||
| format!("Failed to deploy the program: {}", e) | ||
| error!("Failed to deploy the program: {e}"); | ||
| format!("Failed to deploy the program: {e}") |
There was a problem hiding this comment.
For future - could probably create the string once, print it in error log and then return to avoid the double format!()
| error!("Failed to fetch the program: {}", e); | ||
| format!("Failed to fetch the program: {}", e) | ||
| error!("Failed to fetch the program: {e}"); | ||
| format!("Failed to fetch the program: {e}") |
There was a problem hiding this comment.
Same as above - can seemingly get this down to a single format!()
98e4d25 to
6d1998b
Compare
| let diff = new_account.lamports() - old_account.lamports(); | ||
| trace!("store_account_and_update_capitalization: increased: {pubkey} {diff}"); |
There was a problem hiding this comment.
fmt was doing some weird stuff with the formatting here. Renaming increased ==> diff (and decreased ==> diff below) avoided it. Typically, I would prefer not to rename variables in a PR like this, but if you look at the 3rd commit, fmt was making a mess of it
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6854 +/- ##
========================================
Coverage 83.2% 83.2%
========================================
Files 852 852
Lines 376951 376839 -112
========================================
- Hits 313888 313866 -22
+ Misses 63063 62973 -90 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Let no good deed go unpunished!
I made it up until cli/. IMO this PR is too large. I worry that it'll constantly require handling merge conflicts. That or it just gets stamped without someone doing a full review.
Maybe it is split up into smaller chunks with a few crates at a time?
| 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:?}" |
There was a problem hiding this comment.
This line is significantly longer than 100 characters. Granted it was longer than 100 characters before too...
| 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.
Longer than 100 characters now, where as it wasn't before.
| #[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.
nit: not caused by you, but the trailing comma.
| info!("{label}: accounts_index alive_roots: {alive_roots:?}",); | |
| info!("{label}: accounts_index alive_roots: {alive_roots:?}"); |
| if result.is_err() { | ||
| // for vm.max_map_count, error is: {code: 12, kind: Other, message: "Cannot allocate memory"} | ||
| info!("memory map error: {:?}. This may be because vm.max_map_count is not set correctly.", result); | ||
| info!("memory map error: {result:?}. This may be because vm.max_map_count is not set correctly."); |
There was a problem hiding this comment.
Longer than 100 characters. Old was too.
| entry_size, | ||
| limit_size, | ||
| ); | ||
| trace!("checked_total_size_sum: {total_size} + {entry_size} < {limit_size}",); |
| info!( | ||
| "Funding keypair balance: {} max_fee: {} lamports_per_account: {} extra: {} total: {}", | ||
| funding_key_balance, max_fee, lamports_per_account, extra, total | ||
| "Funding keypair balance: {funding_key_balance} max_fee: {max_fee} lamports_per_account: {lamports_per_account} extra: {extra} total: {total}" |
| warn!( | ||
| "Too many failed transfers... {} remaining, {} verified, {} failures", | ||
| remaining_count, verified_txs, failed_verify | ||
| "Too many failed transfers... {remaining_count} remaining, {verified_txs} verified, {failed_verify} failures" |
| info!( | ||
| "Verifying transfers... {} remaining, {} verified, {} failures", | ||
| remaining_count, verified_txs, failed_verify | ||
| "Verifying transfers... {remaining_count} remaining, {verified_txs} verified, {failed_verify} failures" |
| info!( | ||
| "Verifying transfers... {} remaining, {} verified, {} failures", | ||
| remaining_count, verified_txs, failed_verify | ||
| "Verifying transfers... {remaining_count} remaining, {verified_txs} verified, {failed_verify} failures" |
As is tradition
I did review this one somewhat myself and was hoping I'd find another brave soul who could slog through it, but given that you found some other >100 character offenders, maybe we can break it up
Appreciate you helping me pump my commit numbers 😆 |
|
Going to close this out in favor of smaller PR's
Sorry about any wasted efforts here Brooks. And similar sentiment for you @LucasSte; I broke the SVM owned stuff into separate PR (#6910) to hopefully avoid requiring multiple re-reviews from you & team |
Problem
Work towards #6850 - it appears that using variables inline in
format!is now required. Sample error output:Summary of Changes
The steps to create this PR:
rust-toolchain.tomlto1.88.0cargo clippy --fix --allow-dirtyuninlined_format_argscomplaints./cargo nightly fmtto cleanup strings modified in 1st commitcargo clippy --fix --tests --allow-dirtycargo nightly fmtto cleanup strings modified in 3rd commit