-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add macro_braces lint to check for irregular brace use in certain macros #7299
Conversation
r? @llogiq (rust-highfive has picked a reviewer for you, use r? to override) |
Agree with @jplatte 's comments. Also I'd consider "nonstandard" instead of "unconventional", it's slightly shorter and consistent with "nonstandard_style". |
Ahh thanks for the "nonstandard" I spent a half-hour trying to figure out a good word 😆! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks mostly good, I only have a few comments, otherwise it's ready to merge.
tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs
Outdated
Show resolved
Hide resolved
95906be
to
791d428
Compare
The only thing left is the question whether configuration can change brace style (perhaps someone has their own style guide that differs from the standard). |
Do you mean since Edit: I realized that since both fields of the |
☔ The latest upstream changes (presumably #7315) made this pull request unmergeable. Please resolve the merge conflicts. |
Good! I like that this is also tested. I think once this is rebased, it's ready to merge. |
Should I squash? Oh also I thought maybe the lint should also |
Yes, macros in type position are a thing, e.g. syn::Token. |
I'm not sure if bors does it automatically, but it probably won't hurt to squash. |
bors merges as-is. So no auto-squashing. |
Rename unconventional -> nonstandard, add config field Add standard_macro_braces fields so users can specify macro names and brace combinations to lint for in the clippy.toml file. Fix errors caused by nonstandard_macro_braces in other lint tests Fix users ability to override the default nonstandard macro braces Add type position macros impl `check_ty`
Squashed, thanks for all the help everyone! |
Thank you! @bors r+ |
📌 Commit 723f515 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixed broken deploy script due to multiline configuration docs The deploy script on master currently runs into an error (See [log](https://github.com/rust-lang/rust-clippy/runs/2865828873)) due to the new configuration documentation added in #7299. The current documentation collection for the configuration macro sadly doesn't support multiline doc comments. This will be changes in the future with the new metadata collector tracked in #7172 For now we have to use `<br>` inside doc comments to add paragraphs. This PR restricts `define_Conf!` macro to single lines and adds a comment explaining the reasoning behind it. It also adjusted the actual document parsing to fix a bug. (The parsing was automatically stopping on the first curly bracket, even if it was part of a doc comment). changelog: none
The name is a bit long but this sounds good as
#[allow(unconventional_macro_braces)]
and it seems more clear that we are talking about the macro call not macro definitions, any feedback let me know. Thanks!fixes #7278
changelog: Add
[`unconventional_macro_braces`]
lint that checks for uncommon brace usage with macros.