Rename $passes as $pass in several macros.

Because it makes more sense that way.
This commit is contained in:
Nicholas Nethercote 2022-12-07 16:54:02 +11:00
parent ac1e69c903
commit ec117c0ebd

View File

@ -81,8 +81,8 @@ impl LateLintPass<'_> for HardwiredLints {}
#[macro_export] #[macro_export]
macro_rules! expand_combined_late_lint_pass_method { macro_rules! expand_combined_late_lint_pass_method {
([$($passes:ident),*], $self: ident, $name: ident, $params:tt) => ({ ([$($pass:ident),*], $self: ident, $name: ident, $params:tt) => ({
$($self.$passes.$name $params;)* $($self.$pass.$name $params;)*
}) })
} }
@ -97,28 +97,28 @@ macro_rules! expand_combined_late_lint_pass_methods {
#[macro_export] #[macro_export]
macro_rules! declare_combined_late_lint_pass { macro_rules! declare_combined_late_lint_pass {
([$v:vis $name:ident, [$($passes:ident: $constructor:expr,)*]], $methods:tt) => ( ([$v:vis $name:ident, [$($pass:ident: $constructor:expr,)*]], $methods:tt) => (
#[allow(non_snake_case)] #[allow(non_snake_case)]
$v struct $name { $v struct $name {
$($passes: $passes,)* $($pass: $pass,)*
} }
impl $name { impl $name {
$v fn new() -> Self { $v fn new() -> Self {
Self { Self {
$($passes: $constructor,)* $($pass: $constructor,)*
} }
} }
$v fn get_lints() -> LintArray { $v fn get_lints() -> LintArray {
let mut lints = Vec::new(); let mut lints = Vec::new();
$(lints.extend_from_slice(&$passes::get_lints());)* $(lints.extend_from_slice(&$pass::get_lints());)*
lints lints
} }
} }
impl<'tcx> LateLintPass<'tcx> for $name { impl<'tcx> LateLintPass<'tcx> for $name {
expand_combined_late_lint_pass_methods!([$($passes),*], $methods); expand_combined_late_lint_pass_methods!([$($pass),*], $methods);
} }
#[allow(rustc::lint_pass_impl_without_macro)] #[allow(rustc::lint_pass_impl_without_macro)]
@ -184,8 +184,8 @@ pub trait EarlyLintPass: LintPass {
#[macro_export] #[macro_export]
macro_rules! expand_combined_early_lint_pass_method { macro_rules! expand_combined_early_lint_pass_method {
([$($passes:ident),*], $self: ident, $name: ident, $params:tt) => ({ ([$($pass:ident),*], $self: ident, $name: ident, $params:tt) => ({
$($self.$passes.$name $params;)* $($self.$pass.$name $params;)*
}) })
} }
@ -200,28 +200,28 @@ macro_rules! expand_combined_early_lint_pass_methods {
#[macro_export] #[macro_export]
macro_rules! declare_combined_early_lint_pass { macro_rules! declare_combined_early_lint_pass {
([$v:vis $name:ident, [$($passes:ident: $constructor:expr,)*]], $methods:tt) => ( ([$v:vis $name:ident, [$($pass:ident: $constructor:expr,)*]], $methods:tt) => (
#[allow(non_snake_case)] #[allow(non_snake_case)]
$v struct $name { $v struct $name {
$($passes: $passes,)* $($pass: $pass,)*
} }
impl $name { impl $name {
$v fn new() -> Self { $v fn new() -> Self {
Self { Self {
$($passes: $constructor,)* $($pass: $constructor,)*
} }
} }
$v fn get_lints() -> LintArray { $v fn get_lints() -> LintArray {
let mut lints = Vec::new(); let mut lints = Vec::new();
$(lints.extend_from_slice(&$passes::get_lints());)* $(lints.extend_from_slice(&$pass::get_lints());)*
lints lints
} }
} }
impl EarlyLintPass for $name { impl EarlyLintPass for $name {
expand_combined_early_lint_pass_methods!([$($passes),*], $methods); expand_combined_early_lint_pass_methods!([$($pass),*], $methods);
} }
#[allow(rustc::lint_pass_impl_without_macro)] #[allow(rustc::lint_pass_impl_without_macro)]