From 5679a060b050b61adae03138b4c76b2c97cdf6eb Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 9 Jun 2026 18:51:14 +1000 Subject: [PATCH 1/9] Remove lifetime from `RuntimeCombined{Early,Late}LintPass` These structs can own the `Vec`. --- compiler/rustc_lint/src/early.rs | 10 +++++----- compiler/rustc_lint/src/late.rs | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index df6683c14df42..c5c6b6de4cd39 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -246,12 +246,12 @@ impl<'ast, 'ecx, T: EarlyLintPass> ast_visit::Visitor<'ast> for EarlyContextAndP // `check_foo` method in `$methods` within this pass simply calls `check_foo` // once per `$pass`. Compare with `declare_combined_early_lint_pass`, which is // similar, but combines lint passes at compile time. -struct RuntimeCombinedEarlyLintPass<'a> { - passes: &'a mut [EarlyLintPassObject], +struct RuntimeCombinedEarlyLintPass { + passes: Vec, } #[allow(rustc::lint_pass_impl_without_macro)] -impl LintPass for RuntimeCombinedEarlyLintPass<'_> { +impl LintPass for RuntimeCombinedEarlyLintPass { fn name(&self) -> &'static str { panic!() } @@ -262,7 +262,7 @@ impl LintPass for RuntimeCombinedEarlyLintPass<'_> { macro_rules! impl_early_lint_pass { ([], [$($(#[$attr:meta])* fn $f:ident($($param:ident: $arg:ty),*);)*]) => ( - impl EarlyLintPass for RuntimeCombinedEarlyLintPass<'_> { + impl EarlyLintPass for RuntimeCombinedEarlyLintPass { $(fn $f(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) { for pass in self.passes.iter_mut() { pass.$f(context, $($param),*); @@ -338,7 +338,7 @@ pub fn check_ast_node<'a>( } else { let mut passes: Vec<_> = passes.iter().map(|mk_pass| (mk_pass)()).collect(); passes.push(Box::new(builtin_lints)); - let pass = RuntimeCombinedEarlyLintPass { passes: &mut passes[..] }; + let pass = RuntimeCombinedEarlyLintPass { passes }; check_ast_node_inner(sess, check_node, context, pass); } } diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 0a074c6652a1d..3ab34e77ee0e5 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -306,12 +306,12 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas // `check_foo` method in `$methods` within this pass simply calls `check_foo` // once per `$pass`. Compare with `declare_combined_late_lint_pass`, which is // similar, but combines lint passes at compile time. -struct RuntimeCombinedLateLintPass<'a, 'tcx> { - passes: &'a mut [LateLintPassObject<'tcx>], +struct RuntimeCombinedLateLintPass<'tcx> { + passes: Vec>, } #[allow(rustc::lint_pass_impl_without_macro)] -impl LintPass for RuntimeCombinedLateLintPass<'_, '_> { +impl LintPass for RuntimeCombinedLateLintPass<'_> { fn name(&self) -> &'static str { panic!() } @@ -322,7 +322,7 @@ impl LintPass for RuntimeCombinedLateLintPass<'_, '_> { macro_rules! impl_late_lint_pass { ([], [$($(#[$attr:meta])* fn $f:ident($($param:ident: $arg:ty),*);)*]) => { - impl<'tcx> LateLintPass<'tcx> for RuntimeCombinedLateLintPass<'_, 'tcx> { + impl<'tcx> LateLintPass<'tcx> for RuntimeCombinedLateLintPass<'tcx> { $(fn $f(&mut self, context: &LateContext<'tcx>, $($param: $arg),*) { for pass in self.passes.iter_mut() { pass.$f(context, $($param),*); @@ -368,14 +368,14 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>( } } else { let builtin_lints = Box::new(builtin_lints) as Box>; - let mut binding = store + let passes = store .late_module_passes .iter() .map(|mk_pass| (mk_pass)(tcx)) .chain(std::iter::once(builtin_lints)) .collect::>(); - let pass = RuntimeCombinedLateLintPass { passes: binding.as_mut_slice() }; + let pass = RuntimeCombinedLateLintPass { passes }; late_lint_mod_inner(tcx, module_def_id, context, pass); } } @@ -438,7 +438,7 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) { .collect(); filtered_passes.push(Box::new(HardwiredLints)); - let pass = RuntimeCombinedLateLintPass { passes: &mut filtered_passes[..] }; + let pass = RuntimeCombinedLateLintPass { passes: filtered_passes }; let mut cx = LateContextAndPass { context, pass }; // Visit the whole crate. From 4efbb2b09ea819e00816ff1e79956e9cb55bd4b4 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 9 Jun 2026 18:54:25 +1000 Subject: [PATCH 2/9] Filter lint passes in place By using `retain` instead of `into_iter`/`filter`/`collect`. --- compiler/rustc_lint/src/late.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 3ab34e77ee0e5..4f313ba1420c9 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -406,7 +406,7 @@ fn late_lint_mod_inner<'tcx, T: LateLintPass<'tcx>>( fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) { // Note: `passes` is often empty. - let passes: Vec<_> = + let mut passes: Vec<_> = unerased_lint_store(tcx.sess).late_passes.iter().map(|mk_pass| (mk_pass)(tcx)).collect(); if passes.is_empty() { @@ -426,19 +426,16 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) { let lints_that_dont_need_to_run = tcx.lints_that_dont_need_to_run(()); - let mut filtered_passes: Vec>> = passes - .into_iter() - .filter(|pass| { - let lints = (**pass).get_lints(); - // Lintless passes are always in - lints.is_empty() || + passes.retain(|pass| { + let lints = pass.get_lints(); + // Lintless passes are always in + lints.is_empty() || // If the pass doesn't have a single needed lint, omit it !lints.iter().all(|lint| lints_that_dont_need_to_run.contains(&LintId::of(lint))) - }) - .collect(); + }); + passes.push(Box::new(HardwiredLints)); - filtered_passes.push(Box::new(HardwiredLints)); - let pass = RuntimeCombinedLateLintPass { passes: filtered_passes }; + let pass = RuntimeCombinedLateLintPass { passes }; let mut cx = LateContextAndPass { context, pass }; // Visit the whole crate. From 08cd7bac7ef0e0e6587f3f0d0e1435781dfa8e1b Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 11 Jun 2026 06:17:02 +1000 Subject: [PATCH 3/9] Remove an unnecessary `'static` bound --- compiler/rustc_lint/src/passes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_lint/src/passes.rs b/compiler/rustc_lint/src/passes.rs index ae145543e70dc..6149e11cd8447 100644 --- a/compiler/rustc_lint/src/passes.rs +++ b/compiler/rustc_lint/src/passes.rs @@ -250,5 +250,5 @@ macro_rules! declare_combined_early_lint_pass { } /// A lint pass boxed up as a trait object. -pub(crate) type EarlyLintPassObject = Box; +pub(crate) type EarlyLintPassObject = Box; pub(crate) type LateLintPassObject<'tcx> = Box + 'tcx>; From 68106a834a18cc498a923c9e3e495d78817a0e64 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 11 Jun 2026 16:27:22 +1000 Subject: [PATCH 4/9] Don't put `HardwiredLints` in lint passes It doesn't define any `check_*` methods so there's no point adding it to the passes list. (It's only there for `HardwiredLints::lint_vec`.) This makes it more like `SoftLints`. --- compiler/rustc_lint/src/late.rs | 2 -- compiler/rustc_lint/src/passes.rs | 3 --- 2 files changed, 5 deletions(-) diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 4f313ba1420c9..5c0cdf799b1be 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -14,7 +14,6 @@ use rustc_middle::hir::nested_filter; use rustc_middle::ty::{self, TyCtxt}; use rustc_session::Session; use rustc_session::lint::LintPass; -use rustc_session::lint::builtin::HardwiredLints; use rustc_span::Span; use tracing::debug; @@ -433,7 +432,6 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) { // If the pass doesn't have a single needed lint, omit it !lints.iter().all(|lint| lints_that_dont_need_to_run.contains(&LintId::of(lint))) }); - passes.push(Box::new(HardwiredLints)); let pass = RuntimeCombinedLateLintPass { passes }; let mut cx = LateContextAndPass { context, pass }; diff --git a/compiler/rustc_lint/src/passes.rs b/compiler/rustc_lint/src/passes.rs index 6149e11cd8447..01700fd9cb75a 100644 --- a/compiler/rustc_lint/src/passes.rs +++ b/compiler/rustc_lint/src/passes.rs @@ -1,5 +1,4 @@ use rustc_session::lint::LintPass; -use rustc_session::lint::builtin::HardwiredLints; use crate::context::{EarlyContext, LateContext}; @@ -71,8 +70,6 @@ macro_rules! declare_late_lint_pass { // for all the `check_*` methods. late_lint_methods!(declare_late_lint_pass, []); -impl LateLintPass<'_> for HardwiredLints {} - #[macro_export] macro_rules! expand_combined_late_lint_pass_method { ([$($pass:ident),*], $self: ident, $name: ident, $params:tt) => ({ From 5f02996db6c9fa557c4915701017554c6d501efb Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 11 Jun 2026 17:53:35 +1000 Subject: [PATCH 5/9] Factor out repetitive code in `register_internal` --- compiler/rustc_lint/src/lib.rs | 53 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index aaa0371b4ec3e..98ed4d5d57cb7 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -663,30 +663,35 @@ fn register_builtins(store: &mut LintStore) { } fn register_internals(store: &mut LintStore) { - store.register_lints(&LintPassImpl::lint_vec()); - store.register_early_pass(|| Box::new(LintPassImpl)); - store.register_lints(&DefaultHashTypes::lint_vec()); - store.register_late_mod_pass(|_| Box::new(DefaultHashTypes)); - store.register_lints(&QueryStability::lint_vec()); - store.register_late_mod_pass(|_| Box::new(QueryStability)); - store.register_lints(&TyTyKind::lint_vec()); - store.register_late_mod_pass(|_| Box::new(TyTyKind)); - store.register_lints(&TypeIr::lint_vec()); - store.register_late_mod_pass(|_| Box::new(TypeIr)); - store.register_lints(&BadOptAccess::lint_vec()); - store.register_late_mod_pass(|_| Box::new(BadOptAccess)); - store.register_lints(&DisallowedPassByRef::lint_vec()); - store.register_late_mod_pass(|_| Box::new(DisallowedPassByRef)); - store.register_lints(&SpanUseEqCtxt::lint_vec()); - store.register_late_mod_pass(|_| Box::new(SpanUseEqCtxt)); - store.register_lints(&SymbolInternStringLiteral::lint_vec()); - store.register_late_mod_pass(|_| Box::new(SymbolInternStringLiteral)); - store.register_lints(&ImplicitSysrootCrateImport::lint_vec()); - store.register_early_pass(|| Box::new(ImplicitSysrootCrateImport)); - store.register_lints(&BadUseOfFindAttr::lint_vec()); - store.register_early_pass(|| Box::new(BadUseOfFindAttr)); - store.register_lints(&RustcMustMatchExhaustively::lint_vec()); - store.register_late_pass(|_| Box::new(RustcMustMatchExhaustively)); + macro_rules! early { + ($register:ident, $lint:ident) => { + store.register_lints(&$lint::lint_vec()); + store.$register(|| Box::new($lint)); + }; + } + + macro_rules! late { + ($register:ident, $lint:ident) => { + store.register_lints(&$lint::lint_vec()); + store.$register(|_| Box::new($lint)); + }; + } + + early!(register_early_pass, LintPassImpl); + early!(register_early_pass, ImplicitSysrootCrateImport); + early!(register_early_pass, BadUseOfFindAttr); + + late!(register_late_mod_pass, DefaultHashTypes); + late!(register_late_mod_pass, QueryStability); + late!(register_late_mod_pass, TyTyKind); + late!(register_late_mod_pass, TypeIr); + late!(register_late_mod_pass, BadOptAccess); + late!(register_late_mod_pass, DisallowedPassByRef); + late!(register_late_mod_pass, SpanUseEqCtxt); + late!(register_late_mod_pass, SymbolInternStringLiteral); + + late!(register_late_pass, RustcMustMatchExhaustively); + store.register_group( false, "rustc::internal", From 7618876818bab96b06b3ec2955a64765406fff48 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 12 Jun 2026 10:40:00 +1000 Subject: [PATCH 6/9] Rename `{enter,exit}_where_predicate` All the other paired methods in this trait have the form `check_foo`/`check_foo_post`. --- compiler/rustc_lint/src/early.rs | 4 ++-- compiler/rustc_lint/src/passes.rs | 5 ++--- compiler/rustc_lint/src/unused.rs | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index c5c6b6de4cd39..73932203ec74e 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -195,9 +195,9 @@ impl<'ast, 'ecx, T: EarlyLintPass> ast_visit::Visitor<'ast> for EarlyContextAndP } fn visit_where_predicate(&mut self, p: &'ast ast::WherePredicate) { - lint_callback!(self, enter_where_predicate, p); + lint_callback!(self, check_where_predicate, p); ast_visit::walk_where_predicate(self, p); - lint_callback!(self, exit_where_predicate, p); + lint_callback!(self, check_where_predicate_post, p); } fn visit_poly_trait_ref(&mut self, t: &'ast ast::PolyTraitRef) { diff --git a/compiler/rustc_lint/src/passes.rs b/compiler/rustc_lint/src/passes.rs index 01700fd9cb75a..10306e5240066 100644 --- a/compiler/rustc_lint/src/passes.rs +++ b/compiler/rustc_lint/src/passes.rs @@ -168,9 +168,8 @@ macro_rules! early_lint_methods { fn check_attributes_post(a: &[rustc_ast::Attribute]); fn check_mac_def(a: &rustc_ast::MacroDef); fn check_mac(a: &rustc_ast::MacCall); - - fn enter_where_predicate(a: &rustc_ast::WherePredicate); - fn exit_where_predicate(a: &rustc_ast::WherePredicate); + fn check_where_predicate(a: &rustc_ast::WherePredicate); + fn check_where_predicate_post(a: &rustc_ast::WherePredicate); ]); ) } diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 7c934b2d16751..3549fc0e907ec 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -968,7 +968,7 @@ impl EarlyLintPass for UnusedParens { self.in_no_bounds_pos.clear(); } - fn enter_where_predicate(&mut self, _: &EarlyContext<'_>, pred: &ast::WherePredicate) { + fn check_where_predicate(&mut self, _: &EarlyContext<'_>, pred: &ast::WherePredicate) { use rustc_ast::{WhereBoundPredicate, WherePredicateKind}; if let WherePredicateKind::BoundPredicate(WhereBoundPredicate { bounded_ty, @@ -982,7 +982,7 @@ impl EarlyLintPass for UnusedParens { } } - fn exit_where_predicate(&mut self, _: &EarlyContext<'_>, _: &ast::WherePredicate) { + fn check_where_predicate_post(&mut self, _: &EarlyContext<'_>, _: &ast::WherePredicate) { assert!(!self.with_self_ty_parens); } } From 58892ed2883ea2e257ee9ae15464c5d0a9b781b7 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 12 Jun 2026 08:20:13 +1000 Subject: [PATCH 7/9] Simplify `{early,late}_lint_methods` use points Currently the use points need to handle method attributes, due to a single low-value doc comment in each macro's body. This commit moves those doc comments so the use points can be simplified. The comments are also made more accurate -- there are now multiple `_post` methods and the comments now cover all of them, not just one of them. --- compiler/rustc_lint/src/passes.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_lint/src/passes.rs b/compiler/rustc_lint/src/passes.rs index 10306e5240066..566285b7ff017 100644 --- a/compiler/rustc_lint/src/passes.rs +++ b/compiler/rustc_lint/src/passes.rs @@ -5,6 +5,7 @@ use crate::context::{EarlyContext, LateContext}; #[macro_export] macro_rules! late_lint_methods { ($macro:path, $args:tt) => ( + // `_post` methods are called *after* recursing into the node. $macro!($args, [ fn check_body(a: &rustc_hir::Body<'tcx>); fn check_body_post(a: &rustc_hir::Body<'tcx>); @@ -13,8 +14,6 @@ macro_rules! late_lint_methods { fn check_mod(a: &'tcx rustc_hir::Mod<'tcx>, b: rustc_hir::HirId); fn check_foreign_item(a: &'tcx rustc_hir::ForeignItem<'tcx>); fn check_item(a: &'tcx rustc_hir::Item<'tcx>); - /// This is called *after* recursing into the item - /// (in contrast to `check_item`, which is checked before). fn check_item_post(a: &'tcx rustc_hir::Item<'tcx>); fn check_local(a: &'tcx rustc_hir::LetStmt<'tcx>); fn check_block(a: &'tcx rustc_hir::Block<'tcx>); @@ -59,7 +58,7 @@ macro_rules! late_lint_methods { // contains a few lint-specific methods with no equivalent in `Visitor`. // macro_rules! declare_late_lint_pass { - ([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( + ([], [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( pub trait LateLintPass<'tcx>: LintPass { $(#[inline(always)] fn $name(&mut self, _: &LateContext<'tcx>, $(_: $arg),*) {})* } @@ -79,7 +78,7 @@ macro_rules! expand_combined_late_lint_pass_method { #[macro_export] macro_rules! expand_combined_late_lint_pass_methods { - ($passes:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( + ($passes:tt, [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( $(fn $name(&mut self, context: &$crate::LateContext<'tcx>, $($param: $arg),*) { $crate::expand_combined_late_lint_pass_method!($passes, self, $name, (context, $($param),*)); })* @@ -132,14 +131,13 @@ macro_rules! declare_combined_late_lint_pass { #[macro_export] macro_rules! early_lint_methods { ($macro:path, $args:tt) => ( + // `_post` methods are called *after* recursing into the node. $macro!($args, [ fn check_param(a: &rustc_ast::Param); fn check_ident(a: &rustc_span::Ident); fn check_crate(a: &rustc_ast::Crate); fn check_crate_post(a: &rustc_ast::Crate); fn check_item(a: &rustc_ast::Item); - /// This is called *after* recursing into the item - /// (in contrast to `check_item`, which is checked before). fn check_item_post(a: &rustc_ast::Item); fn check_local(a: &rustc_ast::Local); fn check_block(a: &rustc_ast::Block); @@ -175,7 +173,7 @@ macro_rules! early_lint_methods { } macro_rules! declare_early_lint_pass { - ([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( + ([], [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( pub trait EarlyLintPass: LintPass { $(#[inline(always)] fn $name(&mut self, _: &EarlyContext<'_>, $(_: $arg),*) {})* } @@ -195,7 +193,7 @@ macro_rules! expand_combined_early_lint_pass_method { #[macro_export] macro_rules! expand_combined_early_lint_pass_methods { - ($passes:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( + ($passes:tt, [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( $(fn $name(&mut self, context: &$crate::EarlyContext<'_>, $($param: $arg),*) { $crate::expand_combined_early_lint_pass_method!($passes, self, $name, (context, $($param),*)); })* From 9e8ec307b772fff5ddb9b2eabd07647ed7d1cdb5 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 12 Jun 2026 11:07:40 +1000 Subject: [PATCH 8/9] Put a box within `{Early,Late}LintPassFactory`. That reflects how they're mostly used and avoids the need for some long signatures. And it matches `{Early,Late}LintPassObject` nicely. Also make them public so that clippy can use them. --- compiler/rustc_lint/src/context.rs | 49 ++++++++---------------- compiler/rustc_lint/src/lib.rs | 9 +++-- src/tools/clippy/clippy_lints/src/lib.rs | 14 +++---- 3 files changed, 28 insertions(+), 44 deletions(-) diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index 4ea1a3f1209e4..2aa292ed043ce 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -40,9 +40,10 @@ use self::TargetLint::*; use crate::levels::LintLevelsBuilder; use crate::passes::{EarlyLintPassObject, LateLintPassObject}; -type EarlyLintPassFactory = dyn Fn() -> EarlyLintPassObject + sync::DynSend + sync::DynSync; -type LateLintPassFactory = - dyn for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> + sync::DynSend + sync::DynSync; +pub type EarlyLintPassFactory = + Box EarlyLintPassObject + sync::DynSend + sync::DynSync>; +pub type LateLintPassFactory = + Box Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> + sync::DynSend + sync::DynSync>; /// Information about the registered lints. pub struct LintStore { @@ -55,11 +56,11 @@ pub struct LintStore { /// interior mutability, we don't enforce this (and lints should, in theory, /// be compatible with being constructed more than once, though not /// necessarily in a sane manner. This is safe though.) - pub pre_expansion_passes: Vec>, - pub early_passes: Vec>, - pub late_passes: Vec>, + pub pre_expansion_passes: Vec, + pub early_passes: Vec, + pub late_passes: Vec, /// This is unique in that we construct them per-module, so not once. - pub late_module_passes: Vec>, + pub late_module_passes: Vec, /// Lints indexed by name. by_name: UnordMap, @@ -165,11 +166,8 @@ impl LintStore { self.lint_groups.keys().copied() } - pub fn register_early_pass( - &mut self, - pass: impl Fn() -> EarlyLintPassObject + 'static + sync::DynSend + sync::DynSync, - ) { - self.early_passes.push(Box::new(pass)); + pub fn register_early_pass(&mut self, pass: EarlyLintPassFactory) { + self.early_passes.push(pass); } /// This lint pass is softly deprecated. It misses expanded code and has caused a few @@ -178,31 +176,16 @@ impl LintStore { /// /// * See [rust#69838](https://github.com/rust-lang/rust/pull/69838) /// * See [rust-clippy#5518](https://github.com/rust-lang/rust-clippy/pull/5518) - pub fn register_pre_expansion_pass( - &mut self, - pass: impl Fn() -> EarlyLintPassObject + 'static + sync::DynSend + sync::DynSync, - ) { - self.pre_expansion_passes.push(Box::new(pass)); + pub fn register_pre_expansion_pass(&mut self, pass: EarlyLintPassFactory) { + self.pre_expansion_passes.push(pass); } - pub fn register_late_pass( - &mut self, - pass: impl for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> - + 'static - + sync::DynSend - + sync::DynSync, - ) { - self.late_passes.push(Box::new(pass)); + pub fn register_late_pass(&mut self, pass: LateLintPassFactory) { + self.late_passes.push(pass); } - pub fn register_late_mod_pass( - &mut self, - pass: impl for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> - + 'static - + sync::DynSend - + sync::DynSync, - ) { - self.late_module_passes.push(Box::new(pass)); + pub fn register_late_mod_pass(&mut self, pass: LateLintPassFactory) { + self.late_module_passes.push(pass); } /// Helper method for register_early/late_pass diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 98ed4d5d57cb7..8a9fb97faa64c 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -133,7 +133,10 @@ use unused::*; #[rustfmt::skip] pub use builtin::{MissingDoc, SoftLints}; -pub use context::{CheckLintNameResult, EarlyContext, LateContext, LintContext, LintStore}; +pub use context::{ + CheckLintNameResult, EarlyContext, EarlyLintPassFactory, LateContext, LateLintPassFactory, + LintContext, LintStore, +}; pub use early::diagnostics::DiagAndSess; pub use early::{EarlyCheckNode, check_ast_node}; pub use late::{check_crate, late_lint_mod, unerased_lint_store}; @@ -666,14 +669,14 @@ fn register_internals(store: &mut LintStore) { macro_rules! early { ($register:ident, $lint:ident) => { store.register_lints(&$lint::lint_vec()); - store.$register(|| Box::new($lint)); + store.$register(Box::new(|| Box::new($lint))); }; } macro_rules! late { ($register:ident, $lint:ident) => { store.register_lints(&$lint::lint_vec()); - store.$register(|_| Box::new($lint)); + store.$register(Box::new(|_| Box::new($lint))); }; } diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index af25b1f7f1aac..093b711663502 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -410,9 +410,7 @@ mod zombie_processes; use clippy_config::{Conf, get_configuration_metadata, sanitize_explanation}; use clippy_utils::macros::FormatArgsStorage; use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::sync; -use rustc_lint::{EarlyLintPass, LateLintPass, Lint}; -use rustc_middle::ty::TyCtxt; +use rustc_lint::{EarlyLintPassFactory, LateLintPassFactory, Lint}; use utils::attr_collector::{AttrCollector, AttrStorage}; pub fn explain(name: &str) -> i32 { @@ -452,12 +450,14 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co // NOTE: Do not add any more pre-expansion passes. These should be removed eventually. // Due to the architecture of the compiler, currently `cfg_attr` attributes on crate // level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass. - store.register_pre_expansion_pass(move || Box::new(attrs::EarlyAttributes::new(conf))); + store.register_pre_expansion_pass( + Box::new(move || Box::new(attrs::EarlyAttributes::new(conf))) + ); let format_args_storage = FormatArgsStorage::default(); let attr_storage = AttrStorage::default(); - let early_lints: [Box Box + sync::DynSend + sync::DynSync>; _] = [ + let early_lints: [EarlyLintPassFactory; _] = [ { let format_args = format_args_storage.clone(); Box::new(move || { @@ -525,9 +525,7 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co store.early_passes.extend(early_lints); #[expect(clippy::type_complexity)] - let late_lints: [Box< - dyn for<'tcx> Fn(TyCtxt<'tcx>) -> Box + 'tcx> + sync::DynSend + sync::DynSync, - >; _] = [ + let late_lints: [LateLintPassFactory; _] = [ Box::new(move |_| Box::new(operators::arithmetic_side_effects::ArithmeticSideEffects::new(conf))), Box::new(|_| Box::new(utils::dump_hir::DumpHir)), Box::new(|_| Box::new(utils::author::Author)), From fe678475d3b2356f58f5eb12ec3867a106c1c862 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 12 Jun 2026 14:53:41 +1000 Subject: [PATCH 9/9] Streamline clippy's early/late lint list construction There's a lot of repetition here that can be avoided. --- src/tools/clippy/clippy_lints/src/lib.rs | 749 +++++++++++------------ 1 file changed, 372 insertions(+), 377 deletions(-) diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 093b711663502..7d20326a648d6 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -457,418 +457,413 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co let format_args_storage = FormatArgsStorage::default(); let attr_storage = AttrStorage::default(); + macro_rules! b { ($e:expr) => { Box::new(|| Box::new($e)) } } + macro_rules! bm { ($e:expr) => { Box::new(move || Box::new($e)) } } + let early_lints: [EarlyLintPassFactory; _] = [ { let format_args = format_args_storage.clone(); - Box::new(move || { - Box::new(utils::format_args_collector::FormatArgsCollector::new( - format_args.clone(), - )) - }) + bm!(utils::format_args_collector::FormatArgsCollector::new(format_args.clone())) }, { let attrs = attr_storage.clone(); - Box::new(move || Box::new(AttrCollector::new(attrs.clone()))) + bm!(AttrCollector::new(attrs.clone())) }, - Box::new(move || Box::new(attrs::PostExpansionEarlyAttributes::new(conf))), - Box::new(|| Box::new(unnecessary_self_imports::UnnecessarySelfImports)), - Box::new(move || Box::new(redundant_static_lifetimes::RedundantStaticLifetimes::new(conf))), - Box::new(move || Box::new(redundant_field_names::RedundantFieldNames::new(conf))), - Box::new(move || Box::new(unnested_or_patterns::UnnestedOrPatterns::new(conf))), - Box::new(|| Box::new(functions::EarlyFunctions)), - Box::new(move || Box::new(doc::Documentation::new(conf))), - Box::new(|| Box::new(suspicious_operation_groupings::SuspiciousOperationGroupings)), - Box::new(|| Box::new(double_parens::DoubleParens)), - Box::new(|| Box::new(unsafe_removed_from_name::UnsafeNameRemoval)), - Box::new(|| Box::new(else_if_without_else::ElseIfWithoutElse)), - Box::new(|| Box::new(int_plus_one::IntPlusOne)), - Box::new(|| Box::new(formatting::Formatting)), - Box::new(|| Box::new(misc_early::MiscEarlyLints)), - Box::new(|| Box::new(unused_unit::UnusedUnit)), - Box::new(|| Box::new(precedence::Precedence)), - Box::new(|| Box::new(redundant_else::RedundantElse)), - Box::new(|| Box::new(needless_arbitrary_self_type::NeedlessArbitrarySelfType)), - Box::new(move || Box::new(literal_representation::LiteralDigitGrouping::new(conf))), - Box::new(move || Box::new(literal_representation::DecimalLiteralRepresentation::new(conf))), - Box::new(|| Box::new(tabs_in_doc_comments::TabsInDocComments)), - Box::new(|| Box::::default()), - Box::new(|| Box::new(option_env_unwrap::OptionEnvUnwrap)), - Box::new(move || Box::new(non_expressive_names::NonExpressiveNames::new(conf))), - Box::new(move || Box::new(nonstandard_macro_braces::MacroBraces::new(conf))), - Box::new(|| Box::new(asm_syntax::InlineAsmX86AttSyntax)), - Box::new(|| Box::new(asm_syntax::InlineAsmX86IntelSyntax)), - Box::new(move || Box::new(module_style::ModStyle::default())), - Box::new(move || Box::new(disallowed_script_idents::DisallowedScriptIdents::new(conf))), - Box::new(|| Box::new(octal_escapes::OctalEscapes)), - Box::new(|| Box::new(single_char_lifetime_names::SingleCharLifetimeNames)), - Box::new(|| Box::new(crate_in_macro_def::CrateInMacroDef)), - Box::new(|| Box::new(pub_use::PubUse)), - Box::new(move || Box::new(large_include_file::LargeIncludeFile::new(conf))), - Box::new(|| Box::::default()), - Box::new(|| Box::new(unused_rounding::UnusedRounding)), - Box::new(move || Box::new(almost_complete_range::AlmostCompleteRange::new(conf))), - Box::new(|| Box::new(multi_assignments::MultiAssignments)), - Box::new(|| Box::new(partial_pub_fields::PartialPubFields)), - Box::new(|| Box::new(let_with_type_underscore::UnderscoreTyped)), - Box::new(move || Box::new(excessive_nesting::ExcessiveNesting::new(conf))), - Box::new(|| Box::new(ref_patterns::RefPatterns)), - Box::new(|| Box::new(needless_else::NeedlessElse)), - Box::new(move || Box::new(raw_strings::RawStrings::new(conf))), - Box::new(|| Box::new(visibility::Visibility)), - Box::new(|| Box::new(multiple_bound_locations::MultipleBoundLocations)), - Box::new(|| Box::new(field_scoped_visibility_modifiers::FieldScopedVisibilityModifiers)), - Box::new(|| Box::new(cfg_not_test::CfgNotTest)), - Box::new(|| Box::new(empty_line_after::EmptyLineAfter::new())), - Box::new(|| Box::new(inline_trait_bounds::InlineTraitBounds)), + bm!(attrs::PostExpansionEarlyAttributes::new(conf)), + b!(unnecessary_self_imports::UnnecessarySelfImports), + bm!(redundant_static_lifetimes::RedundantStaticLifetimes::new(conf)), + bm!(redundant_field_names::RedundantFieldNames::new(conf)), + bm!(unnested_or_patterns::UnnestedOrPatterns::new(conf)), + b!(functions::EarlyFunctions), + bm!(doc::Documentation::new(conf)), + b!(suspicious_operation_groupings::SuspiciousOperationGroupings), + b!(double_parens::DoubleParens), + b!(unsafe_removed_from_name::UnsafeNameRemoval), + b!(else_if_without_else::ElseIfWithoutElse), + b!(int_plus_one::IntPlusOne), + b!(formatting::Formatting), + b!(misc_early::MiscEarlyLints), + b!(unused_unit::UnusedUnit), + b!(precedence::Precedence), + b!(redundant_else::RedundantElse), + b!(needless_arbitrary_self_type::NeedlessArbitrarySelfType), + bm!(literal_representation::LiteralDigitGrouping::new(conf)), + bm!(literal_representation::DecimalLiteralRepresentation::new(conf)), + b!(tabs_in_doc_comments::TabsInDocComments), + b!(single_component_path_imports::SingleComponentPathImports::default()), + b!(option_env_unwrap::OptionEnvUnwrap), + bm!(non_expressive_names::NonExpressiveNames::new(conf)), + bm!(nonstandard_macro_braces::MacroBraces::new(conf)), + b!(asm_syntax::InlineAsmX86AttSyntax), + b!(asm_syntax::InlineAsmX86IntelSyntax), + b!(module_style::ModStyle::default()), + bm!(disallowed_script_idents::DisallowedScriptIdents::new(conf)), + b!(octal_escapes::OctalEscapes), + b!(single_char_lifetime_names::SingleCharLifetimeNames), + b!(crate_in_macro_def::CrateInMacroDef), + b!(pub_use::PubUse), + bm!(large_include_file::LargeIncludeFile::new(conf)), + b!(duplicate_mod::DuplicateMod::default()), + b!(unused_rounding::UnusedRounding), + bm!(almost_complete_range::AlmostCompleteRange::new(conf)), + b!(multi_assignments::MultiAssignments), + b!(partial_pub_fields::PartialPubFields), + b!(let_with_type_underscore::UnderscoreTyped), + bm!(excessive_nesting::ExcessiveNesting::new(conf)), + b!(ref_patterns::RefPatterns), + b!(needless_else::NeedlessElse), + bm!(raw_strings::RawStrings::new(conf)), + b!(visibility::Visibility), + b!(multiple_bound_locations::MultipleBoundLocations), + b!(field_scoped_visibility_modifiers::FieldScopedVisibilityModifiers), + b!(cfg_not_test::CfgNotTest), + b!(empty_line_after::EmptyLineAfter::new()), + b!(inline_trait_bounds::InlineTraitBounds), // add early passes here, used by `cargo dev new_lint` ]; store.early_passes.extend(early_lints); + macro_rules! b { ($e:expr) => { Box::new(|_| Box::new($e)) } } + macro_rules! bm { ($e:expr) => { Box::new(move |_| Box::new($e)) } } + macro_rules! bmt { ($e:expr) => { Box::new(move |tcx| Box::new($e(tcx))) } } + #[expect(clippy::type_complexity)] let late_lints: [LateLintPassFactory; _] = [ - Box::new(move |_| Box::new(operators::arithmetic_side_effects::ArithmeticSideEffects::new(conf))), - Box::new(|_| Box::new(utils::dump_hir::DumpHir)), - Box::new(|_| Box::new(utils::author::Author)), - Box::new(move |tcx| Box::new(await_holding_invalid::AwaitHolding::new(tcx, conf))), - Box::new(|_| Box::new(serde_api::SerdeApi)), - Box::new(move |_| Box::new(types::Types::new(conf))), - Box::new(move |_| Box::new(booleans::NonminimalBool::new(conf))), - Box::new(|_| Box::new(enum_clike::UnportableVariant)), - Box::new(move |_| Box::new(float_literal::FloatLiteral::new(conf))), - Box::new(|_| Box::new(ptr::Ptr)), - Box::new(|_| Box::new(needless_bool::NeedlessBool)), - Box::new(|_| Box::new(bool_comparison::BoolComparison)), - Box::new(|_| Box::new(needless_for_each::NeedlessForEach)), - Box::new(|_| Box::new(misc::LintPass)), - Box::new(|_| Box::new(eta_reduction::EtaReduction)), - Box::new(|_| Box::new(mut_mut::MutMut::default())), - Box::new(|_| Box::new(unnecessary_mut_passed::UnnecessaryMutPassed)), - Box::new(|_| Box::>::default()), - Box::new(move |_| Box::new(len_zero::LenZero::new(conf))), - Box::new(|_| Box::new(len_without_is_empty::LenWithoutIsEmpty)), - Box::new(move |_| Box::new(attrs::Attributes::new(conf))), - Box::new(|_| Box::new(blocks_in_conditions::BlocksInConditions)), - Box::new(|_| Box::new(unicode::Unicode)), - Box::new(|_| Box::new(uninit_vec::UninitVec)), - Box::new(|_| Box::new(unit_return_expecting_ord::UnitReturnExpectingOrd)), - Box::new(|_| Box::new(strings::StringAdd)), - Box::new(|_| Box::new(implicit_return::ImplicitReturn)), - Box::new(move |_| Box::new(implicit_saturating_sub::ImplicitSaturatingSub::new(conf))), - Box::new(|_| Box::new(default_numeric_fallback::DefaultNumericFallback)), - Box::new(|_| Box::new(non_octal_unix_permissions::NonOctalUnixPermissions)), - Box::new(move |_| Box::new(approx_const::ApproxConstant::new(conf))), - Box::new(move |_| Box::new(matches::Matches::new(conf))), - Box::new(move |_| Box::new(manual_non_exhaustive::ManualNonExhaustive::new(conf))), - Box::new(move |_| Box::new(manual_strip::ManualStrip::new(conf))), - Box::new(move |_| Box::new(checked_conversions::CheckedConversions::new(conf))), - Box::new(move |_| Box::new(mem_replace::MemReplace::new(conf))), - Box::new(move |_| Box::new(ranges::Ranges::new(conf))), - Box::new(move |_| Box::new(from_over_into::FromOverInto::new(conf))), - Box::new(move |_| Box::new(use_self::UseSelf::new(conf))), - Box::new(move |_| Box::new(missing_const_for_fn::MissingConstForFn::new(conf))), - Box::new(move |_| Box::new(needless_question_mark::NeedlessQuestionMark)), - Box::new(move |_| Box::new(casts::Casts::new(conf))), - Box::new(|_| Box::new(size_of_in_element_count::SizeOfInElementCount)), - Box::new(|_| Box::new(same_name_method::SameNameMethod)), - Box::new(move |_| Box::new(index_refutable_slice::IndexRefutableSlice::new(conf))), - Box::new(|_| Box::::default()), - Box::new(move |_| { - Box::new(inconsistent_struct_constructor::InconsistentStructConstructor::new( - conf, - )) - }), + bm!(operators::arithmetic_side_effects::ArithmeticSideEffects::new(conf)), + b!(utils::dump_hir::DumpHir), + b!(utils::author::Author), + bmt!(|tcx| await_holding_invalid::AwaitHolding::new(tcx, conf)), + b!(serde_api::SerdeApi), + bm!(types::Types::new(conf)), + bm!(booleans::NonminimalBool::new(conf)), + b!(enum_clike::UnportableVariant), + bm!(float_literal::FloatLiteral::new(conf)), + b!(ptr::Ptr), + b!(needless_bool::NeedlessBool), + b!(bool_comparison::BoolComparison), + b!(needless_for_each::NeedlessForEach), + b!(misc::LintPass), + b!(eta_reduction::EtaReduction), + b!(mut_mut::MutMut::default()), + b!(unnecessary_mut_passed::UnnecessaryMutPassed), + b!(significant_drop_tightening::SignificantDropTightening::default()), + bm!(len_zero::LenZero::new(conf)), + b!(len_without_is_empty::LenWithoutIsEmpty), + bm!(attrs::Attributes::new(conf)), + b!(blocks_in_conditions::BlocksInConditions), + b!(unicode::Unicode), + b!(uninit_vec::UninitVec), + b!(unit_return_expecting_ord::UnitReturnExpectingOrd), + b!(strings::StringAdd), + b!(implicit_return::ImplicitReturn), + bm!(implicit_saturating_sub::ImplicitSaturatingSub::new(conf)), + b!(default_numeric_fallback::DefaultNumericFallback), + b!(non_octal_unix_permissions::NonOctalUnixPermissions), + bm!(approx_const::ApproxConstant::new(conf)), + bm!(matches::Matches::new(conf)), + bm!(manual_non_exhaustive::ManualNonExhaustive::new(conf)), + bm!(manual_strip::ManualStrip::new(conf)), + bm!(checked_conversions::CheckedConversions::new(conf)), + bm!(mem_replace::MemReplace::new(conf)), + bm!(ranges::Ranges::new(conf)), + bm!(from_over_into::FromOverInto::new(conf)), + bm!(use_self::UseSelf::new(conf)), + bm!(missing_const_for_fn::MissingConstForFn::new(conf)), + b!(needless_question_mark::NeedlessQuestionMark), + bm!(casts::Casts::new(conf)), + b!(size_of_in_element_count::SizeOfInElementCount), + b!(same_name_method::SameNameMethod), + bm!(index_refutable_slice::IndexRefutableSlice::new(conf)), + b!(shadow::Shadow::default()), + bm!(inconsistent_struct_constructor::InconsistentStructConstructor::new(conf)), { let format_args = format_args_storage.clone(); - Box::new(move |_| Box::new(methods::Methods::new(conf, format_args.clone()))) + bm!(methods::Methods::new(conf, format_args.clone())) }, { let format_args = format_args_storage.clone(); - Box::new(move |_| Box::new(unit_types::UnitTypes::new(format_args.clone()))) + bm!(unit_types::UnitTypes::new(format_args.clone())) }, - Box::new(move |_| Box::new(loops::Loops::new(conf))), - Box::new(|_| Box::::default()), - Box::new(move |_| Box::new(lifetimes::Lifetimes::new(conf))), - Box::new(|_| Box::new(entry::HashMapPass)), - Box::new(|_| Box::new(minmax::MinMaxPass)), - Box::new(|_| Box::new(zero_div_zero::ZeroDiv)), - Box::new(|_| Box::new(mutex_atomic::Mutex)), - Box::new(|_| Box::new(needless_update::NeedlessUpdate)), - Box::new(|_| Box::new(needless_borrowed_ref::NeedlessBorrowedRef)), - Box::new(|_| Box::new(borrow_deref_ref::BorrowDerefRef)), - Box::new(|_| Box::::default()), - Box::new(|_| Box::new(temporary_assignment::TemporaryAssignment)), - Box::new(move |_| Box::new(transmute::Transmute::new(conf))), - Box::new(move |_| Box::new(cognitive_complexity::CognitiveComplexity::new(conf))), - Box::new(move |_| Box::new(escape::BoxedLocal::new(conf))), - Box::new(move |_| Box::new(useless_vec::UselessVec::new(conf))), - Box::new(move |_| Box::new(panic_unimplemented::PanicUnimplemented::new(conf))), - Box::new(|_| Box::new(strings::StringLitAsBytes)), - Box::new(|_| Box::new(derive::Derive)), - Box::new(move |_| Box::new(derivable_impls::DerivableImpls::new(conf))), - Box::new(|_| Box::new(drop_forget_ref::DropForgetRef)), - Box::new(|_| Box::new(empty_enums::EmptyEnums)), - Box::new(|_| Box::::default()), - Box::new(move |tcx| Box::new(ifs::CopyAndPaste::new(tcx, conf))), - Box::new(|_| Box::new(copy_iterator::CopyIterator)), + bm!(loops::Loops::new(conf)), + b!(main_recursion::MainRecursion::default()), + bm!(lifetimes::Lifetimes::new(conf)), + b!(entry::HashMapPass), + b!(minmax::MinMaxPass), + b!(zero_div_zero::ZeroDiv), + b!(mutex_atomic::Mutex), + b!(needless_update::NeedlessUpdate), + b!(needless_borrowed_ref::NeedlessBorrowedRef), + b!(borrow_deref_ref::BorrowDerefRef), + b!(no_effect::NoEffect::default()), + b!(temporary_assignment::TemporaryAssignment), + bm!(transmute::Transmute::new(conf)), + bm!(cognitive_complexity::CognitiveComplexity::new(conf)), + bm!(escape::BoxedLocal::new(conf)), + bm!(useless_vec::UselessVec::new(conf)), + bm!(panic_unimplemented::PanicUnimplemented::new(conf)), + b!(strings::StringLitAsBytes), + b!(derive::Derive), + bm!(derivable_impls::DerivableImpls::new(conf)), + b!(drop_forget_ref::DropForgetRef), + b!(empty_enums::EmptyEnums), + b!(regex::Regex::default()), + bmt!(|tcx| ifs::CopyAndPaste::new(tcx, conf)), + b!(copy_iterator::CopyIterator), { let format_args = format_args_storage.clone(); - Box::new(move |_| Box::new(format::UselessFormat::new(format_args.clone()))) + bm!(format::UselessFormat::new(format_args.clone())) }, - Box::new(|_| Box::new(swap::Swap)), - Box::new(|_| Box::new(panicking_overflow_checks::PanickingOverflowChecks)), - Box::new(|_| Box::::default()), - Box::new(move |_| Box::new(disallowed_names::DisallowedNames::new(conf))), - Box::new(move |tcx| Box::new(functions::Functions::new(tcx, conf))), - Box::new(move |_| Box::new(doc::Documentation::new(conf))), - Box::new(|_| Box::new(neg_multiply::NegMultiply)), - Box::new(|_| Box::new(let_if_seq::LetIfSeq)), - Box::new(|_| Box::new(mixed_read_write_in_expression::EvalOrderDependence)), - Box::new(move |_| Box::new(missing_doc::MissingDoc::new(conf))), - Box::new(|_| Box::new(missing_inline::MissingInline)), - Box::new(move |_| Box::new(exhaustive_items::ExhaustiveItems)), - Box::new(|_| Box::new(unused_result_ok::UnusedResultOk)), - Box::new(|_| Box::new(match_result_ok::MatchResultOk)), - Box::new(|_| Box::new(partialeq_ne_impl::PartialEqNeImpl)), - Box::new(|_| Box::new(unused_io_amount::UnusedIoAmount)), - Box::new(move |_| Box::new(large_enum_variant::LargeEnumVariant::new(conf))), + b!(swap::Swap), + b!(panicking_overflow_checks::PanickingOverflowChecks), + b!(new_without_default::NewWithoutDefault::default()), + bm!(disallowed_names::DisallowedNames::new(conf)), + bmt!(|tcx| functions::Functions::new(tcx, conf)), + bm!(doc::Documentation::new(conf)), + b!(neg_multiply::NegMultiply), + b!(let_if_seq::LetIfSeq), + b!(mixed_read_write_in_expression::EvalOrderDependence), + bm!(missing_doc::MissingDoc::new(conf)), + b!(missing_inline::MissingInline), + b!(exhaustive_items::ExhaustiveItems), + b!(unused_result_ok::UnusedResultOk), + b!(match_result_ok::MatchResultOk), + b!(partialeq_ne_impl::PartialEqNeImpl), + b!(unused_io_amount::UnusedIoAmount), + bm!(large_enum_variant::LargeEnumVariant::new(conf)), { let format_args = format_args_storage.clone(); - Box::new(move |_| Box::new(explicit_write::ExplicitWrite::new(format_args.clone()))) + bm!(explicit_write::ExplicitWrite::new(format_args.clone())) }, - Box::new(|_| Box::new(needless_pass_by_value::NeedlessPassByValue)), - Box::new(move |tcx| Box::new(pass_by_ref_or_value::PassByRefOrValue::new(tcx, conf))), - Box::new(|_| Box::new(ref_option_ref::RefOptionRef)), - Box::new(|_| Box::new(infinite_iter::InfiniteIter)), - Box::new(|_| Box::new(inline_fn_without_body::InlineFnWithoutBody)), - Box::new(|_| Box::::default()), - Box::new(|_| Box::new(implicit_hasher::ImplicitHasher)), - Box::new(|_| Box::new(fallible_impl_from::FallibleImplFrom)), - Box::new(move |_| Box::new(question_mark::QuestionMark::new(conf))), - Box::new(|_| Box::new(question_mark_used::QuestionMarkUsed)), - Box::new(|_| Box::new(suspicious_trait_impl::SuspiciousImpl)), - Box::new(|_| Box::new(map_unit_fn::MapUnit)), - Box::new(move |_| Box::new(inherent_impl::MultipleInherentImpl::new(conf))), - Box::new(|_| Box::new(neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd)), - Box::new(move |_| Box::new(unwrap::Unwrap::new(conf))), - Box::new(move |_| Box::new(indexing_slicing::IndexingSlicing::new(conf))), - Box::new(move |tcx| Box::new(non_copy_const::NonCopyConst::new(tcx, conf))), - Box::new(|_| Box::new(redundant_clone::RedundantClone)), - Box::new(|_| Box::new(slow_vector_initialization::SlowVectorInit)), - Box::new(move |_| Box::new(unnecessary_wraps::UnnecessaryWraps::new(conf))), - Box::new(|_| Box::new(assertions_on_constants::AssertionsOnConstants::new(conf))), - Box::new(|_| Box::new(assertions_on_result_states::AssertionsOnResultStates)), - Box::new(|_| Box::new(inherent_to_string::InherentToString)), - Box::new(move |_| Box::new(trait_bounds::TraitBounds::new(conf))), - Box::new(|_| Box::new(comparison_chain::ComparisonChain)), - Box::new(move |tcx| Box::new(mut_key::MutableKeyType::new(tcx, conf))), - Box::new(|_| Box::new(reference::DerefAddrOf)), - { - let format_args = format_args_storage.clone(); - Box::new(move |_| Box::new(format_impl::FormatImpl::new(format_args.clone()))) - }, - Box::new(|_| Box::new(redundant_closure_call::RedundantClosureCall)), - Box::new(|_| Box::new(unused_unit::UnusedUnit)), - Box::new(|_| Box::new(returns::Return)), - Box::new(move |_| Box::new(collapsible_if::CollapsibleIf::new(conf))), - Box::new(|_| Box::new(items_after_statements::ItemsAfterStatements)), - Box::new(|_| Box::new(needless_parens_on_range_literals::NeedlessParensOnRangeLiterals)), - Box::new(|_| Box::new(needless_continue::NeedlessContinue)), - Box::new(|_| Box::new(create_dir::CreateDir)), - Box::new(move |_| Box::new(item_name_repetitions::ItemNameRepetitions::new(conf))), - Box::new(move |_| Box::new(upper_case_acronyms::UpperCaseAcronyms::new(conf))), - Box::new(|_| Box::::default()), - Box::new(move |_| Box::new(unused_self::UnusedSelf::new(conf))), - Box::new(|_| Box::new(mutable_debug_assertion::DebugAssertWithMutCall)), - Box::new(|_| Box::new(exit::Exit)), - Box::new(move |_| Box::new(to_digit_is_some::ToDigitIsSome::new(conf))), - Box::new(move |_| Box::new(large_stack_arrays::LargeStackArrays::new(conf))), - Box::new(move |_| Box::new(large_const_arrays::LargeConstArrays::new(conf))), - Box::new(|_| Box::new(floating_point_arithmetic::FloatingPointArithmetic)), - Box::new(|_| Box::new(as_conversions::AsConversions)), - Box::new(|_| Box::new(let_underscore::LetUnderscore)), - Box::new(move |_| Box::new(excessive_bools::ExcessiveBools::new(conf))), - Box::new(move |_| Box::new(wildcard_imports::WildcardImports::new(conf))), - Box::new(|_| Box::::default()), - Box::new(|_| Box::>::default()), - Box::new(|_| Box::new(option_if_let_else::OptionIfLetElse)), - Box::new(|_| Box::new(future_not_send::FutureNotSend)), - Box::new(move |_| Box::new(large_futures::LargeFuture::new(conf))), - Box::new(|_| Box::new(if_let_mutex::IfLetMutex)), - Box::new(|_| Box::new(if_not_else::IfNotElse)), - Box::new(|_| Box::new(equatable_if_let::PatternEquality)), - Box::new(|_| Box::new(manual_async_fn::ManualAsyncFn)), - Box::new(|_| Box::new(panic_in_result_fn::PanicInResultFn)), - Box::new(|_| Box::::default()), - Box::new(|_| Box::new(pattern_type_mismatch::PatternTypeMismatch)), - Box::new(|_| Box::::default()), - Box::new(|_| Box::new(semicolon_if_nothing_returned::SemicolonIfNothingReturned)), - Box::new(|_| Box::new(async_yields_async::AsyncYieldsAsync)), - { - let attrs = attr_storage.clone(); - Box::new(move |tcx| Box::new(disallowed_macros::DisallowedMacros::new(tcx, conf, attrs.clone()))) + b!(needless_pass_by_value::NeedlessPassByValue), + bmt!(|tcx| pass_by_ref_or_value::PassByRefOrValue::new(tcx, conf)), + b!(ref_option_ref::RefOptionRef), + b!(infinite_iter::InfiniteIter), + b!(inline_fn_without_body::InlineFnWithoutBody), + b!(useless_conversion::UselessConversion::default()), + b!(implicit_hasher::ImplicitHasher), + b!(fallible_impl_from::FallibleImplFrom), + bm!(question_mark::QuestionMark::new(conf)), + b!(question_mark_used::QuestionMarkUsed), + b!(suspicious_trait_impl::SuspiciousImpl), + b!(map_unit_fn::MapUnit), + bm!(inherent_impl::MultipleInherentImpl::new(conf)), + b!(neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd), + bm!(unwrap::Unwrap::new(conf)), + bm!(indexing_slicing::IndexingSlicing::new(conf)), + bmt!(|tcx| non_copy_const::NonCopyConst::new(tcx, conf)), + b!(redundant_clone::RedundantClone), + b!(slow_vector_initialization::SlowVectorInit), + bm!(unnecessary_wraps::UnnecessaryWraps::new(conf)), + bm!(assertions_on_constants::AssertionsOnConstants::new(conf)), + b!(assertions_on_result_states::AssertionsOnResultStates), + b!(inherent_to_string::InherentToString), + bm!(trait_bounds::TraitBounds::new(conf)), + b!(comparison_chain::ComparisonChain), + bmt!(|tcx| mut_key::MutableKeyType::new(tcx, conf)), + b!(reference::DerefAddrOf), + { + let format_args = format_args_storage.clone(); + bm!(format_impl::FormatImpl::new(format_args.clone())) + }, + b!(redundant_closure_call::RedundantClosureCall), + b!(unused_unit::UnusedUnit), + b!(returns::Return), + bm!(collapsible_if::CollapsibleIf::new(conf)), + b!(items_after_statements::ItemsAfterStatements), + b!(needless_parens_on_range_literals::NeedlessParensOnRangeLiterals), + b!(needless_continue::NeedlessContinue), + b!(create_dir::CreateDir), + bm!(item_name_repetitions::ItemNameRepetitions::new(conf)), + bm!(upper_case_acronyms::UpperCaseAcronyms::new(conf)), + b!(default::Default::default()), + bm!(unused_self::UnusedSelf::new(conf)), + b!(mutable_debug_assertion::DebugAssertWithMutCall), + b!(exit::Exit), + bm!(to_digit_is_some::ToDigitIsSome::new(conf)), + bm!(large_stack_arrays::LargeStackArrays::new(conf)), + bm!(large_const_arrays::LargeConstArrays::new(conf)), + b!(floating_point_arithmetic::FloatingPointArithmetic), + b!(as_conversions::AsConversions), + b!(let_underscore::LetUnderscore), + bm!(excessive_bools::ExcessiveBools::new(conf)), + bm!(wildcard_imports::WildcardImports::new(conf)), + b!(redundant_pub_crate::RedundantPubCrate::default()), + b!(dereference::Dereferencing::default()), + b!(option_if_let_else::OptionIfLetElse), + b!(future_not_send::FutureNotSend), + bm!(large_futures::LargeFuture::new(conf)), + b!(if_let_mutex::IfLetMutex), + b!(if_not_else::IfNotElse), + b!(equatable_if_let::PatternEquality), + b!(manual_async_fn::ManualAsyncFn), + b!(panic_in_result_fn::PanicInResultFn), + b!(macro_use::MacroUseImports::default()), + b!(pattern_type_mismatch::PatternTypeMismatch), + b!(unwrap_in_result::UnwrapInResult::default()), + b!(semicolon_if_nothing_returned::SemicolonIfNothingReturned), + b!(async_yields_async::AsyncYieldsAsync), + { + let attrs = attr_storage.clone(); + bmt!(|tcx| disallowed_macros::DisallowedMacros::new(tcx, conf, attrs.clone())) }, - Box::new(move |tcx| Box::new(disallowed_methods::DisallowedMethods::new(tcx, conf))), - Box::new(|_| Box::new(empty_drop::EmptyDrop)), - Box::new(|_| Box::new(strings::StrToString)), - Box::new(|_| Box::new(zero_sized_map_values::ZeroSizedMapValues)), - Box::new(|_| Box::::default()), - Box::new(|_| Box::new(redundant_slicing::RedundantSlicing)), - Box::new(|_| Box::new(from_str_radix_10::FromStrRadix10)), - Box::new(move |_| Box::new(if_then_some_else_none::IfThenSomeElseNone::new(conf))), - Box::new(|_| Box::new(bool_assert_comparison::BoolAssertComparison)), - Box::new(|_| Box::::default()), - Box::new(move |tcx| Box::new(disallowed_types::DisallowedTypes::new(tcx, conf))), - Box::new(move |tcx| Box::new(missing_enforced_import_rename::ImportRename::new(tcx, conf))), - Box::new(move |_| Box::new(strlen_on_c_strings::StrlenOnCStrings::new(conf))), - Box::new(move |_| Box::new(self_named_constructors::SelfNamedConstructors)), - Box::new(move |_| Box::new(iter_not_returning_iterator::IterNotReturningIterator)), - Box::new(move |_| Box::new(manual_assert::ManualAssert)), - Box::new(move |_| Box::new(non_send_fields_in_send_ty::NonSendFieldInSendTy::new(conf))), - Box::new(move |_| Box::new(undocumented_unsafe_blocks::UndocumentedUnsafeBlocks::new(conf))), + bmt!(|tcx| disallowed_methods::DisallowedMethods::new(tcx, conf)), + b!(empty_drop::EmptyDrop), + b!(strings::StrToString), + b!(zero_sized_map_values::ZeroSizedMapValues), + b!(vec_init_then_push::VecInitThenPush::default()), + b!(redundant_slicing::RedundantSlicing), + b!(from_str_radix_10::FromStrRadix10), + bm!(if_then_some_else_none::IfThenSomeElseNone::new(conf)), + b!(bool_assert_comparison::BoolAssertComparison), + b!(unused_async::UnusedAsync::default()), + bmt!(|tcx| disallowed_types::DisallowedTypes::new(tcx, conf)), + bmt!(|tcx| missing_enforced_import_rename::ImportRename::new(tcx, conf)), + bm!(strlen_on_c_strings::StrlenOnCStrings::new(conf)), + b!(self_named_constructors::SelfNamedConstructors), + b!(iter_not_returning_iterator::IterNotReturningIterator), + b!(manual_assert::ManualAssert), + bm!(non_send_fields_in_send_ty::NonSendFieldInSendTy::new(conf)), + bm!(undocumented_unsafe_blocks::UndocumentedUnsafeBlocks::new(conf)), { let format_args = format_args_storage.clone(); - Box::new(move |tcx| Box::new(format_args::FormatArgs::new(tcx, conf, format_args.clone()))) + bmt!(|tcx| format_args::FormatArgs::new(tcx, conf, format_args.clone())) }, - Box::new(|_| Box::new(trailing_empty_array::TrailingEmptyArray)), - Box::new(|_| Box::new(needless_late_init::NeedlessLateInit)), - Box::new(|_| Box::new(return_self_not_must_use::ReturnSelfNotMustUse)), - Box::new(|_| Box::new(init_numbered_fields::NumberedFields)), - Box::new(move |_| Box::new(manual_bits::ManualBits::new(conf))), - Box::new(|_| Box::new(default_union_representation::DefaultUnionRepresentation)), - Box::new(|_| Box::::default()), - Box::new(move |_| Box::new(dbg_macro::DbgMacro::new(conf))), + b!(trailing_empty_array::TrailingEmptyArray), + b!(needless_late_init::NeedlessLateInit), + b!(return_self_not_must_use::ReturnSelfNotMustUse), + b!(init_numbered_fields::NumberedFields), + bm!(manual_bits::ManualBits::new(conf)), + b!(default_union_representation::DefaultUnionRepresentation), + b!(only_used_in_recursion::OnlyUsedInRecursion::default()), + bm!(dbg_macro::DbgMacro::new(conf)), { let format_args = format_args_storage.clone(); - Box::new(move |_| Box::new(write::Write::new(conf, format_args.clone()))) + bm!(write::Write::new(conf, format_args.clone())) }, - Box::new(move |_| Box::new(cargo::Cargo::new(conf))), - Box::new(|_| Box::new(empty_with_brackets::EmptyWithBrackets::default())), - Box::new(|_| Box::new(unnecessary_owned_empty_strings::UnnecessaryOwnedEmptyStrings)), + bm!(cargo::Cargo::new(conf)), + b!(empty_with_brackets::EmptyWithBrackets::default()), + b!(unnecessary_owned_empty_strings::UnnecessaryOwnedEmptyStrings), { let format_args = format_args_storage.clone(); - Box::new(move |_| Box::new(format_push_string::FormatPushString::new(format_args.clone()))) + bm!(format_push_string::FormatPushString::new(format_args.clone())) }, - Box::new(move |_| Box::new(large_include_file::LargeIncludeFile::new(conf))), - Box::new(|_| Box::new(strings::TrimSplitWhitespace)), - Box::new(|_| Box::new(rc_clone_in_vec_init::RcCloneInVecInit)), - Box::new(|_| Box::new(swap_ptr_to_ref::SwapPtrToRef)), - Box::new(|_| Box::new(mismatching_type_param_order::TypeParamMismatch)), - Box::new(|_| Box::new(read_zero_byte_vec::ReadZeroByteVec)), - Box::new(|_| Box::new(default_instead_of_iter_empty::DefaultIterEmpty)), - Box::new(move |_| Box::new(manual_rem_euclid::ManualRemEuclid::new(conf))), - Box::new(move |_| Box::new(manual_retain::ManualRetain::new(conf))), - Box::new(move |_| Box::new(manual_rotate::ManualRotate)), - Box::new(move |_| Box::new(operators::Operators::new(conf))), - Box::new(move |_| Box::new(std_instead_of_core::StdReexports::new(conf))), - Box::new(move |_| Box::new(time_subtraction::UncheckedTimeSubtraction::new(conf))), - Box::new(|_| Box::new(partialeq_to_none::PartialeqToNone)), - Box::new(move |_| Box::new(manual_abs_diff::ManualAbsDiff::new(conf))), - Box::new(move |_| Box::new(manual_clamp::ManualClamp::new(conf))), - Box::new(|_| Box::new(manual_string_new::ManualStringNew)), - Box::new(|_| Box::new(unused_peekable::UnusedPeekable)), - Box::new(|_| Box::new(bool_to_int_with_if::BoolToIntWithIf)), - Box::new(|_| Box::new(box_default::BoxDefault)), - Box::new(|_| Box::new(implicit_saturating_add::ImplicitSaturatingAdd)), - Box::new(|_| Box::new(missing_trait_methods::MissingTraitMethods)), - Box::new(|_| Box::new(from_raw_with_void_ptr::FromRawWithVoidPtr)), - Box::new(|_| Box::new(suspicious_xor_used_as_pow::ConfusingXorAndPow)), - Box::new(move |_| Box::new(manual_is_ascii_check::ManualIsAsciiCheck::new(conf))), - Box::new(move |_| Box::new(semicolon_block::SemicolonBlock::new(conf))), - Box::new(|_| Box::new(permissions_set_readonly_false::PermissionsSetReadonlyFalse)), - Box::new(|_| Box::new(size_of_ref::SizeOfRef)), - Box::new(|_| Box::new(multiple_unsafe_ops_per_block::MultipleUnsafeOpsPerBlock)), - Box::new(move |_| Box::new(extra_unused_type_parameters::ExtraUnusedTypeParameters::new(conf))), - Box::new(|_| Box::new(no_mangle_with_rust_abi::NoMangleWithRustAbi)), - Box::new(|_| Box::new(collection_is_never_read::CollectionIsNeverRead)), - Box::new(|_| Box::new(missing_assert_message::MissingAssertMessage)), - Box::new(|_| Box::new(needless_maybe_sized::NeedlessMaybeSized)), - Box::new(|_| Box::new(redundant_async_block::RedundantAsyncBlock)), - Box::new(move |_| Box::new(manual_main_separator_str::ManualMainSeparatorStr::new(conf))), - Box::new(|_| Box::new(unnecessary_struct_initialization::UnnecessaryStruct)), - Box::new(move |_| Box::new(unnecessary_box_returns::UnnecessaryBoxReturns::new(conf))), - Box::new(|_| Box::new(tests_outside_test_module::TestsOutsideTestModule)), - Box::new(|_| Box::new(manual_slice_size_calculation::ManualSliceSizeCalculation::new(conf))), - Box::new(|_| Box::new(items_after_test_module::ItemsAfterTestModule)), - Box::new(|_| Box::new(default_constructed_unit_structs::DefaultConstructedUnitStructs)), - Box::new(|_| Box::new(missing_fields_in_debug::MissingFieldsInDebug)), - Box::new(|_| Box::new(endian_bytes::EndianBytes)), - Box::new(|_| Box::new(redundant_type_annotations::RedundantTypeAnnotations)), - Box::new(|_| Box::new(arc_with_non_send_sync::ArcWithNonSendSync)), - Box::new(|_| Box::new(needless_ifs::NeedlessIfs)), - Box::new(move |_| Box::new(min_ident_chars::MinIdentChars::new(conf))), - Box::new(move |_| Box::new(large_stack_frames::LargeStackFrames::new(conf))), - Box::new(|_| Box::new(single_range_in_vec_init::SingleRangeInVecInit)), - Box::new(move |_| Box::new(needless_pass_by_ref_mut::NeedlessPassByRefMut::new(conf))), - Box::new(|tcx| Box::new(non_canonical_impls::NonCanonicalImpls::new(tcx))), - Box::new(move |_| Box::new(single_call_fn::SingleCallFn::new(conf))), - Box::new(move |_| Box::new(legacy_numeric_constants::LegacyNumericConstants::new(conf))), - Box::new(|_| Box::new(manual_range_patterns::ManualRangePatterns)), - Box::new(move |_| Box::new(tuple_array_conversions::TupleArrayConversions::new(conf))), - Box::new(move |_| Box::new(manual_float_methods::ManualFloatMethods::new(conf))), - Box::new(|_| Box::new(four_forward_slashes::FourForwardSlashes)), - Box::new(|_| Box::new(error_impl_error::ErrorImplError)), - Box::new(move |_| Box::new(absolute_paths::AbsolutePaths::new(conf))), - Box::new(|_| Box::new(redundant_locals::RedundantLocals)), - Box::new(|_| Box::new(ignored_unit_patterns::IgnoredUnitPatterns)), - Box::new(|_| Box::::default()), - Box::new(|_| Box::new(implied_bounds_in_impls::ImpliedBoundsInImpls)), - Box::new(|_| Box::new(missing_asserts_for_indexing::MissingAssertsForIndexing)), - Box::new(|_| Box::new(unnecessary_map_on_constructor::UnnecessaryMapOnConstructor)), - Box::new(move |_| { - Box::new(needless_borrows_for_generic_args::NeedlessBorrowsForGenericArgs::new( - conf, - )) - }), - Box::new(move |_| Box::new(manual_hash_one::ManualHashOne::new(conf))), - Box::new(|_| Box::new(iter_without_into_iter::IterWithoutIntoIter)), - Box::new(|_| Box::>::default()), - Box::new(|_| Box::new(iter_over_hash_type::IterOverHashType)), - Box::new(|_| Box::new(impl_hash_with_borrow_str_and_bytes::ImplHashWithBorrowStrBytes)), - Box::new(move |_| Box::new(repeat_vec_with_capacity::RepeatVecWithCapacity::new(conf))), - Box::new(|_| Box::new(uninhabited_references::UninhabitedReferences)), - Box::new(|_| Box::new(ineffective_open_options::IneffectiveOpenOptions)), - Box::new(|_| Box::::default()), - Box::new(move |_| Box::new(pub_underscore_fields::PubUnderscoreFields::new(conf))), - Box::new(move |_| Box::new(missing_const_for_thread_local::MissingConstForThreadLocal::new(conf))), - Box::new(move |tcx| Box::new(incompatible_msrv::IncompatibleMsrv::new(tcx, conf))), - Box::new(|_| Box::new(to_string_trait_impl::ToStringTraitImpl)), - Box::new(move |_| Box::new(assigning_clones::AssigningClones::new(conf))), - Box::new(|_| Box::new(zero_repeat_side_effects::ZeroRepeatSideEffects)), - Box::new(move |_| Box::new(macro_metavars_in_unsafe::ExprMetavarsInUnsafe::new(conf))), - Box::new(move |_| Box::new(string_patterns::StringPatterns::new(conf))), - Box::new(|_| Box::new(set_contains_or_insert::SetContainsOrInsert)), - Box::new(|_| Box::new(zombie_processes::ZombieProcesses)), - Box::new(|_| Box::new(pointers_in_nomem_asm_block::PointersInNomemAsmBlock)), - Box::new(move |_| Box::new(manual_is_power_of_two::ManualIsPowerOfTwo::new(conf))), - Box::new(|_| Box::new(non_zero_suggestions::NonZeroSuggestions)), - Box::new(|_| Box::new(literal_string_with_formatting_args::LiteralStringWithFormattingArg)), - Box::new(move |_| Box::new(unused_trait_names::UnusedTraitNames::new(conf))), - Box::new(|_| Box::new(manual_ignore_case_cmp::ManualIgnoreCaseCmp)), - Box::new(|_| Box::new(unnecessary_literal_bound::UnnecessaryLiteralBound)), - Box::new(move |_| Box::new(arbitrary_source_item_ordering::ArbitrarySourceItemOrdering::new(conf))), - Box::new(|_| Box::new(useless_concat::UselessConcat)), - Box::new(|_| Box::new(unneeded_struct_pattern::UnneededStructPattern)), - Box::new(|_| Box::::default()), - Box::new(move |_| Box::new(non_std_lazy_statics::NonStdLazyStatic::new(conf))), - Box::new(|_| Box::new(manual_option_as_slice::ManualOptionAsSlice::new(conf))), - Box::new(|_| Box::new(single_option_map::SingleOptionMap)), - Box::new(move |_| Box::new(redundant_test_prefix::RedundantTestPrefix)), - Box::new(|_| Box::new(cloned_ref_to_slice_refs::ClonedRefToSliceRefs::new(conf))), - Box::new(|_| Box::new(infallible_try_from::InfallibleTryFrom)), - Box::new(|_| Box::new(coerce_container_to_any::CoerceContainerToAny)), - Box::new(|_| Box::new(toplevel_ref_arg::ToplevelRefArg)), - Box::new(|_| Box::new(volatile_composites::VolatileComposites)), - Box::new(|_| Box::::default()), - Box::new(move |tcx| Box::new(disallowed_fields::DisallowedFields::new(tcx, conf))), - Box::new(move |_| Box::new(manual_ilog2::ManualIlog2::new(conf))), - Box::new(|_| Box::new(same_length_and_capacity::SameLengthAndCapacity)), - Box::new(move |tcx| Box::new(duration_suboptimal_units::DurationSuboptimalUnits::new(tcx, conf))), - Box::new(move |_| Box::new(manual_take::ManualTake::new(conf))), - Box::new(|_| Box::new(manual_checked_ops::ManualCheckedOps)), - Box::new(move |tcx| Box::new(manual_pop_if::ManualPopIf::new(tcx, conf))), - Box::new(move |_| Box::new(manual_noop_waker::ManualNoopWaker::new(conf))), - Box::new(|_| Box::new(byte_char_slices::ByteCharSlice)), - Box::new(|_| Box::new(manual_assert_eq::ManualAssertEq)), + bm!(large_include_file::LargeIncludeFile::new(conf)), + b!(strings::TrimSplitWhitespace), + b!(rc_clone_in_vec_init::RcCloneInVecInit), + b!(swap_ptr_to_ref::SwapPtrToRef), + b!(mismatching_type_param_order::TypeParamMismatch), + b!(read_zero_byte_vec::ReadZeroByteVec), + b!(default_instead_of_iter_empty::DefaultIterEmpty), + bm!(manual_rem_euclid::ManualRemEuclid::new(conf)), + bm!(manual_retain::ManualRetain::new(conf)), + b!(manual_rotate::ManualRotate), + bm!(operators::Operators::new(conf)), + bm!(std_instead_of_core::StdReexports::new(conf)), + bm!(time_subtraction::UncheckedTimeSubtraction::new(conf)), + b!(partialeq_to_none::PartialeqToNone), + bm!(manual_abs_diff::ManualAbsDiff::new(conf)), + bm!(manual_clamp::ManualClamp::new(conf)), + b!(manual_string_new::ManualStringNew), + b!(unused_peekable::UnusedPeekable), + b!(bool_to_int_with_if::BoolToIntWithIf), + b!(box_default::BoxDefault), + b!(implicit_saturating_add::ImplicitSaturatingAdd), + b!(missing_trait_methods::MissingTraitMethods), + b!(from_raw_with_void_ptr::FromRawWithVoidPtr), + b!(suspicious_xor_used_as_pow::ConfusingXorAndPow), + bm!(manual_is_ascii_check::ManualIsAsciiCheck::new(conf)), + bm!(semicolon_block::SemicolonBlock::new(conf)), + b!(permissions_set_readonly_false::PermissionsSetReadonlyFalse), + b!(size_of_ref::SizeOfRef), + b!(multiple_unsafe_ops_per_block::MultipleUnsafeOpsPerBlock), + bm!(extra_unused_type_parameters::ExtraUnusedTypeParameters::new(conf)), + b!(no_mangle_with_rust_abi::NoMangleWithRustAbi), + b!(collection_is_never_read::CollectionIsNeverRead), + b!(missing_assert_message::MissingAssertMessage), + b!(needless_maybe_sized::NeedlessMaybeSized), + b!(redundant_async_block::RedundantAsyncBlock), + bm!(manual_main_separator_str::ManualMainSeparatorStr::new(conf)), + b!(unnecessary_struct_initialization::UnnecessaryStruct), + bm!(unnecessary_box_returns::UnnecessaryBoxReturns::new(conf)), + b!(tests_outside_test_module::TestsOutsideTestModule), + bm!(manual_slice_size_calculation::ManualSliceSizeCalculation::new(conf)), + b!(items_after_test_module::ItemsAfterTestModule), + b!(default_constructed_unit_structs::DefaultConstructedUnitStructs), + b!(missing_fields_in_debug::MissingFieldsInDebug), + b!(endian_bytes::EndianBytes), + b!(redundant_type_annotations::RedundantTypeAnnotations), + b!(arc_with_non_send_sync::ArcWithNonSendSync), + b!(needless_ifs::NeedlessIfs), + bm!(min_ident_chars::MinIdentChars::new(conf)), + bm!(large_stack_frames::LargeStackFrames::new(conf)), + b!(single_range_in_vec_init::SingleRangeInVecInit), + bm!(needless_pass_by_ref_mut::NeedlessPassByRefMut::new(conf)), + bmt!(|tcx| non_canonical_impls::NonCanonicalImpls::new(tcx)), + bm!(single_call_fn::SingleCallFn::new(conf)), + bm!(legacy_numeric_constants::LegacyNumericConstants::new(conf)), + b!(manual_range_patterns::ManualRangePatterns), + bm!(tuple_array_conversions::TupleArrayConversions::new(conf)), + bm!(manual_float_methods::ManualFloatMethods::new(conf)), + b!(four_forward_slashes::FourForwardSlashes), + b!(error_impl_error::ErrorImplError), + bm!(absolute_paths::AbsolutePaths::new(conf)), + b!(redundant_locals::RedundantLocals), + b!(ignored_unit_patterns::IgnoredUnitPatterns), + b!(reserve_after_initialization::ReserveAfterInitialization::default()), + b!(implied_bounds_in_impls::ImpliedBoundsInImpls), + b!(missing_asserts_for_indexing::MissingAssertsForIndexing), + b!(unnecessary_map_on_constructor::UnnecessaryMapOnConstructor), + bm!(needless_borrows_for_generic_args::NeedlessBorrowsForGenericArgs::new(conf)), + bm!(manual_hash_one::ManualHashOne::new(conf)), + b!(iter_without_into_iter::IterWithoutIntoIter), + b!(pathbuf_init_then_push::PathbufThenPush::default()), + b!(iter_over_hash_type::IterOverHashType), + b!(impl_hash_with_borrow_str_and_bytes::ImplHashWithBorrowStrBytes), + bm!(repeat_vec_with_capacity::RepeatVecWithCapacity::new(conf)), + b!(uninhabited_references::UninhabitedReferences), + b!(ineffective_open_options::IneffectiveOpenOptions), + b!(unconditional_recursion::UnconditionalRecursion::default()), + bm!(pub_underscore_fields::PubUnderscoreFields::new(conf)), + bm!(missing_const_for_thread_local::MissingConstForThreadLocal::new(conf)), + bmt!(|tcx| incompatible_msrv::IncompatibleMsrv::new(tcx, conf)), + b!(to_string_trait_impl::ToStringTraitImpl), + bm!(assigning_clones::AssigningClones::new(conf)), + b!(zero_repeat_side_effects::ZeroRepeatSideEffects), + bm!(macro_metavars_in_unsafe::ExprMetavarsInUnsafe::new(conf)), + bm!(string_patterns::StringPatterns::new(conf)), + b!(set_contains_or_insert::SetContainsOrInsert), + b!(zombie_processes::ZombieProcesses), + b!(pointers_in_nomem_asm_block::PointersInNomemAsmBlock), + bm!(manual_is_power_of_two::ManualIsPowerOfTwo::new(conf)), + b!(non_zero_suggestions::NonZeroSuggestions), + b!(literal_string_with_formatting_args::LiteralStringWithFormattingArg), + bm!(unused_trait_names::UnusedTraitNames::new(conf)), + b!(manual_ignore_case_cmp::ManualIgnoreCaseCmp), + b!(unnecessary_literal_bound::UnnecessaryLiteralBound), + bm!(arbitrary_source_item_ordering::ArbitrarySourceItemOrdering::new(conf)), + b!(useless_concat::UselessConcat), + b!(unneeded_struct_pattern::UnneededStructPattern), + b!(unnecessary_semicolon::UnnecessarySemicolon::default()), + bm!(non_std_lazy_statics::NonStdLazyStatic::new(conf)), + bm!(manual_option_as_slice::ManualOptionAsSlice::new(conf)), + b!(single_option_map::SingleOptionMap), + b!(redundant_test_prefix::RedundantTestPrefix), + bm!(cloned_ref_to_slice_refs::ClonedRefToSliceRefs::new(conf)), + b!(infallible_try_from::InfallibleTryFrom), + b!(coerce_container_to_any::CoerceContainerToAny), + b!(toplevel_ref_arg::ToplevelRefArg), + b!(volatile_composites::VolatileComposites), + b!(replace_box::ReplaceBox::default()), + bmt!(|tcx| disallowed_fields::DisallowedFields::new(tcx, conf)), + bm!(manual_ilog2::ManualIlog2::new(conf)), + b!(same_length_and_capacity::SameLengthAndCapacity), + bmt!(|tcx| duration_suboptimal_units::DurationSuboptimalUnits::new(tcx, conf)), + bm!(manual_take::ManualTake::new(conf)), + b!(manual_checked_ops::ManualCheckedOps), + bmt!(|tcx| manual_pop_if::ManualPopIf::new(tcx, conf)), + bm!(manual_noop_waker::ManualNoopWaker::new(conf)), + b!(byte_char_slices::ByteCharSlice), + b!(manual_assert_eq::ManualAssertEq), // add late passes here, used by `cargo dev new_lint` ]; store.late_passes.extend(late_lints);