rust-lang / rust-lang/rust-clippy

Add `inlined_format_args`, opposite to `uninlined_format_args`

Open
#17,558 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

What it does

Opposite of uninlined_format_args.

Advantage

Consistency. Not everything can be in lined, but everything can be 'not in-lined'.

With uninlined_format_args format!("{}", var); becomes format!("{var}");, but format!("{} {}", var, 1+2); cannot become format!("{var} {1+2}");, at best you can get format!("{var} {}", 1+2);

Drawbacks

Churn, collision with uninlined_format_args.

Example
format!("{var}");

format!("{var} {}", 1+2);

Could be written as:

format!("{}", var);

format!("{} {}", var, 1+2);
Comparison with existing lints

No response

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing uninlined_format_args lint and tracing how its behavior is tested. Clarify the opposite lint’s handling of expressions such as 1+2, account for the stated churn and collision drawbacks, and consider the work complete when the examples behave consistently with the agreed design.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.