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

Consider deleting FORMAT_MACRO_DIAG_ITEMS, and tag the macros in stdlib #14267

Open
nyurik opened this issue Feb 21, 2025 · 1 comment
Open

Comments

@nyurik
Copy link
Contributor

nyurik commented Feb 21, 2025

Now that #[clippy::format_args] has been released, should we delete the FORMAT_MACRO_DIAG_ITEMS list, and instead tag all relevant macros with the new attribute in the stdlib?

Benefits

  • Keep each macro's metadata next to the declaration.
  • No need to track when new relevant macros are written
  • Improves discoverability of the #[clippy::format_args], as any developer writing format-like macro will see it in the declaration
@Centri3
Copy link
Member

Centri3 commented Feb 21, 2025

Personally think this is a good idea 👍

nyurik added a commit to nyurik/rust that referenced this issue Feb 21, 2025
Since 1.85, Clippy [supports](See https://doc.rust-lang.org/nightly/clippy/attribs.html#clippyformat_args) attribute-based discovery of the `format!`-compatible macros, i.e. macros whose trailing arguments can be passed to `format_args!` as is.

Tagging core library with the same attribute will allow clippy to stop maintaining a separate list of format-like macros - allowing Clippy to validate macro usage for all lints that work on format arguments. See also rust-lang/rust-clippy#14267
nyurik added a commit to nyurik/rust that referenced this issue Feb 21, 2025
Since 1.85, Clippy [supports](See https://doc.rust-lang.org/nightly/clippy/attribs.html#clippyformat_args) attribute-based discovery of the `format!`-compatible macros, i.e. macros whose trailing arguments can be passed to `format_args!` as is.

Tagging core library with the same attribute will allow clippy to stop maintaining a separate list of format-like macros - allowing Clippy to validate macro usage for all lints that work on format arguments. See also rust-lang/rust-clippy#14267
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants