-
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
New lint: Check quote!
macro is always used with curyl braces
#7278
Comments
This extends to other macros as well, e.g. |
This will most likely be a bit difficult to implement as Clippy only uses lint passes after macros like One possible solution would be:
However, this is a hack. It might be worth to wait until we have a better solution for the pre macro expansion checks. |
Do you know why adding pre_expansion lints is bad / forbidden? pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) {
// NOTE: Do not add any more pre-expansion passes. These should be removed eventually.
... Does it not catch all macros for some reason, I messed with it for a bit before giving up and implementing it in the hacky way (or to follow soon) but it seemed to miss |
I only have a rough idea based on a discussion here
There is currently nobody focusing on this topic to my knowledge. |
What it does
What does this lint do?
What it does
Check
quote!
is always used with curly braces, this could maybe apply to other macros or other bracing combos?Categories
This is mostly a consistency lint although using
()
or[]
doesn't give you a semicolon in item position, which can be unexpected.Drawbacks
None 🤷
Example
Could be written as:
If everyone is ok with this in the nursery I can open a PR.
The text was updated successfully, but these errors were encountered: