Skip to content

core::fmt::Formatter does not mention write! macro #128713

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ErikMcClure opened this issue Aug 5, 2024 · 1 comment · Fixed by #129001
Closed

core::fmt::Formatter does not mention write! macro #128713

ErikMcClure opened this issue Aug 5, 2024 · 1 comment · Fixed by #129001
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@ErikMcClure
Copy link

Location

Formatter::write_fmt

Summary

The docs for write_fmt in Formatter do not line up with the docs for write_fmt in the Write trait. The write trait warns you that you should be using the write! macro, but the method in Formatter doesn't. If you are implementing core::fmt::Debug and call write_fmt on the provided Formatter object directly, and use the wrong arguments, the rust-analyzer error will use Formatter docs, which will mislead the user into simply wrapping the arguments via format_args! instead of using a write! macro.

@ErikMcClure ErikMcClure added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Aug 5, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 5, 2024
@Noratrieb
Copy link
Member

sounds reasonable, feel free to make a PR adding it.

@Noratrieb Noratrieb added T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 7, 2024
@bors bors closed this as completed in a4261a0 Aug 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Aug 14, 2024
Rollup merge of rust-lang#129001 - cblh:fix/128713, r=Noratrieb

chore(lib): Enhance documentation for core::fmt::Formatter's write_fm…

fix: rust-lang#128713
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library 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