Skip to content

rpc: Resolve Rust 1.88 clippy lints and format strings#7047

Merged
steviez merged 4 commits intoanza-xyz:masterfrom
steviez:rust_1.88_rpc
Jul 22, 2025
Merged

rpc: Resolve Rust 1.88 clippy lints and format strings#7047
steviez merged 4 commits intoanza-xyz:masterfrom
steviez:rust_1.88_rpc

Conversation

@steviez
Copy link
Copy Markdown

@steviez steviez commented Jul 18, 2025

Problem

Working towards #6850, broken out from #6854

Summary of Changes

  • Run cargo clippy --fix --tests with Rust 1.88.0 set in rust-toolchain.toml
    • These should only be instances of uninlined_format_args
  • Run cargo fmt with format_strings = true set in rustfmt.toml

@mergify
Copy link
Copy Markdown

mergify Bot commented Jul 18, 2025

If this PR represents a change to the public RPC API:

  1. Make sure it includes a complementary update to rpc-client/ (example)
  2. Open a follow-up PR to update the JavaScript client @solana/kit (example)

Thank you for keeping the RPC clients in sync with the server API @steviez.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 18, 2025

Codecov Report

Attention: Patch coverage is 53.71429% with 81 lines in your changes missing coverage. Please review.

Project coverage is 83.2%. Comparing base (c87ab7c) to head (93b2c30).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #7047     +/-   ##
=========================================
- Coverage    83.2%    83.2%   -0.1%     
=========================================
  Files         853      853             
  Lines      374734   374735      +1     
=========================================
- Hits       311896   311862     -34     
- Misses      62838    62873     +35     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@steviez steviez requested review from KirillLykov and alannza July 21, 2025 03:15
code: ErrorCode::InvalidRequest,
message: format!(
"There already exists a plugin named {} loaded, while reloading {name}. Did not load requested plugin",
"There already exists a plugin named {} loaded, while reloading {name}. Did \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This was before your formatting, but I don't really like that one is passed as argument and the other is embedded. Maybe move name out from {}?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm undecided on where I stand with format strings like these. But for the sake of this PR, I'm inclined to leave it as is; I'm mostly just trying to get us to a point where we can turn on an extra lint.

There are a bunch of these in the codebase, so if we do want to change, I think it'd be good to get a loose decision and then tackle making the codebase uniform in a separate change(s)

test_serde::<UiTransactionStatusMeta>(json_input, expected_json_output);

#[rustfmt::skip]
let json_input = "{\
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe using here r#""# would simplify it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ahh yeah, I think that would be more readable then what we have. That being said, what we have is workable and I kind of want to push this to keep overall progress moving so I think I'm going to defer for now

Copy link
Copy Markdown

@KirillLykov KirillLykov left a comment

Choose a reason for hiding this comment

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

Generally, look good to me. Left some cosmetic comments

Copy link
Copy Markdown
Author

@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.

Thanks for the review; agree there could be some more minor cleanup in the future but going to merge as-is as I'm mostly focused on the one lint at the moment

code: ErrorCode::InvalidRequest,
message: format!(
"There already exists a plugin named {} loaded, while reloading {name}. Did not load requested plugin",
"There already exists a plugin named {} loaded, while reloading {name}. Did \
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm undecided on where I stand with format strings like these. But for the sake of this PR, I'm inclined to leave it as is; I'm mostly just trying to get us to a point where we can turn on an extra lint.

There are a bunch of these in the codebase, so if we do want to change, I think it'd be good to get a loose decision and then tackle making the codebase uniform in a separate change(s)

test_serde::<UiTransactionStatusMeta>(json_input, expected_json_output);

#[rustfmt::skip]
let json_input = "{\
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ahh yeah, I think that would be more readable then what we have. That being said, what we have is workable and I kind of want to push this to keep overall progress moving so I think I'm going to defer for now

@steviez steviez merged commit 64382a5 into anza-xyz:master Jul 22, 2025
50 checks passed
@steviez steviez deleted the rust_1.88_rpc branch July 22, 2025 19:24
puhtaytow pushed a commit to puhtaytow/agave that referenced this pull request Jul 24, 2025
- Add rustfmt::skip to several already well-crafted strings
- Run `cargo clippy --fix --tests` with Rust 1.88.0 set in `rust-toolchain.toml`
- Run `cargo fmt` with `format_strings = true` set in `rustfmt.toml`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants