Eliminate four unnecessary lint macros.
The lint definitions use macros heavily. This commit merges some of them that are split unnecessarily. I find the reduced indirection makes it easier to imagine what the generated code will look like.
This commit is contained in:
parent
c090c6880c
commit
33faf01690
3 changed files with 16 additions and 40 deletions
|
@ -300,20 +300,14 @@ impl LintPass for EarlyLintPassObjects<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! expand_early_lint_pass_impl_methods {
|
||||
([$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
|
||||
$(fn $name(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) {
|
||||
for obj in self.lints.iter_mut() {
|
||||
obj.$name(context, $($param),*);
|
||||
}
|
||||
})*
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! early_lint_pass_impl {
|
||||
([], [$($methods:tt)*]) => (
|
||||
([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
|
||||
impl EarlyLintPass for EarlyLintPassObjects<'_> {
|
||||
expand_early_lint_pass_impl_methods!([$($methods)*]);
|
||||
$(fn $name(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) {
|
||||
for obj in self.lints.iter_mut() {
|
||||
obj.$name(context, $($param),*);
|
||||
}
|
||||
})*
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue