-
Notifications
You must be signed in to change notification settings - Fork 143
Fix clippy::uninlined_format_args #1389
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
Conversation
There are a lot of changes, but they are fully mechanical, performed by clippy itself using `cargo clippy --all-targets --fix --allow-dirty` after I fixed first three occurrences myself.
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.
Pull Request Overview
This PR applies the clippy::uninlined_format_args fix across the codebase by converting all format! and println! calls from numbered {} placeholders to inline Rust 1.58+ named formatting (e.g., "{}" → "{var}").
- Replaces
println!("Unique name: {}", name);withprintln!("Unique name: {name}"); - Converts all
format!usages in tests and source to use{var}inside the literal - Updates debug and display implementations to use inline formatting
Reviewed Changes
Copilot reviewed 87 out of 87 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scylla/tests/integration/utils.rs | Updated println! to named interpolation |
| scylla/tests/integration/types/cql_value.rs | Converted format! calls to inline {ks} usage |
| scylla/tests/integration/types/cql_types.rs | Changed table DDL and query strings to named formatting |
| scylla/src/utils/test_utils.rs | println! updated to use {name} |
| scylla/src/statement/prepared.rs | ColumnSpec formatting switched to format!("col_{i}") |
| scylla/src/response/query_result.rs | Infinite iterator formatting updated |
| scylla/src/policies/load_balancing/default.rs | Test string literals switched to inline formatting |
| scylla/src/network/connection_pool.rs | Debug impl updated for inline formatting |
| scylla/src/cluster/node.rs | Error message formatting updated |
| scylla-cql/src/value.rs | Display impl switched to {fl}, {u}, etc. |
| scylla-cql/src/utils/parse.rs | Display impl for ParseErrorCause updated |
| examples/value_list.rs | Example prints switched to named formatting |
| ... | ... many other files follow the same pattern |
|
|
piodul
left a comment
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.
Heh, the lint has made a comeback - we had to deal with it in the past when it was enabled by default: #643. It was made non-default back again shortly afterwards.
Last time, my main concern was inlined format args didn't have good support in rust-analyzer. I checked and now they are properly supported, which is nice.
Maybe this is the reason this lint was removed (from defaults) before, and added again now? |
|
Looks like this: rust-lang/rust-clippy#14160 |
|
Yeah, looks like it was not only my concern - in fact, I probably learned about the problem after reading the issue, and only then it became my main concern. |
Replaces: #1386
clippy::uninlined_format_argswarns about format strings that have its variables listed after format string, instead of having it directly in curly braces.Advantages of that? Shorter code that plays better with
cargo fmt, and no need to jump with your eyes between string and values to understand the format.There are a lot of changes, but they are fully mechanical, performed by clippy itself using
cargo clippy --all-targets --fix --allow-dirtyafter I fixed first three occurrences myself.Pre-review checklist
I added relevant tests for new features and bug fixes.I have provided docstrings for the public items that I want to introduce.I have adjusted the documentation in./docs/source/.I added appropriateFixes:annotations to PR description.