Skip to content
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

solana-cli: format strings #34288

Merged
merged 9 commits into from
Dec 1, 2023
Merged

Conversation

CriesofCarrots
Copy link
Contributor

This PR is spun out from #34274

Problem

Long string literals can cause rustfmt to fail, which results in rustfmt failing to format entire functions. There are many instances of this in the solana-cli.

Summary of Changes

Format and wrap strings to allow rustfmt to work again.
This PR was initiated by adding format_strings = true to the workspace rustfmt.toml. In general, this did a nice job.

However, I chose to manually preserve or improve some of the original strings where the formatting seemed to break readability. (It is just my own personal preference that [default: ..] blocks not be broken across multiple lines.)
If we impose format_strings on the workspace in the future, these strings will be "wrong" and need fixing.

cli/src/address_lookup_table.rs Show resolved Hide resolved
cli/src/clap_app.rs Outdated Show resolved Hide resolved
brooksprumo
brooksprumo previously approved these changes Nov 30, 2023
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #34288 (f0954b9) into master (18309ba) will decrease coverage by 0.1%.
Report is 1 commits behind head on master.
The diff coverage is 91.2%.

❗ Current head f0954b9 differs from pull request most recent head 50baf5e. Consider uploading reports for the commit 50baf5e to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #34288     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         819      819             
  Lines      219969   220027     +58     
=========================================
- Hits       180326   180318      -8     
- Misses      39643    39709     +66     

Copy link
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few nits

cli/src/address_lookup_table.rs Outdated Show resolved Hide resolved
cli/src/clap_app.rs Outdated Show resolved Hide resolved
cli/src/validator_info.rs Outdated Show resolved Hide resolved
cli/src/stake.rs Outdated Show resolved Hide resolved
@CriesofCarrots
Copy link
Contributor Author

Sorry @steviez , I squashed the nit fixes into their relevant file-commits before I realized that would make it hard to re-review 😞

Copy link
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I squashed the nit fixes into their relevant file-commits before I realized that would make it hard to re-review

No worries, luckily not every file was touched and I had bene using the feature of marking files as viewed. I think I found a few more that we might as well grab

cli/src/cluster_query.rs Outdated Show resolved Hide resolved
cli/src/cluster_query.rs Outdated Show resolved Hide resolved
cli/src/cluster_query.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@CriesofCarrots CriesofCarrots added the automerge Merge this Pull Request automatically once CI passes label Dec 1, 2023
@mergify mergify bot merged commit 68928bb into solana-labs:master Dec 1, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants