Skip to content

New lint: suggest using "implicit named arguments" #8368

Closed
@stanislav-tkach

Description

@stanislav-tkach

What it does

This lint suggests using the feature added in the 1.58 version of Rust: implicit named arguments for formatting macros.

Lint Name

implicit_named_arguments

Category

style

Advantage

  • Slightly less verbose code.
  • (Arguably) less error prone code.

Drawbacks

The only drawback that I can see is that not everyone would probably be happy with this lint, so perhaps it should be opt-in (pedantic).

Example

println!("1 = {}, 2 = {}, 3 = {}", first, second, third);

Could be written as:

println!("1 = {first}, 2 = {second}, 3 = {third}");

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions