Skip to content

format argument must be a string literal could suggest inline args #114235

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

let stderr = 3;
eprintln!({stderr})

Current output

|
4 | eprintln!({stderr})
  |           ^^^^^^^^
  |
help: you might be missing a string literal to format with
  |
4 | eprintln!("{}", {stderr})
  |           +++++

Desired output

|
4 | eprintln!({stderr})
  |           ^^^^^^^^
  |
help: quote your inlined format argument to use at as string literal
  |
4 | eprintln!("{stderr}")
  |           +        + 

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`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