-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
In a macro_rules! definition, there are three different repetition operators that can be used: *, +, ?. Rust accepts the code even if the repetition operator in the macro matcher is different from the repetition operator in the macro transcriber. This lint would warn against such a mismatch.
Advantage
- Having mismatched repetition operators can be confusing, since the kind of repetition operator used in the macro transcriber is ignored, and therefore can be misleading.
- Mismatched repetition operators can be a sign of a bug, where the macro author intended to refer to a different "repetition group".
Drawbacks
No response
Example
macro_rules! my_macro {
($($i:ident)?) => {
$($i)*
}
}Could be written as:
macro_rules! my_macro {
($($i:ident)?) => {
$($i)?
}
}Comparison with existing lints
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints