-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Comments
Personally think this is a good idea 👍 |
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
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
Do we have a certain method that returns all items with certain method? I can absolutely see the value in not having to maintain the independent list and the ergonomics in adding new macros, but I don't think it's worth it compared to all macros going to the not happy path which is much more complex. I strongly think that it's not worth it, we can nominate the issue for the next meeting. Or if someone wants to chime in and do the benchmarks for me, that would be great! |
@blyxyas, in the rust-lang/rust#137364 - how were you able to work around the rust-lang/rust#98291 compilation issue? Are there any compiler experts who may know how to fix it? Note that the current implementation in Clippy utils always does the macro check - i.e. it first chacks if the macro is in the "known list", and if it is not, and still checks if that macro has the |
The lint detection code checks for |
By the way, I was not able to work around it :( the main culprit of the difficulties for benchmarking rust from Clippy is that you can either:
After mentalizing about what was the game plan (each PR to benchmark is different, much more if it's from rustc), and seeing the not-compiling warning... Well, it was not great. I'm sure that in the future apart from flying cars we'll have a more ergonomic Rust-into-Clippy and backwards linking workflow. (I hope) |
Now that
#[clippy::format_args]
has been released, should we delete theFORMAT_MACRO_DIAG_ITEMS
list, and instead tag all relevant macros with the new attribute in the stdlib?Benefits
#[clippy::format_args]
, as any developer writing format-like macro will see it in the declarationThe text was updated successfully, but these errors were encountered: