Skip to content
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

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

Closed
matthiaskrgr opened this issue Jul 30, 2023 · 0 comments · Fixed by #114507
Closed

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

matthiaskrgr opened this issue Jul 30, 2023 · 0 comments · Fixed by #114507
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jul 30, 2023

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

@matthiaskrgr matthiaskrgr added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 30, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 30, 2023
@workingjubilee workingjubilee added A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 30, 2023
@bors bors closed this as completed in e286f25 Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants