Allow types (with lifetimes/generics) in impl_lint_pass

This commit is contained in:
flip1995 2020-05-27 16:56:57 +02:00
parent 783139bd8f
commit 709ddba9fe
No known key found for this signature in database
GPG Key ID: 2CEFCDB27ED0BE79

View File

@ -347,14 +347,14 @@ pub trait LintPass {
fn name(&self) -> &'static str;
}
/// Implements `LintPass for $name` with the given list of `Lint` statics.
/// Implements `LintPass for $ty` with the given list of `Lint` statics.
#[macro_export]
macro_rules! impl_lint_pass {
($name:ident => [$($lint:expr),* $(,)?]) => {
impl $crate::lint::LintPass for $name {
fn name(&self) -> &'static str { stringify!($name) }
($ty:ty => [$($lint:expr),* $(,)?]) => {
impl $crate::lint::LintPass for $ty {
fn name(&self) -> &'static str { stringify!($ty) }
}
impl $name {
impl $ty {
pub fn get_lints() -> $crate::lint::LintArray { $crate::lint_array!($($lint),*) }
}
};