Skip to content

named_arguments_used_positionally lint drops some formatting options #100992

Closed
@m-ou-se

Description

@m-ou-se
fn main() {
    format!("{:x}", a=1);
}
warning: named argument `a` is not used by name
 --> src/main.rs:2:21
  |
2 |     format!("{:x}", a=1);
  |              ----   ^ this named argument is referred to by position in formatting string
  |              |
  |              this formatting argument uses named argument `a` by position
  |
  = note: `#[warn(named_arguments_used_positionally)]` on by default
help: use the named argument by name to avoid ambiguity
  |
2 |     format!("{a}", a=1);
  |               ~

The :x disappears.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions