1
Fork 0

remove box_syntax uses from cranelift and tools

This commit is contained in:
Marcel Hellwig 2021-08-06 17:14:27 +02:00 committed by est31
parent dd4cc0c57d
commit 0f081832b4
16 changed files with 304 additions and 298 deletions

View file

@ -1,4 +1,4 @@
#![feature(start, box_syntax, core_intrinsics, alloc_prelude, alloc_error_handler)] #![feature(start, core_intrinsics, alloc_prelude, alloc_error_handler)]
#![no_std] #![no_std]
extern crate alloc; extern crate alloc;

View file

@ -1,4 +1,4 @@
#![feature(no_core, lang_items, box_syntax, never_type, linkage, extern_types, thread_local)] #![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local)]
#![no_core] #![no_core]
#![allow(dead_code, non_camel_case_types)] #![allow(dead_code, non_camel_case_types)]

View file

@ -1,4 +1,4 @@
#![feature(start, box_syntax, core_intrinsics, lang_items)] #![feature(start, core_intrinsics, lang_items)]
#![no_std] #![no_std]
#[cfg_attr(unix, link(name = "c"))] #[cfg_attr(unix, link(name = "c"))]

View file

@ -114,7 +114,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
attrs: Default::default(), attrs: Default::default(),
visibility: Inherited, visibility: Inherited,
def_id: ItemId::Auto { trait_: trait_def_id, for_: item_def_id }, def_id: ItemId::Auto { trait_: trait_def_id, for_: item_def_id },
kind: box ImplItem(Impl { kind: Box::new(ImplItem(Impl {
span: Span::dummy(), span: Span::dummy(),
unsafety: hir::Unsafety::Normal, unsafety: hir::Unsafety::Normal,
generics: new_generics, generics: new_generics,
@ -124,7 +124,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
negative_polarity, negative_polarity,
synthetic: true, synthetic: true,
blanket_impl: None, blanket_impl: None,
}), })),
cfg: None, cfg: None,
}) })
} }

View file

@ -97,7 +97,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
attrs: Default::default(), attrs: Default::default(),
visibility: Inherited, visibility: Inherited,
def_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id }, def_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id },
kind: box ImplItem(Impl { kind: Box::new(ImplItem(Impl {
span: Span::new(self.cx.tcx.def_span(impl_def_id)), span: Span::new(self.cx.tcx.def_span(impl_def_id)),
unsafety: hir::Unsafety::Normal, unsafety: hir::Unsafety::Normal,
generics: ( generics: (
@ -118,8 +118,8 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
.clean(self.cx), .clean(self.cx),
negative_polarity: false, negative_polarity: false,
synthetic: false, synthetic: false,
blanket_impl: Some(box trait_ref.self_ty().clean(self.cx)), blanket_impl: Some(Box::new(trait_ref.self_ty().clean(self.cx))),
}), })),
cfg: None, cfg: None,
}); });
} }

View file

@ -124,8 +124,14 @@ crate fn try_inline(
let (attrs, cfg) = merge_attrs(cx, Some(parent_module), load_attrs(cx, did), attrs_clone); let (attrs, cfg) = merge_attrs(cx, Some(parent_module), load_attrs(cx, did), attrs_clone);
cx.inlined.insert(did.into()); cx.inlined.insert(did.into());
let mut item = let mut item = clean::Item::from_def_id_and_attrs_and_parts(
clean::Item::from_def_id_and_attrs_and_parts(did, Some(name), kind, box attrs, cx, cfg); did,
Some(name),
kind,
Box::new(attrs),
cx,
cfg,
);
if let Some(import_def_id) = import_def_id { if let Some(import_def_id) = import_def_id {
// The visibility needs to reflect the one from the reexport and not from the "source" DefId. // The visibility needs to reflect the one from the reexport and not from the "source" DefId.
item.visibility = cx.tcx.visibility(import_def_id).clean(cx); item.visibility = cx.tcx.visibility(import_def_id).clean(cx);
@ -458,7 +464,7 @@ crate fn build_impl(
synthetic: false, synthetic: false,
blanket_impl: None, blanket_impl: None,
}), }),
box merged_attrs, Box::new(merged_attrs),
cx, cx,
cfg, cfg,
)); ));
@ -486,10 +492,10 @@ fn build_module(
let prim_ty = clean::PrimitiveType::from(p); let prim_ty = clean::PrimitiveType::from(p);
items.push(clean::Item { items.push(clean::Item {
name: None, name: None,
attrs: box clean::Attributes::default(), attrs: Box::new(clean::Attributes::default()),
def_id: ItemId::Primitive(prim_ty, did.krate), def_id: ItemId::Primitive(prim_ty, did.krate),
visibility: clean::Public, visibility: clean::Public,
kind: box clean::ImportItem(clean::Import::new_simple( kind: Box::new(clean::ImportItem(clean::Import::new_simple(
item.ident.name, item.ident.name,
clean::ImportSource { clean::ImportSource {
path: clean::Path { path: clean::Path {
@ -506,7 +512,7 @@ fn build_module(
did: None, did: None,
}, },
true, true,
)), ))),
cfg: None, cfg: None,
}); });
} else if let Some(i) = } else if let Some(i) =

View file

@ -403,8 +403,8 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
Type::QPath { Type::QPath {
name: cx.tcx.associated_item(self.item_def_id).ident.name, name: cx.tcx.associated_item(self.item_def_id).ident.name,
self_def_id: self_type.def_id(), self_def_id: self_type.def_id(),
self_type: box self_type, self_type: Box::new(self_type),
trait_: box trait_, trait_: Box::new(trait_),
} }
} }
} }
@ -1305,8 +1305,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
Type::QPath { Type::QPath {
name: p.segments.last().expect("segments were empty").ident.name, name: p.segments.last().expect("segments were empty").ident.name,
self_def_id: Some(DefId::local(qself.hir_id.owner.local_def_index)), self_def_id: Some(DefId::local(qself.hir_id.owner.local_def_index)),
self_type: box qself.clean(cx), self_type: Box::new(qself.clean(cx)),
trait_: box resolve_type(cx, trait_path, hir_id), trait_: Box::new(resolve_type(cx, trait_path, hir_id)),
} }
} }
hir::QPath::TypeRelative(ref qself, ref segment) => { hir::QPath::TypeRelative(ref qself, ref segment) => {
@ -1320,8 +1320,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
Type::QPath { Type::QPath {
name: segment.ident.name, name: segment.ident.name,
self_def_id: res.opt_def_id(), self_def_id: res.opt_def_id(),
self_type: box qself.clean(cx), self_type: Box::new(qself.clean(cx)),
trait_: box resolve_type(cx, trait_path, hir_id), trait_: Box::new(resolve_type(cx, trait_path, hir_id)),
} }
} }
hir::QPath::LangItem(..) => bug!("clean: requiring documentation of lang item"), hir::QPath::LangItem(..) => bug!("clean: requiring documentation of lang item"),
@ -1334,7 +1334,7 @@ impl Clean<Type> for hir::Ty<'_> {
match self.kind { match self.kind {
TyKind::Never => Never, TyKind::Never => Never,
TyKind::Ptr(ref m) => RawPointer(m.mutbl, box m.ty.clean(cx)), TyKind::Ptr(ref m) => RawPointer(m.mutbl, Box::new(m.ty.clean(cx))),
TyKind::Rptr(ref l, ref m) => { TyKind::Rptr(ref l, ref m) => {
// There are two times a `Fresh` lifetime can be created: // There are two times a `Fresh` lifetime can be created:
// 1. For `&'_ x`, written by the user. This corresponds to `lower_lifetime` in `rustc_ast_lowering`. // 1. For `&'_ x`, written by the user. This corresponds to `lower_lifetime` in `rustc_ast_lowering`.
@ -1346,9 +1346,9 @@ impl Clean<Type> for hir::Ty<'_> {
let elided = let elided =
l.is_elided() || matches!(l.name, LifetimeName::Param(ParamName::Fresh(_))); l.is_elided() || matches!(l.name, LifetimeName::Param(ParamName::Fresh(_)));
let lifetime = if elided { None } else { Some(l.clean(cx)) }; let lifetime = if elided { None } else { Some(l.clean(cx)) };
BorrowedRef { lifetime, mutability: m.mutbl, type_: box m.ty.clean(cx) } BorrowedRef { lifetime, mutability: m.mutbl, type_: Box::new(m.ty.clean(cx)) }
} }
TyKind::Slice(ref ty) => Slice(box ty.clean(cx)), TyKind::Slice(ref ty) => Slice(Box::new(ty.clean(cx))),
TyKind::Array(ref ty, ref length) => { TyKind::Array(ref ty, ref length) => {
let def_id = cx.tcx.hir().local_def_id(length.hir_id); let def_id = cx.tcx.hir().local_def_id(length.hir_id);
// NOTE(min_const_generics): We can't use `const_eval_poly` for constants // NOTE(min_const_generics): We can't use `const_eval_poly` for constants
@ -1361,7 +1361,7 @@ impl Clean<Type> for hir::Ty<'_> {
let ct = ty::Const::from_anon_const(cx.tcx, def_id); let ct = ty::Const::from_anon_const(cx.tcx, def_id);
let param_env = cx.tcx.param_env(def_id); let param_env = cx.tcx.param_env(def_id);
let length = print_const(cx, ct.eval(cx.tcx, param_env)); let length = print_const(cx, ct.eval(cx.tcx, param_env));
Array(box ty.clean(cx), length) Array(Box::new(ty.clean(cx)), length)
} }
TyKind::Tup(ref tys) => Tuple(tys.clean(cx)), TyKind::Tup(ref tys) => Tuple(tys.clean(cx)),
TyKind::OpaqueDef(item_id, _) => { TyKind::OpaqueDef(item_id, _) => {
@ -1378,7 +1378,7 @@ impl Clean<Type> for hir::Ty<'_> {
let lifetime = if !lifetime.is_elided() { Some(lifetime.clean(cx)) } else { None }; let lifetime = if !lifetime.is_elided() { Some(lifetime.clean(cx)) } else { None };
DynTrait(bounds, lifetime) DynTrait(bounds, lifetime)
} }
TyKind::BareFn(ref barefn) => BareFunction(box barefn.clean(cx)), TyKind::BareFn(ref barefn) => BareFunction(Box::new(barefn.clean(cx))),
TyKind::Infer | TyKind::Err => Infer, TyKind::Infer | TyKind::Err => Infer,
TyKind::Typeof(..) => panic!("unimplemented type {:?}", self.kind), TyKind::Typeof(..) => panic!("unimplemented type {:?}", self.kind),
} }
@ -1428,27 +1428,29 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
ty::Uint(uint_ty) => Primitive(uint_ty.into()), ty::Uint(uint_ty) => Primitive(uint_ty.into()),
ty::Float(float_ty) => Primitive(float_ty.into()), ty::Float(float_ty) => Primitive(float_ty.into()),
ty::Str => Primitive(PrimitiveType::Str), ty::Str => Primitive(PrimitiveType::Str),
ty::Slice(ty) => Slice(box ty.clean(cx)), ty::Slice(ty) => Slice(Box::new(ty.clean(cx))),
ty::Array(ty, n) => { ty::Array(ty, n) => {
let mut n = cx.tcx.lift(n).expect("array lift failed"); let mut n = cx.tcx.lift(n).expect("array lift failed");
n = n.eval(cx.tcx, ty::ParamEnv::reveal_all()); n = n.eval(cx.tcx, ty::ParamEnv::reveal_all());
let n = print_const(cx, n); let n = print_const(cx, n);
Array(box ty.clean(cx), n) Array(Box::new(ty.clean(cx)), n)
}
ty::RawPtr(mt) => RawPointer(mt.mutbl, box mt.ty.clean(cx)),
ty::Ref(r, ty, mutbl) => {
BorrowedRef { lifetime: r.clean(cx), mutability: mutbl, type_: box ty.clean(cx) }
} }
ty::RawPtr(mt) => RawPointer(mt.mutbl, Box::new(mt.ty.clean(cx))),
ty::Ref(r, ty, mutbl) => BorrowedRef {
lifetime: r.clean(cx),
mutability: mutbl,
type_: Box::new(ty.clean(cx)),
},
ty::FnDef(..) | ty::FnPtr(_) => { ty::FnDef(..) | ty::FnPtr(_) => {
let ty = cx.tcx.lift(*self).expect("FnPtr lift failed"); let ty = cx.tcx.lift(*self).expect("FnPtr lift failed");
let sig = ty.fn_sig(cx.tcx); let sig = ty.fn_sig(cx.tcx);
let def_id = DefId::local(CRATE_DEF_INDEX); let def_id = DefId::local(CRATE_DEF_INDEX);
BareFunction(box BareFunctionDecl { BareFunction(Box::new(BareFunctionDecl {
unsafety: sig.unsafety(), unsafety: sig.unsafety(),
generic_params: Vec::new(), generic_params: Vec::new(),
decl: (def_id, sig).clean(cx), decl: (def_id, sig).clean(cx),
abi: sig.abi(), abi: sig.abi(),
}) }))
} }
ty::Adt(def, substs) => { ty::Adt(def, substs) => {
let did = def.did; let did = def.did;
@ -1988,10 +1990,10 @@ fn clean_extern_crate(
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason // FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
vec![Item { vec![Item {
name: Some(name), name: Some(name),
attrs: box attrs.clean(cx), attrs: Box::new(attrs.clean(cx)),
def_id: crate_def_id.into(), def_id: crate_def_id.into(),
visibility: krate.vis.clean(cx), visibility: krate.vis.clean(cx),
kind: box ExternCrateItem { src: orig_name }, kind: Box::new(ExternCrateItem { src: orig_name }),
cfg: attrs.cfg(cx.sess()), cfg: attrs.cfg(cx.sess()),
}] }]
} }

View file

@ -416,7 +416,7 @@ impl Item {
def_id, def_id,
name, name,
kind, kind,
box ast_attrs.clean(cx), Box::new(ast_attrs.clean(cx)),
cx, cx,
ast_attrs.cfg(cx.sess()), ast_attrs.cfg(cx.sess()),
) )
@ -434,7 +434,7 @@ impl Item {
Item { Item {
def_id: def_id.into(), def_id: def_id.into(),
kind: box kind, kind: Box::new(kind),
name, name,
attrs, attrs,
visibility: cx.tcx.visibility(def_id).clean(cx), visibility: cx.tcx.visibility(def_id).clean(cx),

View file

@ -265,7 +265,7 @@ crate fn create_config(
stderr: None, stderr: None,
lint_caps, lint_caps,
parse_sess_created: None, parse_sess_created: None,
register_lints: Some(box crate::lint::register_lints), register_lints: Some(Box::new(crate::lint::register_lints)),
override_queries: Some(|_sess, providers, _external_providers| { override_queries: Some(|_sess, providers, _external_providers| {
// Most lints will require typechecking, so just don't run them. // Most lints will require typechecking, so just don't run them.
providers.lint_mod = |_, _| {}; providers.lint_mod = |_, _| {};

View file

@ -99,7 +99,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
stderr: None, stderr: None,
lint_caps, lint_caps,
parse_sess_created: None, parse_sess_created: None,
register_lints: Some(box crate::lint::register_lints), register_lints: Some(Box::new(crate::lint::register_lints)),
override_queries: None, override_queries: None,
make_codegen_backend: None, make_codegen_backend: None,
registry: rustc_driver::diagnostics_registry(), registry: rustc_driver::diagnostics_registry(),
@ -549,10 +549,10 @@ crate fn make_test(
.supports_color(); .supports_color();
let emitter = let emitter =
EmitterWriter::new(box io::sink(), None, false, false, false, None, false); EmitterWriter::new(Box::new(io::sink()), None, false, false, false, None, false);
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser // FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
let handler = Handler::with_emitter(false, None, box emitter); let handler = Handler::with_emitter(false, None, Box::new(emitter));
let sess = ParseSess::with_span_handler(handler, sm); let sess = ParseSess::with_span_handler(handler, sm);
let mut found_main = false; let mut found_main = false;
@ -962,7 +962,7 @@ impl Tester for Collector {
no_run, no_run,
test_type: test::TestType::DocTest, test_type: test::TestType::DocTest,
}, },
testfn: test::DynTestFn(box move || { testfn: test::DynTestFn(Box::new(move || {
let report_unused_externs = |uext| { let report_unused_externs = |uext| {
unused_externs.lock().unwrap().push(uext); unused_externs.lock().unwrap().push(uext);
}; };
@ -1042,9 +1042,9 @@ impl Tester for Collector {
} }
} }
panic::resume_unwind(box ()); panic::resume_unwind(Box::new(()));
} }
}), })),
}); });
} }

View file

@ -2,7 +2,7 @@ use crate::clean::*;
crate fn strip_item(mut item: Item) -> Item { crate fn strip_item(mut item: Item) -> Item {
if !matches!(*item.kind, StrippedItem(..)) { if !matches!(*item.kind, StrippedItem(..)) {
item.kind = box StrippedItem(item.kind); item.kind = Box::new(StrippedItem(item.kind));
} }
item item
} }
@ -65,10 +65,10 @@ crate trait DocFolder: Sized {
/// don't override! /// don't override!
fn fold_item_recur(&mut self, mut item: Item) -> Item { fn fold_item_recur(&mut self, mut item: Item) -> Item {
item.kind = box match *item.kind { item.kind = Box::new(match *item.kind {
StrippedItem(box i) => StrippedItem(box self.fold_inner_recur(i)), StrippedItem(box i) => StrippedItem(Box::new(self.fold_inner_recur(i))),
_ => self.fold_inner_recur(*item.kind), _ => self.fold_inner_recur(*item.kind),
}; });
item item
} }

View file

@ -5,7 +5,6 @@
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(array_methods)] #![feature(array_methods)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(in_band_lifetimes)] #![feature(in_band_lifetimes)]
#![feature(nll)] #![feature(nll)]
#![feature(test)] #![feature(test)]

View file

@ -61,7 +61,7 @@ enum ErrorKind<'a> {
impl<'a> From<ResolutionFailure<'a>> for ErrorKind<'a> { impl<'a> From<ResolutionFailure<'a>> for ErrorKind<'a> {
fn from(err: ResolutionFailure<'a>) -> Self { fn from(err: ResolutionFailure<'a>) -> Self {
ErrorKind::Resolve(box err) ErrorKind::Resolve(Box::new(err))
} }
} }

View file

@ -116,7 +116,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
// prevent folding of `cfg!` macros and the like // prevent folding of `cfg!` macros and the like
if !e.span.from_expansion() { if !e.span.from_expansion() {
match &e.kind { match &e.kind {
ExprKind::Unary(UnOp::Not, inner) => return Ok(Bool::Not(box self.run(inner)?)), ExprKind::Unary(UnOp::Not, inner) => return Ok(Bool::Not(Box::new(self.run(inner)?))),
ExprKind::Binary(binop, lhs, rhs) => match &binop.node { ExprKind::Binary(binop, lhs, rhs) => match &binop.node {
BinOpKind::Or => { BinOpKind::Or => {
return Ok(Bool::Or(self.extract(BinOpKind::Or, &[lhs, rhs], Vec::new())?)); return Ok(Bool::Or(self.extract(BinOpKind::Or, &[lhs, rhs], Vec::new())?));

View file

@ -578,8 +578,8 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
let filename = FileName::anon_source_code(&code); let filename = FileName::anon_source_code(&code);
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let emitter = EmitterWriter::new(box io::sink(), None, false, false, false, None, false); let emitter = EmitterWriter::new(Box::new(io::sink()), None, false, false, false, None, false);
let handler = Handler::with_emitter(false, None, box emitter); let handler = Handler::with_emitter(false, None, Box::new(emitter));
let sess = ParseSess::with_span_handler(handler, sm); let sess = ParseSess::with_span_handler(handler, sm);
let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) { let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) {

View file

@ -1,7 +1,6 @@
// error-pattern:cargo-clippy // error-pattern:cargo-clippy
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(in_band_lifetimes)] #![feature(in_band_lifetimes)]
#![feature(iter_zip)] #![feature(iter_zip)]
@ -393,9 +392,9 @@ use crate::utils::conf::TryConf;
/// Used in `./src/driver.rs`. /// Used in `./src/driver.rs`.
pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) { pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) {
// NOTE: Do not add any more pre-expansion passes. These should be removed eventually. // NOTE: Do not add any more pre-expansion passes. These should be removed eventually.
store.register_pre_expansion_pass(|| box write::Write::default()); store.register_pre_expansion_pass(|| Box::new(write::Write::default()));
store.register_pre_expansion_pass(|| box attrs::EarlyAttributes); store.register_pre_expansion_pass(|| Box::new(attrs::EarlyAttributes));
store.register_pre_expansion_pass(|| box dbg_macro::DbgMacro); store.register_pre_expansion_pass(|| Box::new(dbg_macro::DbgMacro));
} }
#[doc(hidden)] #[doc(hidden)]
@ -1810,7 +1809,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
#[cfg(feature = "metadata-collector-lint")] #[cfg(feature = "metadata-collector-lint")]
{ {
if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) { if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) {
store.register_late_pass(|| box utils::internal_lints::metadata_collector::MetadataCollector::new()); store.register_late_pass(|| Box::new(utils::internal_lints::metadata_collector::MetadataCollector::new()));
return; return;
} }
} }
@ -1818,57 +1817,57 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
// all the internal lints // all the internal lints
#[cfg(feature = "internal-lints")] #[cfg(feature = "internal-lints")]
{ {
store.register_early_pass(|| box utils::internal_lints::ClippyLintsInternal); store.register_early_pass(|| Box::new(utils::internal_lints::ClippyLintsInternal));
store.register_early_pass(|| box utils::internal_lints::ProduceIce); store.register_early_pass(|| Box::new(utils::internal_lints::ProduceIce));
store.register_late_pass(|| box utils::inspector::DeepCodeInspector); store.register_late_pass(|| Box::new(utils::inspector::DeepCodeInspector));
store.register_late_pass(|| box utils::internal_lints::CollapsibleCalls); store.register_late_pass(|| Box::new(utils::internal_lints::CollapsibleCalls));
store.register_late_pass(|| box utils::internal_lints::CompilerLintFunctions::new()); store.register_late_pass(|| Box::new(utils::internal_lints::CompilerLintFunctions::new()));
store.register_late_pass(|| box utils::internal_lints::IfChainStyle); store.register_late_pass(|| Box::new(utils::internal_lints::IfChainStyle));
store.register_late_pass(|| box utils::internal_lints::InvalidPaths); store.register_late_pass(|| Box::new(utils::internal_lints::InvalidPaths));
store.register_late_pass(|| box utils::internal_lints::InterningDefinedSymbol::default()); store.register_late_pass(|| Box::new(utils::internal_lints::InterningDefinedSymbol::default()));
store.register_late_pass(|| box utils::internal_lints::LintWithoutLintPass::default()); store.register_late_pass(|| Box::new(utils::internal_lints::LintWithoutLintPass::default()));
store.register_late_pass(|| box utils::internal_lints::MatchTypeOnDiagItem); store.register_late_pass(|| Box::new(utils::internal_lints::MatchTypeOnDiagItem));
store.register_late_pass(|| box utils::internal_lints::OuterExpnDataPass); store.register_late_pass(|| Box::new(utils::internal_lints::OuterExpnDataPass));
} }
store.register_late_pass(|| box utils::author::Author); store.register_late_pass(|| Box::new(utils::author::Author));
store.register_late_pass(|| box await_holding_invalid::AwaitHolding); store.register_late_pass(|| Box::new(await_holding_invalid::AwaitHolding));
store.register_late_pass(|| box serde_api::SerdeApi); store.register_late_pass(|| Box::new(serde_api::SerdeApi));
let vec_box_size_threshold = conf.vec_box_size_threshold; let vec_box_size_threshold = conf.vec_box_size_threshold;
let type_complexity_threshold = conf.type_complexity_threshold; let type_complexity_threshold = conf.type_complexity_threshold;
store.register_late_pass(move || box types::Types::new(vec_box_size_threshold, type_complexity_threshold)); store.register_late_pass(move || Box::new(types::Types::new(vec_box_size_threshold, type_complexity_threshold)));
store.register_late_pass(|| box booleans::NonminimalBool); store.register_late_pass(|| Box::new(booleans::NonminimalBool));
store.register_late_pass(|| box needless_bitwise_bool::NeedlessBitwiseBool); store.register_late_pass(|| Box::new(needless_bitwise_bool::NeedlessBitwiseBool));
store.register_late_pass(|| box eq_op::EqOp); store.register_late_pass(|| Box::new(eq_op::EqOp));
store.register_late_pass(|| box enum_clike::UnportableVariant); store.register_late_pass(|| Box::new(enum_clike::UnportableVariant));
store.register_late_pass(|| box float_literal::FloatLiteral); store.register_late_pass(|| Box::new(float_literal::FloatLiteral));
let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold; let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
store.register_late_pass(move || box bit_mask::BitMask::new(verbose_bit_mask_threshold)); store.register_late_pass(move || Box::new(bit_mask::BitMask::new(verbose_bit_mask_threshold)));
store.register_late_pass(|| box ptr::Ptr); store.register_late_pass(|| Box::new(ptr::Ptr));
store.register_late_pass(|| box ptr_eq::PtrEq); store.register_late_pass(|| Box::new(ptr_eq::PtrEq));
store.register_late_pass(|| box needless_bool::NeedlessBool); store.register_late_pass(|| Box::new(needless_bool::NeedlessBool));
store.register_late_pass(|| box needless_bool::BoolComparison); store.register_late_pass(|| Box::new(needless_bool::BoolComparison));
store.register_late_pass(|| box needless_for_each::NeedlessForEach); store.register_late_pass(|| Box::new(needless_for_each::NeedlessForEach));
store.register_late_pass(|| box approx_const::ApproxConstant); store.register_late_pass(|| Box::new(approx_const::ApproxConstant));
store.register_late_pass(|| box misc::MiscLints); store.register_late_pass(|| Box::new(misc::MiscLints));
store.register_late_pass(|| box eta_reduction::EtaReduction); store.register_late_pass(|| Box::new(eta_reduction::EtaReduction));
store.register_late_pass(|| box identity_op::IdentityOp); store.register_late_pass(|| Box::new(identity_op::IdentityOp));
store.register_late_pass(|| box erasing_op::ErasingOp); store.register_late_pass(|| Box::new(erasing_op::ErasingOp));
store.register_late_pass(|| box mut_mut::MutMut); store.register_late_pass(|| Box::new(mut_mut::MutMut));
store.register_late_pass(|| box mut_reference::UnnecessaryMutPassed); store.register_late_pass(|| Box::new(mut_reference::UnnecessaryMutPassed));
store.register_late_pass(|| box len_zero::LenZero); store.register_late_pass(|| Box::new(len_zero::LenZero));
store.register_late_pass(|| box attrs::Attributes); store.register_late_pass(|| Box::new(attrs::Attributes));
store.register_late_pass(|| box blocks_in_if_conditions::BlocksInIfConditions); store.register_late_pass(|| Box::new(blocks_in_if_conditions::BlocksInIfConditions));
store.register_late_pass(|| box collapsible_match::CollapsibleMatch); store.register_late_pass(|| Box::new(collapsible_match::CollapsibleMatch));
store.register_late_pass(|| box unicode::Unicode); store.register_late_pass(|| Box::new(unicode::Unicode));
store.register_late_pass(|| box unit_return_expecting_ord::UnitReturnExpectingOrd); store.register_late_pass(|| Box::new(unit_return_expecting_ord::UnitReturnExpectingOrd));
store.register_late_pass(|| box strings::StringAdd); store.register_late_pass(|| Box::new(strings::StringAdd));
store.register_late_pass(|| box implicit_return::ImplicitReturn); store.register_late_pass(|| Box::new(implicit_return::ImplicitReturn));
store.register_late_pass(|| box implicit_saturating_sub::ImplicitSaturatingSub); store.register_late_pass(|| Box::new(implicit_saturating_sub::ImplicitSaturatingSub));
store.register_late_pass(|| box default_numeric_fallback::DefaultNumericFallback); store.register_late_pass(|| Box::new(default_numeric_fallback::DefaultNumericFallback));
store.register_late_pass(|| box inconsistent_struct_constructor::InconsistentStructConstructor); store.register_late_pass(|| Box::new(inconsistent_struct_constructor::InconsistentStructConstructor));
store.register_late_pass(|| box non_octal_unix_permissions::NonOctalUnixPermissions); store.register_late_pass(|| Box::new(non_octal_unix_permissions::NonOctalUnixPermissions));
store.register_early_pass(|| box unnecessary_self_imports::UnnecessarySelfImports); store.register_early_pass(|| Box::new(unnecessary_self_imports::UnnecessarySelfImports));
let msrv = conf.msrv.as_ref().and_then(|s| { let msrv = conf.msrv.as_ref().and_then(|s| {
parse_msrv(s, None, None).or_else(|| { parse_msrv(s, None, None).or_else(|| {
@ -1878,231 +1877,231 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
}); });
let avoid_breaking_exported_api = conf.avoid_breaking_exported_api; let avoid_breaking_exported_api = conf.avoid_breaking_exported_api;
store.register_late_pass(move || box methods::Methods::new(avoid_breaking_exported_api, msrv)); store.register_late_pass(move || Box::new(methods::Methods::new(avoid_breaking_exported_api, msrv)));
store.register_late_pass(move || box matches::Matches::new(msrv)); store.register_late_pass(move || Box::new(matches::Matches::new(msrv)));
store.register_early_pass(move || box manual_non_exhaustive::ManualNonExhaustive::new(msrv)); store.register_early_pass(move || Box::new(manual_non_exhaustive::ManualNonExhaustive::new(msrv)));
store.register_late_pass(move || box manual_strip::ManualStrip::new(msrv)); store.register_late_pass(move || Box::new(manual_strip::ManualStrip::new(msrv)));
store.register_early_pass(move || box redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv)); store.register_early_pass(move || Box::new(redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv)));
store.register_early_pass(move || box redundant_field_names::RedundantFieldNames::new(msrv)); store.register_early_pass(move || Box::new(redundant_field_names::RedundantFieldNames::new(msrv)));
store.register_late_pass(move || box checked_conversions::CheckedConversions::new(msrv)); store.register_late_pass(move || Box::new(checked_conversions::CheckedConversions::new(msrv)));
store.register_late_pass(move || box mem_replace::MemReplace::new(msrv)); store.register_late_pass(move || Box::new(mem_replace::MemReplace::new(msrv)));
store.register_late_pass(move || box ranges::Ranges::new(msrv)); store.register_late_pass(move || Box::new(ranges::Ranges::new(msrv)));
store.register_late_pass(move || box from_over_into::FromOverInto::new(msrv)); store.register_late_pass(move || Box::new(from_over_into::FromOverInto::new(msrv)));
store.register_late_pass(move || box use_self::UseSelf::new(msrv)); store.register_late_pass(move || Box::new(use_self::UseSelf::new(msrv)));
store.register_late_pass(move || box missing_const_for_fn::MissingConstForFn::new(msrv)); store.register_late_pass(move || Box::new(missing_const_for_fn::MissingConstForFn::new(msrv)));
store.register_late_pass(move || box needless_question_mark::NeedlessQuestionMark); store.register_late_pass(move || Box::new(needless_question_mark::NeedlessQuestionMark));
store.register_late_pass(move || box casts::Casts::new(msrv)); store.register_late_pass(move || Box::new(casts::Casts::new(msrv)));
store.register_early_pass(move || box unnested_or_patterns::UnnestedOrPatterns::new(msrv)); store.register_early_pass(move || Box::new(unnested_or_patterns::UnnestedOrPatterns::new(msrv)));
store.register_late_pass(|| box size_of_in_element_count::SizeOfInElementCount); store.register_late_pass(|| Box::new(size_of_in_element_count::SizeOfInElementCount));
store.register_late_pass(|| box map_clone::MapClone); store.register_late_pass(|| Box::new(map_clone::MapClone));
store.register_late_pass(|| box map_err_ignore::MapErrIgnore); store.register_late_pass(|| Box::new(map_err_ignore::MapErrIgnore));
store.register_late_pass(|| box shadow::Shadow); store.register_late_pass(|| Box::new(shadow::Shadow));
store.register_late_pass(|| box unit_types::UnitTypes); store.register_late_pass(|| Box::new(unit_types::UnitTypes));
store.register_late_pass(|| box loops::Loops); store.register_late_pass(|| Box::new(loops::Loops));
store.register_late_pass(|| box main_recursion::MainRecursion::default()); store.register_late_pass(|| Box::new(main_recursion::MainRecursion::default()));
store.register_late_pass(|| box lifetimes::Lifetimes); store.register_late_pass(|| Box::new(lifetimes::Lifetimes));
store.register_late_pass(|| box entry::HashMapPass); store.register_late_pass(|| Box::new(entry::HashMapPass));
store.register_late_pass(|| box minmax::MinMaxPass); store.register_late_pass(|| Box::new(minmax::MinMaxPass));
store.register_late_pass(|| box open_options::OpenOptions); store.register_late_pass(|| Box::new(open_options::OpenOptions));
store.register_late_pass(|| box zero_div_zero::ZeroDiv); store.register_late_pass(|| Box::new(zero_div_zero::ZeroDiv));
store.register_late_pass(|| box mutex_atomic::Mutex); store.register_late_pass(|| Box::new(mutex_atomic::Mutex));
store.register_late_pass(|| box needless_update::NeedlessUpdate); store.register_late_pass(|| Box::new(needless_update::NeedlessUpdate));
store.register_late_pass(|| box needless_borrow::NeedlessBorrow::default()); store.register_late_pass(|| Box::new(needless_borrow::NeedlessBorrow::default()));
store.register_late_pass(|| box needless_borrowed_ref::NeedlessBorrowedRef); store.register_late_pass(|| Box::new(needless_borrowed_ref::NeedlessBorrowedRef));
store.register_late_pass(|| box no_effect::NoEffect); store.register_late_pass(|| Box::new(no_effect::NoEffect));
store.register_late_pass(|| box temporary_assignment::TemporaryAssignment); store.register_late_pass(|| Box::new(temporary_assignment::TemporaryAssignment));
store.register_late_pass(|| box transmute::Transmute); store.register_late_pass(|| Box::new(transmute::Transmute));
let cognitive_complexity_threshold = conf.cognitive_complexity_threshold; let cognitive_complexity_threshold = conf.cognitive_complexity_threshold;
store.register_late_pass(move || box cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold)); store.register_late_pass(move || Box::new(cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold)));
let too_large_for_stack = conf.too_large_for_stack; let too_large_for_stack = conf.too_large_for_stack;
store.register_late_pass(move || box escape::BoxedLocal{too_large_for_stack}); store.register_late_pass(move || Box::new(escape::BoxedLocal{too_large_for_stack}));
store.register_late_pass(move || box vec::UselessVec{too_large_for_stack}); store.register_late_pass(move || Box::new(vec::UselessVec{too_large_for_stack}));
store.register_late_pass(|| box panic_unimplemented::PanicUnimplemented); store.register_late_pass(|| Box::new(panic_unimplemented::PanicUnimplemented));
store.register_late_pass(|| box strings::StringLitAsBytes); store.register_late_pass(|| Box::new(strings::StringLitAsBytes));
store.register_late_pass(|| box derive::Derive); store.register_late_pass(|| Box::new(derive::Derive));
store.register_late_pass(|| box get_last_with_len::GetLastWithLen); store.register_late_pass(|| Box::new(get_last_with_len::GetLastWithLen));
store.register_late_pass(|| box drop_forget_ref::DropForgetRef); store.register_late_pass(|| Box::new(drop_forget_ref::DropForgetRef));
store.register_late_pass(|| box empty_enum::EmptyEnum); store.register_late_pass(|| Box::new(empty_enum::EmptyEnum));
store.register_late_pass(|| box absurd_extreme_comparisons::AbsurdExtremeComparisons); store.register_late_pass(|| Box::new(absurd_extreme_comparisons::AbsurdExtremeComparisons));
store.register_late_pass(|| box invalid_upcast_comparisons::InvalidUpcastComparisons); store.register_late_pass(|| Box::new(invalid_upcast_comparisons::InvalidUpcastComparisons));
store.register_late_pass(|| box regex::Regex::default()); store.register_late_pass(|| Box::new(regex::Regex::default()));
store.register_late_pass(|| box copies::CopyAndPaste); store.register_late_pass(|| Box::new(copies::CopyAndPaste));
store.register_late_pass(|| box copy_iterator::CopyIterator); store.register_late_pass(|| Box::new(copy_iterator::CopyIterator));
store.register_late_pass(|| box format::UselessFormat); store.register_late_pass(|| Box::new(format::UselessFormat));
store.register_late_pass(|| box swap::Swap); store.register_late_pass(|| Box::new(swap::Swap));
store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional); store.register_late_pass(|| Box::new(overflow_check_conditional::OverflowCheckConditional));
store.register_late_pass(|| box new_without_default::NewWithoutDefault::default()); store.register_late_pass(|| Box::new(new_without_default::NewWithoutDefault::default()));
let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>(); let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone())); store.register_late_pass(move || Box::new(blacklisted_name::BlacklistedName::new(blacklisted_names.clone())));
let too_many_arguments_threshold = conf.too_many_arguments_threshold; let too_many_arguments_threshold = conf.too_many_arguments_threshold;
let too_many_lines_threshold = conf.too_many_lines_threshold; let too_many_lines_threshold = conf.too_many_lines_threshold;
store.register_late_pass(move || box functions::Functions::new(too_many_arguments_threshold, too_many_lines_threshold)); store.register_late_pass(move || Box::new(functions::Functions::new(too_many_arguments_threshold, too_many_lines_threshold)));
let doc_valid_idents = conf.doc_valid_idents.iter().cloned().collect::<FxHashSet<_>>(); let doc_valid_idents = conf.doc_valid_idents.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box doc::DocMarkdown::new(doc_valid_idents.clone())); store.register_late_pass(move || Box::new(doc::DocMarkdown::new(doc_valid_idents.clone())));
store.register_late_pass(|| box neg_multiply::NegMultiply); store.register_late_pass(|| Box::new(neg_multiply::NegMultiply));
store.register_late_pass(|| box mem_discriminant::MemDiscriminant); store.register_late_pass(|| Box::new(mem_discriminant::MemDiscriminant));
store.register_late_pass(|| box mem_forget::MemForget); store.register_late_pass(|| Box::new(mem_forget::MemForget));
store.register_late_pass(|| box arithmetic::Arithmetic::default()); store.register_late_pass(|| Box::new(arithmetic::Arithmetic::default()));
store.register_late_pass(|| box assign_ops::AssignOps); store.register_late_pass(|| Box::new(assign_ops::AssignOps));
store.register_late_pass(|| box let_if_seq::LetIfSeq); store.register_late_pass(|| Box::new(let_if_seq::LetIfSeq));
store.register_late_pass(|| box eval_order_dependence::EvalOrderDependence); store.register_late_pass(|| Box::new(eval_order_dependence::EvalOrderDependence));
store.register_late_pass(|| box missing_doc::MissingDoc::new()); store.register_late_pass(|| Box::new(missing_doc::MissingDoc::new()));
store.register_late_pass(|| box missing_inline::MissingInline); store.register_late_pass(|| Box::new(missing_inline::MissingInline));
store.register_late_pass(move || box exhaustive_items::ExhaustiveItems); store.register_late_pass(move || Box::new(exhaustive_items::ExhaustiveItems));
store.register_late_pass(|| box if_let_some_result::OkIfLet); store.register_late_pass(|| Box::new(if_let_some_result::OkIfLet));
store.register_late_pass(|| box partialeq_ne_impl::PartialEqNeImpl); store.register_late_pass(|| Box::new(partialeq_ne_impl::PartialEqNeImpl));
store.register_late_pass(|| box unused_io_amount::UnusedIoAmount); store.register_late_pass(|| Box::new(unused_io_amount::UnusedIoAmount));
let enum_variant_size_threshold = conf.enum_variant_size_threshold; let enum_variant_size_threshold = conf.enum_variant_size_threshold;
store.register_late_pass(move || box large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold)); store.register_late_pass(move || Box::new(large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold)));
store.register_late_pass(|| box explicit_write::ExplicitWrite); store.register_late_pass(|| Box::new(explicit_write::ExplicitWrite));
store.register_late_pass(|| box needless_pass_by_value::NeedlessPassByValue); store.register_late_pass(|| Box::new(needless_pass_by_value::NeedlessPassByValue));
let pass_by_ref_or_value = pass_by_ref_or_value::PassByRefOrValue::new( let pass_by_ref_or_value = pass_by_ref_or_value::PassByRefOrValue::new(
conf.trivial_copy_size_limit, conf.trivial_copy_size_limit,
conf.pass_by_value_size_limit, conf.pass_by_value_size_limit,
conf.avoid_breaking_exported_api, conf.avoid_breaking_exported_api,
&sess.target, &sess.target,
); );
store.register_late_pass(move || box pass_by_ref_or_value); store.register_late_pass(move || Box::new(pass_by_ref_or_value));
store.register_late_pass(|| box ref_option_ref::RefOptionRef); store.register_late_pass(|| Box::new(ref_option_ref::RefOptionRef));
store.register_late_pass(|| box try_err::TryErr); store.register_late_pass(|| Box::new(try_err::TryErr));
store.register_late_pass(|| box bytecount::ByteCount); store.register_late_pass(|| Box::new(bytecount::ByteCount));
store.register_late_pass(|| box infinite_iter::InfiniteIter); store.register_late_pass(|| Box::new(infinite_iter::InfiniteIter));
store.register_late_pass(|| box inline_fn_without_body::InlineFnWithoutBody); store.register_late_pass(|| Box::new(inline_fn_without_body::InlineFnWithoutBody));
store.register_late_pass(|| box useless_conversion::UselessConversion::default()); store.register_late_pass(|| Box::new(useless_conversion::UselessConversion::default()));
store.register_late_pass(|| box implicit_hasher::ImplicitHasher); store.register_late_pass(|| Box::new(implicit_hasher::ImplicitHasher));
store.register_late_pass(|| box fallible_impl_from::FallibleImplFrom); store.register_late_pass(|| Box::new(fallible_impl_from::FallibleImplFrom));
store.register_late_pass(|| box double_comparison::DoubleComparisons); store.register_late_pass(|| Box::new(double_comparison::DoubleComparisons));
store.register_late_pass(|| box question_mark::QuestionMark); store.register_late_pass(|| Box::new(question_mark::QuestionMark));
store.register_early_pass(|| box suspicious_operation_groupings::SuspiciousOperationGroupings); store.register_early_pass(|| Box::new(suspicious_operation_groupings::SuspiciousOperationGroupings));
store.register_late_pass(|| box suspicious_trait_impl::SuspiciousImpl); store.register_late_pass(|| Box::new(suspicious_trait_impl::SuspiciousImpl));
store.register_late_pass(|| box map_unit_fn::MapUnit); store.register_late_pass(|| Box::new(map_unit_fn::MapUnit));
store.register_late_pass(|| box inherent_impl::MultipleInherentImpl); store.register_late_pass(|| Box::new(inherent_impl::MultipleInherentImpl));
store.register_late_pass(|| box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd); store.register_late_pass(|| Box::new(neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd));
store.register_late_pass(|| box unwrap::Unwrap); store.register_late_pass(|| Box::new(unwrap::Unwrap));
store.register_late_pass(|| box duration_subsec::DurationSubsec); store.register_late_pass(|| Box::new(duration_subsec::DurationSubsec));
store.register_late_pass(|| box indexing_slicing::IndexingSlicing); store.register_late_pass(|| Box::new(indexing_slicing::IndexingSlicing));
store.register_late_pass(|| box non_copy_const::NonCopyConst); store.register_late_pass(|| Box::new(non_copy_const::NonCopyConst));
store.register_late_pass(|| box ptr_offset_with_cast::PtrOffsetWithCast); store.register_late_pass(|| Box::new(ptr_offset_with_cast::PtrOffsetWithCast));
store.register_late_pass(|| box redundant_clone::RedundantClone); store.register_late_pass(|| Box::new(redundant_clone::RedundantClone));
store.register_late_pass(|| box slow_vector_initialization::SlowVectorInit); store.register_late_pass(|| Box::new(slow_vector_initialization::SlowVectorInit));
store.register_late_pass(|| box unnecessary_sort_by::UnnecessarySortBy); store.register_late_pass(|| Box::new(unnecessary_sort_by::UnnecessarySortBy));
store.register_late_pass(move || box unnecessary_wraps::UnnecessaryWraps::new(avoid_breaking_exported_api)); store.register_late_pass(move || Box::new(unnecessary_wraps::UnnecessaryWraps::new(avoid_breaking_exported_api)));
store.register_late_pass(|| box assertions_on_constants::AssertionsOnConstants); store.register_late_pass(|| Box::new(assertions_on_constants::AssertionsOnConstants));
store.register_late_pass(|| box transmuting_null::TransmutingNull); store.register_late_pass(|| Box::new(transmuting_null::TransmutingNull));
store.register_late_pass(|| box path_buf_push_overwrite::PathBufPushOverwrite); store.register_late_pass(|| Box::new(path_buf_push_overwrite::PathBufPushOverwrite));
store.register_late_pass(|| box integer_division::IntegerDivision); store.register_late_pass(|| Box::new(integer_division::IntegerDivision));
store.register_late_pass(|| box inherent_to_string::InherentToString); store.register_late_pass(|| Box::new(inherent_to_string::InherentToString));
let max_trait_bounds = conf.max_trait_bounds; let max_trait_bounds = conf.max_trait_bounds;
store.register_late_pass(move || box trait_bounds::TraitBounds::new(max_trait_bounds)); store.register_late_pass(move || Box::new(trait_bounds::TraitBounds::new(max_trait_bounds)));
store.register_late_pass(|| box comparison_chain::ComparisonChain); store.register_late_pass(|| Box::new(comparison_chain::ComparisonChain));
store.register_late_pass(|| box mut_key::MutableKeyType); store.register_late_pass(|| Box::new(mut_key::MutableKeyType));
store.register_late_pass(|| box modulo_arithmetic::ModuloArithmetic); store.register_late_pass(|| Box::new(modulo_arithmetic::ModuloArithmetic));
store.register_early_pass(|| box reference::DerefAddrOf); store.register_early_pass(|| Box::new(reference::DerefAddrOf));
store.register_early_pass(|| box reference::RefInDeref); store.register_early_pass(|| Box::new(reference::RefInDeref));
store.register_early_pass(|| box double_parens::DoubleParens); store.register_early_pass(|| Box::new(double_parens::DoubleParens));
store.register_late_pass(|| box to_string_in_display::ToStringInDisplay::new()); store.register_late_pass(|| Box::new(to_string_in_display::ToStringInDisplay::new()));
store.register_early_pass(|| box unsafe_removed_from_name::UnsafeNameRemoval); store.register_early_pass(|| Box::new(unsafe_removed_from_name::UnsafeNameRemoval));
store.register_early_pass(|| box if_not_else::IfNotElse); store.register_early_pass(|| Box::new(if_not_else::IfNotElse));
store.register_early_pass(|| box else_if_without_else::ElseIfWithoutElse); store.register_early_pass(|| Box::new(else_if_without_else::ElseIfWithoutElse));
store.register_early_pass(|| box int_plus_one::IntPlusOne); store.register_early_pass(|| Box::new(int_plus_one::IntPlusOne));
store.register_early_pass(|| box formatting::Formatting); store.register_early_pass(|| Box::new(formatting::Formatting));
store.register_early_pass(|| box misc_early::MiscEarlyLints); store.register_early_pass(|| Box::new(misc_early::MiscEarlyLints));
store.register_early_pass(|| box redundant_closure_call::RedundantClosureCall); store.register_early_pass(|| Box::new(redundant_closure_call::RedundantClosureCall));
store.register_late_pass(|| box redundant_closure_call::RedundantClosureCall); store.register_late_pass(|| Box::new(redundant_closure_call::RedundantClosureCall));
store.register_early_pass(|| box unused_unit::UnusedUnit); store.register_early_pass(|| Box::new(unused_unit::UnusedUnit));
store.register_late_pass(|| box returns::Return); store.register_late_pass(|| Box::new(returns::Return));
store.register_early_pass(|| box collapsible_if::CollapsibleIf); store.register_early_pass(|| Box::new(collapsible_if::CollapsibleIf));
store.register_early_pass(|| box items_after_statements::ItemsAfterStatements); store.register_early_pass(|| Box::new(items_after_statements::ItemsAfterStatements));
store.register_early_pass(|| box precedence::Precedence); store.register_early_pass(|| Box::new(precedence::Precedence));
store.register_early_pass(|| box needless_continue::NeedlessContinue); store.register_early_pass(|| Box::new(needless_continue::NeedlessContinue));
store.register_early_pass(|| box redundant_else::RedundantElse); store.register_early_pass(|| Box::new(redundant_else::RedundantElse));
store.register_late_pass(|| box create_dir::CreateDir); store.register_late_pass(|| Box::new(create_dir::CreateDir));
store.register_early_pass(|| box needless_arbitrary_self_type::NeedlessArbitrarySelfType); store.register_early_pass(|| Box::new(needless_arbitrary_self_type::NeedlessArbitrarySelfType));
let cargo_ignore_publish = conf.cargo_ignore_publish; let cargo_ignore_publish = conf.cargo_ignore_publish;
store.register_late_pass(move || box cargo_common_metadata::CargoCommonMetadata::new(cargo_ignore_publish)); store.register_late_pass(move || Box::new(cargo_common_metadata::CargoCommonMetadata::new(cargo_ignore_publish)));
store.register_late_pass(|| box multiple_crate_versions::MultipleCrateVersions); store.register_late_pass(|| Box::new(multiple_crate_versions::MultipleCrateVersions));
store.register_late_pass(|| box wildcard_dependencies::WildcardDependencies); store.register_late_pass(|| Box::new(wildcard_dependencies::WildcardDependencies));
let literal_representation_lint_fraction_readability = conf.unreadable_literal_lint_fractions; let literal_representation_lint_fraction_readability = conf.unreadable_literal_lint_fractions;
store.register_early_pass(move || box literal_representation::LiteralDigitGrouping::new(literal_representation_lint_fraction_readability)); store.register_early_pass(move || Box::new(literal_representation::LiteralDigitGrouping::new(literal_representation_lint_fraction_readability)));
let literal_representation_threshold = conf.literal_representation_threshold; let literal_representation_threshold = conf.literal_representation_threshold;
store.register_early_pass(move || box literal_representation::DecimalLiteralRepresentation::new(literal_representation_threshold)); store.register_early_pass(move || Box::new(literal_representation::DecimalLiteralRepresentation::new(literal_representation_threshold)));
let enum_variant_name_threshold = conf.enum_variant_name_threshold; let enum_variant_name_threshold = conf.enum_variant_name_threshold;
store.register_late_pass(move || box enum_variants::EnumVariantNames::new(enum_variant_name_threshold, avoid_breaking_exported_api)); store.register_late_pass(move || Box::new(enum_variants::EnumVariantNames::new(enum_variant_name_threshold, avoid_breaking_exported_api)));
store.register_early_pass(|| box tabs_in_doc_comments::TabsInDocComments); store.register_early_pass(|| Box::new(tabs_in_doc_comments::TabsInDocComments));
let upper_case_acronyms_aggressive = conf.upper_case_acronyms_aggressive; let upper_case_acronyms_aggressive = conf.upper_case_acronyms_aggressive;
store.register_late_pass(move || box upper_case_acronyms::UpperCaseAcronyms::new(avoid_breaking_exported_api, upper_case_acronyms_aggressive)); store.register_late_pass(move || Box::new(upper_case_acronyms::UpperCaseAcronyms::new(avoid_breaking_exported_api, upper_case_acronyms_aggressive)));
store.register_late_pass(|| box default::Default::default()); store.register_late_pass(|| Box::new(default::Default::default()));
store.register_late_pass(|| box unused_self::UnusedSelf); store.register_late_pass(|| Box::new(unused_self::UnusedSelf));
store.register_late_pass(|| box mutable_debug_assertion::DebugAssertWithMutCall); store.register_late_pass(|| Box::new(mutable_debug_assertion::DebugAssertWithMutCall));
store.register_late_pass(|| box exit::Exit); store.register_late_pass(|| Box::new(exit::Exit));
store.register_late_pass(|| box to_digit_is_some::ToDigitIsSome); store.register_late_pass(|| Box::new(to_digit_is_some::ToDigitIsSome));
let array_size_threshold = conf.array_size_threshold; let array_size_threshold = conf.array_size_threshold;
store.register_late_pass(move || box large_stack_arrays::LargeStackArrays::new(array_size_threshold)); store.register_late_pass(move || Box::new(large_stack_arrays::LargeStackArrays::new(array_size_threshold)));
store.register_late_pass(move || box large_const_arrays::LargeConstArrays::new(array_size_threshold)); store.register_late_pass(move || Box::new(large_const_arrays::LargeConstArrays::new(array_size_threshold)));
store.register_late_pass(|| box floating_point_arithmetic::FloatingPointArithmetic); store.register_late_pass(|| Box::new(floating_point_arithmetic::FloatingPointArithmetic));
store.register_early_pass(|| box as_conversions::AsConversions); store.register_early_pass(|| Box::new(as_conversions::AsConversions));
store.register_late_pass(|| box let_underscore::LetUnderscore); store.register_late_pass(|| Box::new(let_underscore::LetUnderscore));
store.register_early_pass(|| box single_component_path_imports::SingleComponentPathImports); store.register_early_pass(|| Box::new(single_component_path_imports::SingleComponentPathImports));
let max_fn_params_bools = conf.max_fn_params_bools; let max_fn_params_bools = conf.max_fn_params_bools;
let max_struct_bools = conf.max_struct_bools; let max_struct_bools = conf.max_struct_bools;
store.register_early_pass(move || box excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools)); store.register_early_pass(move || Box::new(excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools)));
store.register_early_pass(|| box option_env_unwrap::OptionEnvUnwrap); store.register_early_pass(|| Box::new(option_env_unwrap::OptionEnvUnwrap));
let warn_on_all_wildcard_imports = conf.warn_on_all_wildcard_imports; let warn_on_all_wildcard_imports = conf.warn_on_all_wildcard_imports;
store.register_late_pass(move || box wildcard_imports::WildcardImports::new(warn_on_all_wildcard_imports)); store.register_late_pass(move || Box::new(wildcard_imports::WildcardImports::new(warn_on_all_wildcard_imports)));
store.register_late_pass(|| box verbose_file_reads::VerboseFileReads); store.register_late_pass(|| Box::new(verbose_file_reads::VerboseFileReads));
store.register_late_pass(|| box redundant_pub_crate::RedundantPubCrate::default()); store.register_late_pass(|| Box::new(redundant_pub_crate::RedundantPubCrate::default()));
store.register_late_pass(|| box unnamed_address::UnnamedAddress); store.register_late_pass(|| Box::new(unnamed_address::UnnamedAddress));
store.register_late_pass(|| box dereference::Dereferencing::default()); store.register_late_pass(|| Box::new(dereference::Dereferencing::default()));
store.register_late_pass(|| box option_if_let_else::OptionIfLetElse); store.register_late_pass(|| Box::new(option_if_let_else::OptionIfLetElse));
store.register_late_pass(|| box future_not_send::FutureNotSend); store.register_late_pass(|| Box::new(future_not_send::FutureNotSend));
store.register_late_pass(|| box if_let_mutex::IfLetMutex); store.register_late_pass(|| Box::new(if_let_mutex::IfLetMutex));
store.register_late_pass(|| box mut_mutex_lock::MutMutexLock); store.register_late_pass(|| Box::new(mut_mutex_lock::MutMutexLock));
store.register_late_pass(|| box match_on_vec_items::MatchOnVecItems); store.register_late_pass(|| Box::new(match_on_vec_items::MatchOnVecItems));
store.register_late_pass(|| box manual_async_fn::ManualAsyncFn); store.register_late_pass(|| Box::new(manual_async_fn::ManualAsyncFn));
store.register_late_pass(|| box vec_resize_to_zero::VecResizeToZero); store.register_late_pass(|| Box::new(vec_resize_to_zero::VecResizeToZero));
store.register_late_pass(|| box panic_in_result_fn::PanicInResultFn); store.register_late_pass(|| Box::new(panic_in_result_fn::PanicInResultFn));
let single_char_binding_names_threshold = conf.single_char_binding_names_threshold; let single_char_binding_names_threshold = conf.single_char_binding_names_threshold;
store.register_early_pass(move || box non_expressive_names::NonExpressiveNames { store.register_early_pass(move || Box::new(non_expressive_names::NonExpressiveNames {
single_char_binding_names_threshold, single_char_binding_names_threshold,
}); }));
let macro_matcher = conf.standard_macro_braces.iter().cloned().collect::<FxHashSet<_>>(); let macro_matcher = conf.standard_macro_braces.iter().cloned().collect::<FxHashSet<_>>();
store.register_early_pass(move || box nonstandard_macro_braces::MacroBraces::new(&macro_matcher)); store.register_early_pass(move || Box::new(nonstandard_macro_braces::MacroBraces::new(&macro_matcher)));
store.register_late_pass(|| box macro_use::MacroUseImports::default()); store.register_late_pass(|| Box::new(macro_use::MacroUseImports::default()));
store.register_late_pass(|| box pattern_type_mismatch::PatternTypeMismatch); store.register_late_pass(|| Box::new(pattern_type_mismatch::PatternTypeMismatch));
store.register_late_pass(|| box stable_sort_primitive::StableSortPrimitive); store.register_late_pass(|| Box::new(stable_sort_primitive::StableSortPrimitive));
store.register_late_pass(|| box repeat_once::RepeatOnce); store.register_late_pass(|| Box::new(repeat_once::RepeatOnce));
store.register_late_pass(|| box unwrap_in_result::UnwrapInResult); store.register_late_pass(|| Box::new(unwrap_in_result::UnwrapInResult));
store.register_late_pass(|| box self_assignment::SelfAssignment); store.register_late_pass(|| Box::new(self_assignment::SelfAssignment));
store.register_late_pass(|| box manual_unwrap_or::ManualUnwrapOr); store.register_late_pass(|| Box::new(manual_unwrap_or::ManualUnwrapOr));
store.register_late_pass(|| box manual_ok_or::ManualOkOr); store.register_late_pass(|| Box::new(manual_ok_or::ManualOkOr));
store.register_late_pass(|| box float_equality_without_abs::FloatEqualityWithoutAbs); store.register_late_pass(|| Box::new(float_equality_without_abs::FloatEqualityWithoutAbs));
store.register_late_pass(|| box semicolon_if_nothing_returned::SemicolonIfNothingReturned); store.register_late_pass(|| Box::new(semicolon_if_nothing_returned::SemicolonIfNothingReturned));
store.register_late_pass(|| box async_yields_async::AsyncYieldsAsync); store.register_late_pass(|| Box::new(async_yields_async::AsyncYieldsAsync));
let disallowed_methods = conf.disallowed_methods.iter().cloned().collect::<FxHashSet<_>>(); let disallowed_methods = conf.disallowed_methods.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box disallowed_method::DisallowedMethod::new(&disallowed_methods)); store.register_late_pass(move || Box::new(disallowed_method::DisallowedMethod::new(&disallowed_methods)));
store.register_early_pass(|| box asm_syntax::InlineAsmX86AttSyntax); store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86AttSyntax));
store.register_early_pass(|| box asm_syntax::InlineAsmX86IntelSyntax); store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86IntelSyntax));
store.register_late_pass(|| box undropped_manually_drops::UndroppedManuallyDrops); store.register_late_pass(|| Box::new(undropped_manually_drops::UndroppedManuallyDrops));
store.register_late_pass(|| box strings::StrToString); store.register_late_pass(|| Box::new(strings::StrToString));
store.register_late_pass(|| box strings::StringToString); store.register_late_pass(|| Box::new(strings::StringToString));
store.register_late_pass(|| box zero_sized_map_values::ZeroSizedMapValues); store.register_late_pass(|| Box::new(zero_sized_map_values::ZeroSizedMapValues));
store.register_late_pass(|| box vec_init_then_push::VecInitThenPush::default()); store.register_late_pass(|| Box::new(vec_init_then_push::VecInitThenPush::default()));
store.register_late_pass(|| box case_sensitive_file_extension_comparisons::CaseSensitiveFileExtensionComparisons); store.register_late_pass(|| Box::new(case_sensitive_file_extension_comparisons::CaseSensitiveFileExtensionComparisons));
store.register_late_pass(|| box redundant_slicing::RedundantSlicing); store.register_late_pass(|| Box::new(redundant_slicing::RedundantSlicing));
store.register_late_pass(|| box from_str_radix_10::FromStrRadix10); store.register_late_pass(|| Box::new(from_str_radix_10::FromStrRadix10));
store.register_late_pass(|| box manual_map::ManualMap); store.register_late_pass(|| Box::new(manual_map::ManualMap));
store.register_late_pass(move || box if_then_some_else_none::IfThenSomeElseNone::new(msrv)); store.register_late_pass(move || Box::new(if_then_some_else_none::IfThenSomeElseNone::new(msrv)));
store.register_early_pass(|| box bool_assert_comparison::BoolAssertComparison); store.register_early_pass(|| Box::new(bool_assert_comparison::BoolAssertComparison));
store.register_late_pass(|| box unused_async::UnusedAsync); store.register_late_pass(|| Box::new(unused_async::UnusedAsync));
let disallowed_types = conf.disallowed_types.iter().cloned().collect::<FxHashSet<_>>(); let disallowed_types = conf.disallowed_types.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box disallowed_type::DisallowedType::new(&disallowed_types)); store.register_late_pass(move || Box::new(disallowed_type::DisallowedType::new(&disallowed_types)));
let import_renames = conf.enforced_import_renames.clone(); let import_renames = conf.enforced_import_renames.clone();
store.register_late_pass(move || box missing_enforced_import_rename::ImportRename::new(import_renames.clone())); store.register_late_pass(move || Box::new(missing_enforced_import_rename::ImportRename::new(import_renames.clone())));
let scripts = conf.allowed_scripts.clone(); let scripts = conf.allowed_scripts.clone();
store.register_early_pass(move || box disallowed_script_idents::DisallowedScriptIdents::new(&scripts)); store.register_early_pass(move || Box::new(disallowed_script_idents::DisallowedScriptIdents::new(&scripts)));
store.register_late_pass(|| box strlen_on_c_strings::StrlenOnCStrings); store.register_late_pass(|| Box::new(strlen_on_c_strings::StrlenOnCStrings));
store.register_late_pass(move || box self_named_constructors::SelfNamedConstructors); store.register_late_pass(move || Box::new(self_named_constructors::SelfNamedConstructors));
} }
#[rustfmt::skip] #[rustfmt::skip]