1 // error-pattern:cargo-clippy
3 #![feature(bindings_after_at)]
4 #![feature(box_patterns)]
5 #![feature(box_syntax)]
6 #![feature(concat_idents)]
7 #![feature(crate_visibility_modifier)]
8 #![feature(drain_filter)]
9 #![feature(in_band_lifetimes)]
10 #![feature(once_cell)]
11 #![feature(or_patterns)]
12 #![feature(rustc_private)]
13 #![feature(stmt_expr_attributes)]
14 #![feature(control_flow_enum)]
15 #![recursion_limit = "512"]
16 #![cfg_attr(feature = "deny-warnings", deny(warnings))]
17 #![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
18 #![warn(trivial_casts, trivial_numeric_casts)]
19 // warn on lints, that are included in `rust-lang/rust`s bootstrap
20 #![warn(rust_2018_idioms, unused_lifetimes)]
21 // warn on rustc internal lints
22 #![deny(rustc::internal)]
24 // FIXME: switch to something more ergonomic here, once available.
25 // (Currently there is no way to opt into sysroot crates without `extern crate`.)
26 extern crate rustc_ast;
27 extern crate rustc_ast_pretty;
28 extern crate rustc_attr;
29 extern crate rustc_data_structures;
30 extern crate rustc_driver;
31 extern crate rustc_errors;
32 extern crate rustc_hir;
33 extern crate rustc_hir_pretty;
34 extern crate rustc_index;
35 extern crate rustc_infer;
36 extern crate rustc_lexer;
37 extern crate rustc_lint;
38 extern crate rustc_middle;
39 extern crate rustc_mir;
40 extern crate rustc_parse;
41 extern crate rustc_parse_format;
42 extern crate rustc_session;
43 extern crate rustc_span;
44 extern crate rustc_target;
45 extern crate rustc_trait_selection;
46 extern crate rustc_typeck;
48 use crate::utils::parse_msrv;
49 use rustc_data_structures::fx::FxHashSet;
50 use rustc_lint::LintId;
51 use rustc_session::Session;
53 /// Macro used to declare a Clippy lint.
55 /// Every lint declaration consists of 4 parts:
57 /// 1. The documentation, which is used for the website
58 /// 2. The `LINT_NAME`. See [lint naming][lint_naming] on lint naming conventions.
59 /// 3. The `lint_level`, which is a mapping from *one* of our lint groups to `Allow`, `Warn` or
60 /// `Deny`. The lint level here has nothing to do with what lint groups the lint is a part of.
61 /// 4. The `description` that contains a short explanation on what's wrong with code where the
62 /// lint is triggered.
64 /// Currently the categories `style`, `correctness`, `complexity` and `perf` are enabled by default.
65 /// As said in the README.md of this repository, if the lint level mapping changes, please update
71 /// #![feature(rustc_private)]
72 /// extern crate rustc_session;
73 /// use rustc_session::declare_tool_lint;
74 /// use clippy_lints::declare_clippy_lint;
76 /// declare_clippy_lint! {
77 /// /// **What it does:** Checks for ... (describe what the lint matches).
79 /// /// **Why is this bad?** Supply the reason for linting the code.
81 /// /// **Known problems:** None. (Or describe where it could go wrong.)
87 /// /// Insert a short example of code that triggers the lint
90 /// /// Insert a short example of improved code that doesn't trigger the lint
97 /// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
99 macro_rules! declare_clippy_lint {
100 { $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
102 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
105 { $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
107 $(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
110 { $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
112 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
115 { $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
117 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
120 { $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
122 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
125 { $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
127 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
130 { $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
132 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
135 { $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
137 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
140 { $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
142 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
145 { $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
147 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
156 // begin lints modules, do not remove this comment, it’s used in `update_lints`
161 mod assertions_on_constants;
163 mod async_yields_async;
166 mod await_holding_invalid;
168 mod blacklisted_name;
169 mod blocks_in_if_conditions;
172 mod cargo_common_metadata;
173 mod case_sensitive_file_extension_comparisons;
174 mod checked_conversions;
175 mod cognitive_complexity;
177 mod collapsible_match;
178 mod comparison_chain;
186 mod disallowed_method;
188 mod double_comparison;
192 mod else_if_without_else;
201 mod eval_order_dependence;
205 mod fallible_impl_from;
206 mod float_equality_without_abs;
208 mod floating_point_arithmetic;
214 mod get_last_with_len;
217 mod if_let_some_result;
220 mod implicit_saturating_sub;
221 mod indexing_slicing;
224 mod inherent_to_string;
225 mod inline_fn_without_body;
227 mod integer_division;
228 mod items_after_statements;
229 mod large_const_arrays;
230 mod large_enum_variant;
231 mod large_stack_arrays;
236 mod literal_representation;
241 mod manual_non_exhaustive;
244 mod manual_unwrap_or;
249 mod match_on_vec_items;
251 mod mem_discriminant;
258 mod missing_const_for_fn;
261 mod modulo_arithmetic;
262 mod multiple_crate_versions;
267 mod mutable_debug_assertion;
269 mod needless_arbitrary_self_type;
272 mod needless_borrowed_ref;
273 mod needless_continue;
274 mod needless_pass_by_value;
275 mod needless_question_mark;
277 mod neg_cmp_op_on_partial_ord;
279 mod new_without_default;
282 mod non_expressive_names;
284 mod option_env_unwrap;
285 mod option_if_let_else;
286 mod overflow_check_conditional;
287 mod panic_in_result_fn;
288 mod panic_unimplemented;
289 mod partialeq_ne_impl;
290 mod pass_by_ref_or_value;
291 mod path_buf_push_overwrite;
292 mod pattern_type_mismatch;
296 mod ptr_offset_with_cast;
300 mod redundant_closure_call;
302 mod redundant_field_names;
303 mod redundant_pub_crate;
304 mod redundant_slicing;
305 mod redundant_static_lifetimes;
314 mod single_component_path_imports;
315 mod size_of_in_element_count;
316 mod slow_vector_initialization;
317 mod stable_sort_primitive;
319 mod suspicious_operation_groupings;
320 mod suspicious_trait_impl;
322 mod tabs_in_doc_comments;
323 mod temporary_assignment;
324 mod to_digit_is_some;
325 mod to_string_in_display;
328 mod transmuting_null;
331 mod undropped_manually_drops;
333 mod unit_return_expecting_ord;
335 mod unnecessary_sort_by;
336 mod unnecessary_wraps;
337 mod unnested_or_patterns;
338 mod unsafe_removed_from_name;
339 mod unused_io_amount;
343 mod unwrap_in_result;
345 mod useless_conversion;
347 mod vec_init_then_push;
348 mod vec_resize_to_zero;
349 mod verbose_file_reads;
350 mod wildcard_dependencies;
351 mod wildcard_imports;
354 mod zero_sized_map_values;
355 // end lints modules, do not remove this comment, it’s used in `update_lints`
357 pub use crate::utils::conf::Conf;
359 /// Register all pre expansion lints
361 /// Pre-expansion lints run before any macro expansion has happened.
363 /// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
364 /// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
366 /// Used in `./src/driver.rs`.
367 pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) {
368 store.register_pre_expansion_pass(|| box write::Write::default());
369 store.register_pre_expansion_pass(|| box attrs::EarlyAttributes);
370 store.register_pre_expansion_pass(|| box dbg_macro::DbgMacro);
374 pub fn read_conf(args: &[rustc_ast::NestedMetaItem], sess: &Session) -> Conf {
376 match utils::conf::file_from_args(args) {
378 // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
379 // do not require the file to exist
380 let file_name = match file_name {
381 Some(file_name) => file_name,
382 None => match utils::conf::lookup_conf_file() {
383 Ok(Some(path)) => path,
384 Ok(None) => return Conf::default(),
386 sess.struct_err(&format!("error finding Clippy's configuration file: {}", error))
388 return Conf::default();
393 let file_name = if file_name.is_relative() {
394 sess.local_crate_source_file
396 .and_then(Path::parent)
397 .unwrap_or_else(|| Path::new(""))
403 let (conf, errors) = utils::conf::read(&file_name);
405 // all conf errors are non-fatal, we just use the default conf in case of error
406 for error in errors {
407 sess.struct_err(&format!(
408 "error reading Clippy's configuration file `{}`: {}",
417 Err((err, span)) => {
418 sess.struct_span_err(span, err)
419 .span_note(span, "Clippy will use default configuration")
426 /// Register all lints and lint groups with the rustc plugin registry
428 /// Used in `./src/driver.rs`.
429 #[allow(clippy::too_many_lines)]
431 pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) {
432 register_removed_non_tool_lints(store);
434 // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
435 store.register_removed(
436 "clippy::should_assert_eq",
437 "`assert!()` will be more flexible with RFC 2011",
439 store.register_removed(
440 "clippy::extend_from_slice",
441 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
443 store.register_removed(
444 "clippy::range_step_by_zero",
445 "`iterator.step_by(0)` panics nowadays",
447 store.register_removed(
448 "clippy::unstable_as_slice",
449 "`Vec::as_slice` has been stabilized in 1.7",
451 store.register_removed(
452 "clippy::unstable_as_mut_slice",
453 "`Vec::as_mut_slice` has been stabilized in 1.7",
455 store.register_removed(
456 "clippy::misaligned_transmute",
457 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
459 store.register_removed(
460 "clippy::assign_ops",
461 "using compound assignment operators (e.g., `+=`) is harmless",
463 store.register_removed(
464 "clippy::if_let_redundant_pattern_matching",
465 "this lint has been changed to redundant_pattern_matching",
467 store.register_removed(
468 "clippy::unsafe_vector_initialization",
469 "the replacement suggested by this lint had substantially different behavior",
471 store.register_removed(
472 "clippy::invalid_ref",
473 "superseded by rustc lint `invalid_value`",
475 store.register_removed(
476 "clippy::unused_collect",
477 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint",
479 store.register_removed(
480 "clippy::into_iter_on_array",
481 "this lint has been uplifted to rustc and is now called `array_into_iter`",
483 store.register_removed(
484 "clippy::unused_label",
485 "this lint has been uplifted to rustc and is now called `unused_labels`",
487 store.register_removed(
488 "clippy::replace_consts",
489 "associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants",
491 store.register_removed(
492 "clippy::regex_macro",
493 "the regex! macro has been removed from the regex crate in 2018",
495 store.register_removed(
496 "clippy::drop_bounds",
497 "this lint has been uplifted to rustc and is now called `drop_bounds`",
499 store.register_removed(
500 "clippy::temporary_cstring_as_ptr",
501 "this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr`",
503 store.register_removed(
504 "clippy::panic_params",
505 "this lint has been uplifted to rustc and is now called `panic_fmt`",
507 // end deprecated lints, do not remove this comment, it’s used in `update_lints`
509 // begin register lints, do not remove this comment, it’s used in `update_lints`
510 store.register_lints(&[
511 #[cfg(feature = "internal-lints")]
512 &utils::internal_lints::CLIPPY_LINTS_INTERNAL,
513 #[cfg(feature = "internal-lints")]
514 &utils::internal_lints::COLLAPSIBLE_SPAN_LINT_CALLS,
515 #[cfg(feature = "internal-lints")]
516 &utils::internal_lints::COMPILER_LINT_FUNCTIONS,
517 #[cfg(feature = "internal-lints")]
518 &utils::internal_lints::DEFAULT_LINT,
519 #[cfg(feature = "internal-lints")]
520 &utils::internal_lints::INTERNING_DEFINED_SYMBOL,
521 #[cfg(feature = "internal-lints")]
522 &utils::internal_lints::INVALID_PATHS,
523 #[cfg(feature = "internal-lints")]
524 &utils::internal_lints::LINT_WITHOUT_LINT_PASS,
525 #[cfg(feature = "internal-lints")]
526 &utils::internal_lints::MATCH_TYPE_ON_DIAGNOSTIC_ITEM,
527 #[cfg(feature = "internal-lints")]
528 &utils::internal_lints::OUTER_EXPN_EXPN_DATA,
529 #[cfg(feature = "internal-lints")]
530 &utils::internal_lints::PRODUCE_ICE,
531 #[cfg(feature = "internal-lints")]
532 &utils::internal_lints::UNNECESSARY_SYMBOL_STR,
533 &approx_const::APPROX_CONSTANT,
534 &arithmetic::FLOAT_ARITHMETIC,
535 &arithmetic::INTEGER_ARITHMETIC,
536 &as_conversions::AS_CONVERSIONS,
537 &asm_syntax::INLINE_ASM_X86_ATT_SYNTAX,
538 &asm_syntax::INLINE_ASM_X86_INTEL_SYNTAX,
539 &assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
540 &assign_ops::ASSIGN_OP_PATTERN,
541 &assign_ops::MISREFACTORED_ASSIGN_OP,
542 &async_yields_async::ASYNC_YIELDS_ASYNC,
543 &atomic_ordering::INVALID_ATOMIC_ORDERING,
544 &attrs::BLANKET_CLIPPY_RESTRICTION_LINTS,
545 &attrs::DEPRECATED_CFG_ATTR,
546 &attrs::DEPRECATED_SEMVER,
547 &attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
548 &attrs::INLINE_ALWAYS,
549 &attrs::MISMATCHED_TARGET_OS,
550 &attrs::UNKNOWN_CLIPPY_LINTS,
551 &attrs::USELESS_ATTRIBUTE,
552 &await_holding_invalid::AWAIT_HOLDING_LOCK,
553 &await_holding_invalid::AWAIT_HOLDING_REFCELL_REF,
554 &bit_mask::BAD_BIT_MASK,
555 &bit_mask::INEFFECTIVE_BIT_MASK,
556 &bit_mask::VERBOSE_BIT_MASK,
557 &blacklisted_name::BLACKLISTED_NAME,
558 &blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS,
559 &booleans::LOGIC_BUG,
560 &booleans::NONMINIMAL_BOOL,
561 &bytecount::NAIVE_BYTECOUNT,
562 &cargo_common_metadata::CARGO_COMMON_METADATA,
563 &case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
564 &checked_conversions::CHECKED_CONVERSIONS,
565 &cognitive_complexity::COGNITIVE_COMPLEXITY,
566 &collapsible_if::COLLAPSIBLE_ELSE_IF,
567 &collapsible_if::COLLAPSIBLE_IF,
568 &collapsible_match::COLLAPSIBLE_MATCH,
569 &comparison_chain::COMPARISON_CHAIN,
570 &copies::IFS_SAME_COND,
571 &copies::IF_SAME_THEN_ELSE,
572 &copies::SAME_FUNCTIONS_IN_IF_CONDITION,
573 ©_iterator::COPY_ITERATOR,
574 &create_dir::CREATE_DIR,
575 &dbg_macro::DBG_MACRO,
576 &default::DEFAULT_TRAIT_ACCESS,
577 &default::FIELD_REASSIGN_WITH_DEFAULT,
578 &dereference::EXPLICIT_DEREF_METHODS,
579 &derive::DERIVE_HASH_XOR_EQ,
580 &derive::DERIVE_ORD_XOR_PARTIAL_ORD,
581 &derive::EXPL_IMPL_CLONE_ON_COPY,
582 &derive::UNSAFE_DERIVE_DESERIALIZE,
583 &disallowed_method::DISALLOWED_METHOD,
585 &doc::MISSING_ERRORS_DOC,
586 &doc::MISSING_SAFETY_DOC,
587 &doc::NEEDLESS_DOCTEST_MAIN,
588 &double_comparison::DOUBLE_COMPARISONS,
589 &double_parens::DOUBLE_PARENS,
590 &drop_forget_ref::DROP_COPY,
591 &drop_forget_ref::DROP_REF,
592 &drop_forget_ref::FORGET_COPY,
593 &drop_forget_ref::FORGET_REF,
594 &duration_subsec::DURATION_SUBSEC,
595 &else_if_without_else::ELSE_IF_WITHOUT_ELSE,
596 &empty_enum::EMPTY_ENUM,
598 &enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
599 &enum_variants::ENUM_VARIANT_NAMES,
600 &enum_variants::MODULE_INCEPTION,
601 &enum_variants::MODULE_NAME_REPETITIONS,
602 &enum_variants::PUB_ENUM_VARIANT_NAMES,
605 &erasing_op::ERASING_OP,
606 &escape::BOXED_LOCAL,
607 &eta_reduction::REDUNDANT_CLOSURE,
608 &eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
609 &eval_order_dependence::DIVERGING_SUB_EXPRESSION,
610 &eval_order_dependence::EVAL_ORDER_DEPENDENCE,
611 &excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS,
612 &excessive_bools::STRUCT_EXCESSIVE_BOOLS,
614 &explicit_write::EXPLICIT_WRITE,
615 &fallible_impl_from::FALLIBLE_IMPL_FROM,
616 &float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS,
617 &float_literal::EXCESSIVE_PRECISION,
618 &float_literal::LOSSY_FLOAT_LITERAL,
619 &floating_point_arithmetic::IMPRECISE_FLOPS,
620 &floating_point_arithmetic::SUBOPTIMAL_FLOPS,
621 &format::USELESS_FORMAT,
622 &formatting::POSSIBLE_MISSING_COMMA,
623 &formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
624 &formatting::SUSPICIOUS_ELSE_FORMATTING,
625 &formatting::SUSPICIOUS_UNARY_OP_FORMATTING,
626 &from_over_into::FROM_OVER_INTO,
627 &functions::DOUBLE_MUST_USE,
628 &functions::MUST_USE_CANDIDATE,
629 &functions::MUST_USE_UNIT,
630 &functions::NOT_UNSAFE_PTR_ARG_DEREF,
631 &functions::RESULT_UNIT_ERR,
632 &functions::TOO_MANY_ARGUMENTS,
633 &functions::TOO_MANY_LINES,
634 &future_not_send::FUTURE_NOT_SEND,
635 &get_last_with_len::GET_LAST_WITH_LEN,
636 &identity_op::IDENTITY_OP,
637 &if_let_mutex::IF_LET_MUTEX,
638 &if_let_some_result::IF_LET_SOME_RESULT,
639 &if_not_else::IF_NOT_ELSE,
640 &implicit_return::IMPLICIT_RETURN,
641 &implicit_saturating_sub::IMPLICIT_SATURATING_SUB,
642 &indexing_slicing::INDEXING_SLICING,
643 &indexing_slicing::OUT_OF_BOUNDS_INDEXING,
644 &infinite_iter::INFINITE_ITER,
645 &infinite_iter::MAYBE_INFINITE_ITER,
646 &inherent_impl::MULTIPLE_INHERENT_IMPL,
647 &inherent_to_string::INHERENT_TO_STRING,
648 &inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
649 &inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
650 &int_plus_one::INT_PLUS_ONE,
651 &integer_division::INTEGER_DIVISION,
652 &items_after_statements::ITEMS_AFTER_STATEMENTS,
653 &large_const_arrays::LARGE_CONST_ARRAYS,
654 &large_enum_variant::LARGE_ENUM_VARIANT,
655 &large_stack_arrays::LARGE_STACK_ARRAYS,
656 &len_zero::COMPARISON_TO_EMPTY,
657 &len_zero::LEN_WITHOUT_IS_EMPTY,
659 &let_if_seq::USELESS_LET_IF_SEQ,
660 &let_underscore::LET_UNDERSCORE_DROP,
661 &let_underscore::LET_UNDERSCORE_LOCK,
662 &let_underscore::LET_UNDERSCORE_MUST_USE,
663 &lifetimes::EXTRA_UNUSED_LIFETIMES,
664 &lifetimes::NEEDLESS_LIFETIMES,
665 &literal_representation::DECIMAL_LITERAL_REPRESENTATION,
666 &literal_representation::INCONSISTENT_DIGIT_GROUPING,
667 &literal_representation::LARGE_DIGIT_GROUPS,
668 &literal_representation::MISTYPED_LITERAL_SUFFIXES,
669 &literal_representation::UNREADABLE_LITERAL,
670 &literal_representation::UNUSUAL_BYTE_GROUPINGS,
672 &loops::EXPLICIT_COUNTER_LOOP,
673 &loops::EXPLICIT_INTO_ITER_LOOP,
674 &loops::EXPLICIT_ITER_LOOP,
676 &loops::FOR_LOOPS_OVER_FALLIBLES,
677 &loops::ITER_NEXT_LOOP,
678 &loops::MANUAL_MEMCPY,
679 &loops::MUT_RANGE_BOUND,
680 &loops::NEEDLESS_COLLECT,
681 &loops::NEEDLESS_RANGE_LOOP,
683 &loops::SAME_ITEM_PUSH,
684 &loops::SINGLE_ELEMENT_LOOP,
685 &loops::WHILE_IMMUTABLE_CONDITION,
686 &loops::WHILE_LET_LOOP,
687 &loops::WHILE_LET_ON_ITERATOR,
688 ¯o_use::MACRO_USE_IMPORTS,
689 &main_recursion::MAIN_RECURSION,
690 &manual_async_fn::MANUAL_ASYNC_FN,
691 &manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE,
692 &manual_ok_or::MANUAL_OK_OR,
693 &manual_strip::MANUAL_STRIP,
694 &manual_unwrap_or::MANUAL_UNWRAP_OR,
695 &map_clone::MAP_CLONE,
696 &map_err_ignore::MAP_ERR_IGNORE,
697 &map_identity::MAP_IDENTITY,
698 &map_unit_fn::OPTION_MAP_UNIT_FN,
699 &map_unit_fn::RESULT_MAP_UNIT_FN,
700 &match_on_vec_items::MATCH_ON_VEC_ITEMS,
701 &matches::INFALLIBLE_DESTRUCTURING_MATCH,
702 &matches::MATCH_AS_REF,
703 &matches::MATCH_BOOL,
704 &matches::MATCH_LIKE_MATCHES_MACRO,
705 &matches::MATCH_OVERLAPPING_ARM,
706 &matches::MATCH_REF_PATS,
707 &matches::MATCH_SAME_ARMS,
708 &matches::MATCH_SINGLE_BINDING,
709 &matches::MATCH_WILDCARD_FOR_SINGLE_VARIANTS,
710 &matches::MATCH_WILD_ERR_ARM,
711 &matches::REDUNDANT_PATTERN_MATCHING,
712 &matches::REST_PAT_IN_FULLY_BOUND_STRUCTS,
713 &matches::SINGLE_MATCH,
714 &matches::SINGLE_MATCH_ELSE,
715 &matches::WILDCARD_ENUM_MATCH_ARM,
716 &matches::WILDCARD_IN_OR_PATTERNS,
717 &mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
718 &mem_forget::MEM_FORGET,
719 &mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
720 &mem_replace::MEM_REPLACE_WITH_DEFAULT,
721 &mem_replace::MEM_REPLACE_WITH_UNINIT,
722 &methods::BIND_INSTEAD_OF_MAP,
723 &methods::CHARS_LAST_CMP,
724 &methods::CHARS_NEXT_CMP,
725 &methods::CLONE_DOUBLE_REF,
726 &methods::CLONE_ON_COPY,
727 &methods::CLONE_ON_REF_PTR,
728 &methods::EXPECT_FUN_CALL,
729 &methods::EXPECT_USED,
730 &methods::FILETYPE_IS_FILE,
731 &methods::FILTER_MAP,
732 &methods::FILTER_MAP_NEXT,
733 &methods::FILTER_NEXT,
735 &methods::FLAT_MAP_IDENTITY,
736 &methods::FROM_ITER_INSTEAD_OF_COLLECT,
737 &methods::GET_UNWRAP,
738 &methods::INEFFICIENT_TO_STRING,
739 &methods::INSPECT_FOR_EACH,
740 &methods::INTO_ITER_ON_REF,
741 &methods::ITERATOR_STEP_BY_ZERO,
742 &methods::ITER_CLONED_COLLECT,
743 &methods::ITER_NEXT_SLICE,
745 &methods::ITER_NTH_ZERO,
746 &methods::ITER_SKIP_NEXT,
747 &methods::MANUAL_SATURATING_ARITHMETIC,
748 &methods::MAP_COLLECT_RESULT_UNIT,
749 &methods::MAP_FLATTEN,
750 &methods::MAP_UNWRAP_OR,
751 &methods::NEW_RET_NO_SELF,
753 &methods::OPTION_AS_REF_DEREF,
754 &methods::OPTION_MAP_OR_NONE,
755 &methods::OR_FUN_CALL,
756 &methods::RESULT_MAP_OR_INTO_OPTION,
757 &methods::SEARCH_IS_SOME,
758 &methods::SHOULD_IMPLEMENT_TRAIT,
759 &methods::SINGLE_CHAR_ADD_STR,
760 &methods::SINGLE_CHAR_PATTERN,
761 &methods::SKIP_WHILE_NEXT,
762 &methods::STRING_EXTEND_CHARS,
763 &methods::SUSPICIOUS_MAP,
764 &methods::UNINIT_ASSUMED_INIT,
765 &methods::UNNECESSARY_FILTER_MAP,
766 &methods::UNNECESSARY_FOLD,
767 &methods::UNNECESSARY_LAZY_EVALUATIONS,
768 &methods::UNWRAP_USED,
769 &methods::USELESS_ASREF,
770 &methods::WRONG_PUB_SELF_CONVENTION,
771 &methods::WRONG_SELF_CONVENTION,
772 &methods::ZST_OFFSET,
777 &misc::FLOAT_CMP_CONST,
779 &misc::SHORT_CIRCUIT_STATEMENT,
780 &misc::TOPLEVEL_REF_ARG,
781 &misc::USED_UNDERSCORE_BINDING,
783 &misc_early::BUILTIN_TYPE_SHADOW,
784 &misc_early::DOUBLE_NEG,
785 &misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
786 &misc_early::MIXED_CASE_HEX_LITERALS,
787 &misc_early::REDUNDANT_PATTERN,
788 &misc_early::UNNEEDED_FIELD_PATTERN,
789 &misc_early::UNNEEDED_WILDCARD_PATTERN,
790 &misc_early::UNSEPARATED_LITERAL_SUFFIX,
791 &misc_early::ZERO_PREFIXED_LITERAL,
792 &missing_const_for_fn::MISSING_CONST_FOR_FN,
793 &missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
794 &missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
795 &modulo_arithmetic::MODULO_ARITHMETIC,
796 &multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
797 &mut_key::MUTABLE_KEY_TYPE,
799 &mut_mutex_lock::MUT_MUTEX_LOCK,
800 &mut_reference::UNNECESSARY_MUT_PASSED,
801 &mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL,
802 &mutex_atomic::MUTEX_ATOMIC,
803 &mutex_atomic::MUTEX_INTEGER,
804 &needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE,
805 &needless_bool::BOOL_COMPARISON,
806 &needless_bool::NEEDLESS_BOOL,
807 &needless_borrow::NEEDLESS_BORROW,
808 &needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
809 &needless_continue::NEEDLESS_CONTINUE,
810 &needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
811 &needless_question_mark::NEEDLESS_QUESTION_MARK,
812 &needless_update::NEEDLESS_UPDATE,
813 &neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
814 &neg_multiply::NEG_MULTIPLY,
815 &new_without_default::NEW_WITHOUT_DEFAULT,
816 &no_effect::NO_EFFECT,
817 &no_effect::UNNECESSARY_OPERATION,
818 &non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
819 &non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
820 &non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
821 &non_expressive_names::MANY_SINGLE_CHAR_NAMES,
822 &non_expressive_names::SIMILAR_NAMES,
823 &open_options::NONSENSICAL_OPEN_OPTIONS,
824 &option_env_unwrap::OPTION_ENV_UNWRAP,
825 &option_if_let_else::OPTION_IF_LET_ELSE,
826 &overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
827 &panic_in_result_fn::PANIC_IN_RESULT_FN,
828 &panic_unimplemented::PANIC,
829 &panic_unimplemented::TODO,
830 &panic_unimplemented::UNIMPLEMENTED,
831 &panic_unimplemented::UNREACHABLE,
832 &partialeq_ne_impl::PARTIALEQ_NE_IMPL,
833 &pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE,
834 &pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF,
835 &path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
836 &pattern_type_mismatch::PATTERN_TYPE_MISMATCH,
837 &precedence::PRECEDENCE,
842 &ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
843 &question_mark::QUESTION_MARK,
844 &ranges::MANUAL_RANGE_CONTAINS,
845 &ranges::RANGE_MINUS_ONE,
846 &ranges::RANGE_PLUS_ONE,
847 &ranges::RANGE_ZIP_WITH_LEN,
848 &ranges::REVERSED_EMPTY_RANGES,
849 &redundant_clone::REDUNDANT_CLONE,
850 &redundant_closure_call::REDUNDANT_CLOSURE_CALL,
851 &redundant_else::REDUNDANT_ELSE,
852 &redundant_field_names::REDUNDANT_FIELD_NAMES,
853 &redundant_pub_crate::REDUNDANT_PUB_CRATE,
854 &redundant_slicing::REDUNDANT_SLICING,
855 &redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
856 &ref_option_ref::REF_OPTION_REF,
857 &reference::DEREF_ADDROF,
858 &reference::REF_IN_DEREF,
859 ®ex::INVALID_REGEX,
860 ®ex::TRIVIAL_REGEX,
861 &repeat_once::REPEAT_ONCE,
862 &returns::LET_AND_RETURN,
863 &returns::NEEDLESS_RETURN,
864 &self_assignment::SELF_ASSIGNMENT,
865 &serde_api::SERDE_API_MISUSE,
866 &shadow::SHADOW_REUSE,
867 &shadow::SHADOW_SAME,
868 &shadow::SHADOW_UNRELATED,
869 &single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS,
870 &size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT,
871 &slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
872 &stable_sort_primitive::STABLE_SORT_PRIMITIVE,
873 &strings::STRING_ADD,
874 &strings::STRING_ADD_ASSIGN,
875 &strings::STRING_FROM_UTF8_AS_BYTES,
876 &strings::STRING_LIT_AS_BYTES,
877 &strings::STRING_TO_STRING,
878 &strings::STR_TO_STRING,
879 &suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS,
880 &suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
881 &suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
882 &swap::ALMOST_SWAPPED,
884 &tabs_in_doc_comments::TABS_IN_DOC_COMMENTS,
885 &temporary_assignment::TEMPORARY_ASSIGNMENT,
886 &to_digit_is_some::TO_DIGIT_IS_SOME,
887 &to_string_in_display::TO_STRING_IN_DISPLAY,
888 &trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS,
889 &trait_bounds::TYPE_REPETITION_IN_BOUNDS,
890 &transmute::CROSSPOINTER_TRANSMUTE,
891 &transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS,
892 &transmute::TRANSMUTE_BYTES_TO_STR,
893 &transmute::TRANSMUTE_FLOAT_TO_INT,
894 &transmute::TRANSMUTE_INT_TO_BOOL,
895 &transmute::TRANSMUTE_INT_TO_CHAR,
896 &transmute::TRANSMUTE_INT_TO_FLOAT,
897 &transmute::TRANSMUTE_PTR_TO_PTR,
898 &transmute::TRANSMUTE_PTR_TO_REF,
899 &transmute::UNSOUND_COLLECTION_TRANSMUTE,
900 &transmute::USELESS_TRANSMUTE,
901 &transmute::WRONG_TRANSMUTE,
902 &transmuting_null::TRANSMUTING_NULL,
904 &types::ABSURD_EXTREME_COMPARISONS,
905 &types::BORROWED_BOX,
907 &types::CAST_LOSSLESS,
908 &types::CAST_POSSIBLE_TRUNCATION,
909 &types::CAST_POSSIBLE_WRAP,
910 &types::CAST_PRECISION_LOSS,
911 &types::CAST_PTR_ALIGNMENT,
912 &types::CAST_REF_TO_MUT,
913 &types::CAST_SIGN_LOSS,
914 &types::CHAR_LIT_AS_U8,
915 &types::FN_TO_NUMERIC_CAST,
916 &types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
917 &types::IMPLICIT_HASHER,
918 &types::INVALID_UPCAST_COMPARISONS,
919 &types::LET_UNIT_VALUE,
921 &types::OPTION_OPTION,
924 &types::REDUNDANT_ALLOCATION,
925 &types::TYPE_COMPLEXITY,
928 &types::UNNECESSARY_CAST,
930 &undropped_manually_drops::UNDROPPED_MANUALLY_DROPS,
931 &unicode::INVISIBLE_CHARACTERS,
932 &unicode::NON_ASCII_LITERAL,
933 &unicode::UNICODE_NOT_NFC,
934 &unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD,
935 &unnamed_address::FN_ADDRESS_COMPARISONS,
936 &unnamed_address::VTABLE_ADDRESS_COMPARISONS,
937 &unnecessary_sort_by::UNNECESSARY_SORT_BY,
938 &unnecessary_wraps::UNNECESSARY_WRAPS,
939 &unnested_or_patterns::UNNESTED_OR_PATTERNS,
940 &unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
941 &unused_io_amount::UNUSED_IO_AMOUNT,
942 &unused_self::UNUSED_SELF,
943 &unused_unit::UNUSED_UNIT,
944 &unwrap::PANICKING_UNWRAP,
945 &unwrap::UNNECESSARY_UNWRAP,
946 &unwrap_in_result::UNWRAP_IN_RESULT,
948 &useless_conversion::USELESS_CONVERSION,
950 &vec_init_then_push::VEC_INIT_THEN_PUSH,
951 &vec_resize_to_zero::VEC_RESIZE_TO_ZERO,
952 &verbose_file_reads::VERBOSE_FILE_READS,
953 &wildcard_dependencies::WILDCARD_DEPENDENCIES,
954 &wildcard_imports::ENUM_GLOB_USE,
955 &wildcard_imports::WILDCARD_IMPORTS,
956 &write::PRINTLN_EMPTY_STRING,
957 &write::PRINT_LITERAL,
958 &write::PRINT_STDERR,
959 &write::PRINT_STDOUT,
960 &write::PRINT_WITH_NEWLINE,
962 &write::WRITELN_EMPTY_STRING,
963 &write::WRITE_LITERAL,
964 &write::WRITE_WITH_NEWLINE,
965 &zero_div_zero::ZERO_DIVIDED_BY_ZERO,
966 &zero_sized_map_values::ZERO_SIZED_MAP_VALUES,
968 // end register lints, do not remove this comment, it’s used in `update_lints`
970 // all the internal lints
971 #[cfg(feature = "internal-lints")]
973 store.register_early_pass(|| box utils::internal_lints::ClippyLintsInternal);
974 store.register_early_pass(|| box utils::internal_lints::ProduceIce);
975 store.register_late_pass(|| box utils::inspector::DeepCodeInspector);
976 store.register_late_pass(|| box utils::internal_lints::CollapsibleCalls);
977 store.register_late_pass(|| box utils::internal_lints::CompilerLintFunctions::new());
978 store.register_late_pass(|| box utils::internal_lints::InvalidPaths);
979 store.register_late_pass(|| box utils::internal_lints::InterningDefinedSymbol::default());
980 store.register_late_pass(|| box utils::internal_lints::LintWithoutLintPass::default());
981 store.register_late_pass(|| box utils::internal_lints::MatchTypeOnDiagItem);
982 store.register_late_pass(|| box utils::internal_lints::OuterExpnDataPass);
984 store.register_late_pass(|| box utils::author::Author);
985 store.register_late_pass(|| box await_holding_invalid::AwaitHolding);
986 store.register_late_pass(|| box serde_api::SerdeAPI);
987 let vec_box_size_threshold = conf.vec_box_size_threshold;
988 store.register_late_pass(move || box types::Types::new(vec_box_size_threshold));
989 store.register_late_pass(|| box booleans::NonminimalBool);
990 store.register_late_pass(|| box eq_op::EqOp);
991 store.register_late_pass(|| box enum_clike::UnportableVariant);
992 store.register_late_pass(|| box float_literal::FloatLiteral);
993 let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
994 store.register_late_pass(move || box bit_mask::BitMask::new(verbose_bit_mask_threshold));
995 store.register_late_pass(|| box ptr::Ptr);
996 store.register_late_pass(|| box ptr_eq::PtrEq);
997 store.register_late_pass(|| box needless_bool::NeedlessBool);
998 store.register_late_pass(|| box needless_bool::BoolComparison);
999 store.register_late_pass(|| box approx_const::ApproxConstant);
1000 store.register_late_pass(|| box misc::MiscLints);
1001 store.register_late_pass(|| box eta_reduction::EtaReduction);
1002 store.register_late_pass(|| box identity_op::IdentityOp);
1003 store.register_late_pass(|| box erasing_op::ErasingOp);
1004 store.register_late_pass(|| box mut_mut::MutMut);
1005 store.register_late_pass(|| box mut_reference::UnnecessaryMutPassed);
1006 store.register_late_pass(|| box len_zero::LenZero);
1007 store.register_late_pass(|| box attrs::Attributes);
1008 store.register_late_pass(|| box blocks_in_if_conditions::BlocksInIfConditions);
1009 store.register_late_pass(|| box collapsible_match::CollapsibleMatch);
1010 store.register_late_pass(|| box unicode::Unicode);
1011 store.register_late_pass(|| box unit_return_expecting_ord::UnitReturnExpectingOrd);
1012 store.register_late_pass(|| box strings::StringAdd);
1013 store.register_late_pass(|| box implicit_return::ImplicitReturn);
1014 store.register_late_pass(|| box implicit_saturating_sub::ImplicitSaturatingSub);
1016 let msrv = conf.msrv.as_ref().and_then(|s| {
1017 parse_msrv(s, None, None).or_else(|| {
1018 sess.err(&format!("error reading Clippy's configuration file. `{}` is not a valid Rust version", s));
1023 store.register_late_pass(move || box methods::Methods::new(msrv));
1024 store.register_late_pass(move || box matches::Matches::new(msrv));
1025 store.register_early_pass(move || box manual_non_exhaustive::ManualNonExhaustive::new(msrv));
1026 store.register_late_pass(move || box manual_strip::ManualStrip::new(msrv));
1027 store.register_early_pass(move || box redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv));
1028 store.register_early_pass(move || box redundant_field_names::RedundantFieldNames::new(msrv));
1029 store.register_late_pass(move || box checked_conversions::CheckedConversions::new(msrv));
1030 store.register_late_pass(move || box mem_replace::MemReplace::new(msrv));
1031 store.register_late_pass(move || box ranges::Ranges::new(msrv));
1032 store.register_late_pass(move || box from_over_into::FromOverInto::new(msrv));
1033 store.register_late_pass(move || box use_self::UseSelf::new(msrv));
1034 store.register_late_pass(move || box missing_const_for_fn::MissingConstForFn::new(msrv));
1035 store.register_late_pass(move || box needless_question_mark::NeedlessQuestionMark::new(msrv));
1037 store.register_late_pass(|| box size_of_in_element_count::SizeOfInElementCount);
1038 store.register_late_pass(|| box map_clone::MapClone);
1039 store.register_late_pass(|| box map_err_ignore::MapErrIgnore);
1040 store.register_late_pass(|| box shadow::Shadow);
1041 store.register_late_pass(|| box types::LetUnitValue);
1042 store.register_late_pass(|| box types::UnitCmp);
1043 store.register_late_pass(|| box loops::Loops);
1044 store.register_late_pass(|| box main_recursion::MainRecursion::default());
1045 store.register_late_pass(|| box lifetimes::Lifetimes);
1046 store.register_late_pass(|| box entry::HashMapPass);
1047 store.register_late_pass(|| box types::Casts);
1048 let type_complexity_threshold = conf.type_complexity_threshold;
1049 store.register_late_pass(move || box types::TypeComplexity::new(type_complexity_threshold));
1050 store.register_late_pass(|| box minmax::MinMaxPass);
1051 store.register_late_pass(|| box open_options::OpenOptions);
1052 store.register_late_pass(|| box zero_div_zero::ZeroDiv);
1053 store.register_late_pass(|| box mutex_atomic::Mutex);
1054 store.register_late_pass(|| box needless_update::NeedlessUpdate);
1055 store.register_late_pass(|| box needless_borrow::NeedlessBorrow::default());
1056 store.register_late_pass(|| box needless_borrowed_ref::NeedlessBorrowedRef);
1057 store.register_late_pass(|| box no_effect::NoEffect);
1058 store.register_late_pass(|| box temporary_assignment::TemporaryAssignment);
1059 store.register_late_pass(|| box transmute::Transmute);
1060 let cognitive_complexity_threshold = conf.cognitive_complexity_threshold;
1061 store.register_late_pass(move || box cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold));
1062 let too_large_for_stack = conf.too_large_for_stack;
1063 store.register_late_pass(move || box escape::BoxedLocal{too_large_for_stack});
1064 store.register_late_pass(move || box vec::UselessVec{too_large_for_stack});
1065 store.register_late_pass(|| box panic_unimplemented::PanicUnimplemented);
1066 store.register_late_pass(|| box strings::StringLitAsBytes);
1067 store.register_late_pass(|| box derive::Derive);
1068 store.register_late_pass(|| box types::CharLitAsU8);
1069 store.register_late_pass(|| box get_last_with_len::GetLastWithLen);
1070 store.register_late_pass(|| box drop_forget_ref::DropForgetRef);
1071 store.register_late_pass(|| box empty_enum::EmptyEnum);
1072 store.register_late_pass(|| box types::AbsurdExtremeComparisons);
1073 store.register_late_pass(|| box types::InvalidUpcastComparisons);
1074 store.register_late_pass(|| box regex::Regex::default());
1075 store.register_late_pass(|| box copies::CopyAndPaste);
1076 store.register_late_pass(|| box copy_iterator::CopyIterator);
1077 store.register_late_pass(|| box format::UselessFormat);
1078 store.register_late_pass(|| box swap::Swap);
1079 store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
1080 store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
1081 let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
1082 store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
1083 let too_many_arguments_threshold1 = conf.too_many_arguments_threshold;
1084 let too_many_lines_threshold2 = conf.too_many_lines_threshold;
1085 store.register_late_pass(move || box functions::Functions::new(too_many_arguments_threshold1, too_many_lines_threshold2));
1086 let doc_valid_idents = conf.doc_valid_idents.iter().cloned().collect::<FxHashSet<_>>();
1087 store.register_late_pass(move || box doc::DocMarkdown::new(doc_valid_idents.clone()));
1088 store.register_late_pass(|| box neg_multiply::NegMultiply);
1089 store.register_late_pass(|| box mem_discriminant::MemDiscriminant);
1090 store.register_late_pass(|| box mem_forget::MemForget);
1091 store.register_late_pass(|| box arithmetic::Arithmetic::default());
1092 store.register_late_pass(|| box assign_ops::AssignOps);
1093 store.register_late_pass(|| box let_if_seq::LetIfSeq);
1094 store.register_late_pass(|| box eval_order_dependence::EvalOrderDependence);
1095 store.register_late_pass(|| box missing_doc::MissingDoc::new());
1096 store.register_late_pass(|| box missing_inline::MissingInline);
1097 store.register_late_pass(|| box if_let_some_result::OkIfLet);
1098 store.register_late_pass(|| box partialeq_ne_impl::PartialEqNeImpl);
1099 store.register_late_pass(|| box unused_io_amount::UnusedIoAmount);
1100 let enum_variant_size_threshold = conf.enum_variant_size_threshold;
1101 store.register_late_pass(move || box large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold));
1102 store.register_late_pass(|| box explicit_write::ExplicitWrite);
1103 store.register_late_pass(|| box needless_pass_by_value::NeedlessPassByValue);
1104 let pass_by_ref_or_value = pass_by_ref_or_value::PassByRefOrValue::new(
1105 conf.trivial_copy_size_limit,
1106 conf.pass_by_value_size_limit,
1109 store.register_late_pass(move || box pass_by_ref_or_value);
1110 store.register_late_pass(|| box ref_option_ref::RefOptionRef);
1111 store.register_late_pass(|| box try_err::TryErr);
1112 store.register_late_pass(|| box bytecount::ByteCount);
1113 store.register_late_pass(|| box infinite_iter::InfiniteIter);
1114 store.register_late_pass(|| box inline_fn_without_body::InlineFnWithoutBody);
1115 store.register_late_pass(|| box useless_conversion::UselessConversion::default());
1116 store.register_late_pass(|| box types::ImplicitHasher);
1117 store.register_late_pass(|| box fallible_impl_from::FallibleImplFrom);
1118 store.register_late_pass(|| box types::UnitArg);
1119 store.register_late_pass(|| box double_comparison::DoubleComparisons);
1120 store.register_late_pass(|| box question_mark::QuestionMark);
1121 store.register_early_pass(|| box suspicious_operation_groupings::SuspiciousOperationGroupings);
1122 store.register_late_pass(|| box suspicious_trait_impl::SuspiciousImpl);
1123 store.register_late_pass(|| box map_unit_fn::MapUnit);
1124 store.register_late_pass(|| box inherent_impl::MultipleInherentImpl::default());
1125 store.register_late_pass(|| box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
1126 store.register_late_pass(|| box unwrap::Unwrap);
1127 store.register_late_pass(|| box duration_subsec::DurationSubsec);
1128 store.register_late_pass(|| box indexing_slicing::IndexingSlicing);
1129 store.register_late_pass(|| box non_copy_const::NonCopyConst);
1130 store.register_late_pass(|| box ptr_offset_with_cast::PtrOffsetWithCast);
1131 store.register_late_pass(|| box redundant_clone::RedundantClone);
1132 store.register_late_pass(|| box slow_vector_initialization::SlowVectorInit);
1133 store.register_late_pass(|| box unnecessary_sort_by::UnnecessarySortBy);
1134 store.register_late_pass(|| box unnecessary_wraps::UnnecessaryWraps);
1135 store.register_late_pass(|| box types::RefToMut);
1136 store.register_late_pass(|| box assertions_on_constants::AssertionsOnConstants);
1137 store.register_late_pass(|| box transmuting_null::TransmutingNull);
1138 store.register_late_pass(|| box path_buf_push_overwrite::PathBufPushOverwrite);
1139 store.register_late_pass(|| box integer_division::IntegerDivision);
1140 store.register_late_pass(|| box inherent_to_string::InherentToString);
1141 let max_trait_bounds = conf.max_trait_bounds;
1142 store.register_late_pass(move || box trait_bounds::TraitBounds::new(max_trait_bounds));
1143 store.register_late_pass(|| box comparison_chain::ComparisonChain);
1144 store.register_late_pass(|| box mut_key::MutableKeyType);
1145 store.register_late_pass(|| box modulo_arithmetic::ModuloArithmetic);
1146 store.register_early_pass(|| box reference::DerefAddrOf);
1147 store.register_early_pass(|| box reference::RefInDeref);
1148 store.register_early_pass(|| box double_parens::DoubleParens);
1149 store.register_late_pass(|| box to_string_in_display::ToStringInDisplay::new());
1150 store.register_early_pass(|| box unsafe_removed_from_name::UnsafeNameRemoval);
1151 store.register_early_pass(|| box if_not_else::IfNotElse);
1152 store.register_early_pass(|| box else_if_without_else::ElseIfWithoutElse);
1153 store.register_early_pass(|| box int_plus_one::IntPlusOne);
1154 store.register_early_pass(|| box formatting::Formatting);
1155 store.register_early_pass(|| box misc_early::MiscEarlyLints);
1156 store.register_early_pass(|| box redundant_closure_call::RedundantClosureCall);
1157 store.register_late_pass(|| box redundant_closure_call::RedundantClosureCall);
1158 store.register_early_pass(|| box unused_unit::UnusedUnit);
1159 store.register_late_pass(|| box returns::Return);
1160 store.register_early_pass(|| box collapsible_if::CollapsibleIf);
1161 store.register_early_pass(|| box items_after_statements::ItemsAfterStatements);
1162 store.register_early_pass(|| box precedence::Precedence);
1163 store.register_early_pass(|| box needless_continue::NeedlessContinue);
1164 store.register_early_pass(|| box redundant_else::RedundantElse);
1165 store.register_late_pass(|| box create_dir::CreateDir);
1166 store.register_early_pass(|| box needless_arbitrary_self_type::NeedlessArbitrarySelfType);
1167 store.register_late_pass(|| box cargo_common_metadata::CargoCommonMetadata);
1168 store.register_late_pass(|| box multiple_crate_versions::MultipleCrateVersions);
1169 store.register_late_pass(|| box wildcard_dependencies::WildcardDependencies);
1170 let literal_representation_lint_fraction_readability = conf.unreadable_literal_lint_fractions;
1171 store.register_early_pass(move || box literal_representation::LiteralDigitGrouping::new(literal_representation_lint_fraction_readability));
1172 let literal_representation_threshold = conf.literal_representation_threshold;
1173 store.register_early_pass(move || box literal_representation::DecimalLiteralRepresentation::new(literal_representation_threshold));
1174 let enum_variant_name_threshold = conf.enum_variant_name_threshold;
1175 store.register_early_pass(move || box enum_variants::EnumVariantNames::new(enum_variant_name_threshold));
1176 store.register_early_pass(|| box tabs_in_doc_comments::TabsInDocComments);
1177 store.register_late_pass(|| box default::Default::default());
1178 store.register_late_pass(|| box unused_self::UnusedSelf);
1179 store.register_late_pass(|| box mutable_debug_assertion::DebugAssertWithMutCall);
1180 store.register_late_pass(|| box exit::Exit);
1181 store.register_late_pass(|| box to_digit_is_some::ToDigitIsSome);
1182 let array_size_threshold = conf.array_size_threshold;
1183 store.register_late_pass(move || box large_stack_arrays::LargeStackArrays::new(array_size_threshold));
1184 store.register_late_pass(move || box large_const_arrays::LargeConstArrays::new(array_size_threshold));
1185 store.register_late_pass(|| box floating_point_arithmetic::FloatingPointArithmetic);
1186 store.register_early_pass(|| box as_conversions::AsConversions);
1187 store.register_late_pass(|| box let_underscore::LetUnderscore);
1188 store.register_late_pass(|| box atomic_ordering::AtomicOrdering);
1189 store.register_early_pass(|| box single_component_path_imports::SingleComponentPathImports);
1190 let max_fn_params_bools = conf.max_fn_params_bools;
1191 let max_struct_bools = conf.max_struct_bools;
1192 store.register_early_pass(move || box excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools));
1193 store.register_early_pass(|| box option_env_unwrap::OptionEnvUnwrap);
1194 let warn_on_all_wildcard_imports = conf.warn_on_all_wildcard_imports;
1195 store.register_late_pass(move || box wildcard_imports::WildcardImports::new(warn_on_all_wildcard_imports));
1196 store.register_late_pass(|| box verbose_file_reads::VerboseFileReads);
1197 store.register_late_pass(|| box redundant_pub_crate::RedundantPubCrate::default());
1198 store.register_late_pass(|| box unnamed_address::UnnamedAddress);
1199 store.register_late_pass(|| box dereference::Dereferencing);
1200 store.register_late_pass(|| box option_if_let_else::OptionIfLetElse);
1201 store.register_late_pass(|| box future_not_send::FutureNotSend);
1202 store.register_late_pass(|| box if_let_mutex::IfLetMutex);
1203 store.register_late_pass(|| box mut_mutex_lock::MutMutexLock);
1204 store.register_late_pass(|| box match_on_vec_items::MatchOnVecItems);
1205 store.register_late_pass(|| box manual_async_fn::ManualAsyncFn);
1206 store.register_late_pass(|| box vec_resize_to_zero::VecResizeToZero);
1207 store.register_late_pass(|| box panic_in_result_fn::PanicInResultFn);
1208 let single_char_binding_names_threshold = conf.single_char_binding_names_threshold;
1209 store.register_early_pass(move || box non_expressive_names::NonExpressiveNames {
1210 single_char_binding_names_threshold,
1212 store.register_early_pass(|| box unnested_or_patterns::UnnestedOrPatterns);
1213 store.register_late_pass(|| box macro_use::MacroUseImports::default());
1214 store.register_late_pass(|| box map_identity::MapIdentity);
1215 store.register_late_pass(|| box pattern_type_mismatch::PatternTypeMismatch);
1216 store.register_late_pass(|| box stable_sort_primitive::StableSortPrimitive);
1217 store.register_late_pass(|| box repeat_once::RepeatOnce);
1218 store.register_late_pass(|| box unwrap_in_result::UnwrapInResult);
1219 store.register_late_pass(|| box self_assignment::SelfAssignment);
1220 store.register_late_pass(|| box manual_unwrap_or::ManualUnwrapOr);
1221 store.register_late_pass(|| box manual_ok_or::ManualOkOr);
1222 store.register_late_pass(|| box float_equality_without_abs::FloatEqualityWithoutAbs);
1223 store.register_late_pass(|| box async_yields_async::AsyncYieldsAsync);
1224 let disallowed_methods = conf.disallowed_methods.iter().cloned().collect::<FxHashSet<_>>();
1225 store.register_late_pass(move || box disallowed_method::DisallowedMethod::new(&disallowed_methods));
1226 store.register_early_pass(|| box asm_syntax::InlineAsmX86AttSyntax);
1227 store.register_early_pass(|| box asm_syntax::InlineAsmX86IntelSyntax);
1228 store.register_late_pass(|| box undropped_manually_drops::UndroppedManuallyDrops);
1229 store.register_late_pass(|| box strings::StrToString);
1230 store.register_late_pass(|| box strings::StringToString);
1231 store.register_late_pass(|| box zero_sized_map_values::ZeroSizedMapValues);
1232 store.register_late_pass(|| box vec_init_then_push::VecInitThenPush::default());
1233 store.register_late_pass(move || box types::PtrAsPtr::new(msrv));
1234 store.register_late_pass(|| box case_sensitive_file_extension_comparisons::CaseSensitiveFileExtensionComparisons);
1235 store.register_late_pass(|| box redundant_slicing::RedundantSlicing);
1237 store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
1238 LintId::of(&arithmetic::FLOAT_ARITHMETIC),
1239 LintId::of(&arithmetic::INTEGER_ARITHMETIC),
1240 LintId::of(&as_conversions::AS_CONVERSIONS),
1241 LintId::of(&asm_syntax::INLINE_ASM_X86_ATT_SYNTAX),
1242 LintId::of(&asm_syntax::INLINE_ASM_X86_INTEL_SYNTAX),
1243 LintId::of(&create_dir::CREATE_DIR),
1244 LintId::of(&dbg_macro::DBG_MACRO),
1245 LintId::of(&else_if_without_else::ELSE_IF_WITHOUT_ELSE),
1246 LintId::of(&exit::EXIT),
1247 LintId::of(&float_literal::LOSSY_FLOAT_LITERAL),
1248 LintId::of(&implicit_return::IMPLICIT_RETURN),
1249 LintId::of(&indexing_slicing::INDEXING_SLICING),
1250 LintId::of(&inherent_impl::MULTIPLE_INHERENT_IMPL),
1251 LintId::of(&integer_division::INTEGER_DIVISION),
1252 LintId::of(&let_underscore::LET_UNDERSCORE_MUST_USE),
1253 LintId::of(&literal_representation::DECIMAL_LITERAL_REPRESENTATION),
1254 LintId::of(&map_err_ignore::MAP_ERR_IGNORE),
1255 LintId::of(&matches::REST_PAT_IN_FULLY_BOUND_STRUCTS),
1256 LintId::of(&matches::WILDCARD_ENUM_MATCH_ARM),
1257 LintId::of(&mem_forget::MEM_FORGET),
1258 LintId::of(&methods::CLONE_ON_REF_PTR),
1259 LintId::of(&methods::EXPECT_USED),
1260 LintId::of(&methods::FILETYPE_IS_FILE),
1261 LintId::of(&methods::GET_UNWRAP),
1262 LintId::of(&methods::UNWRAP_USED),
1263 LintId::of(&methods::WRONG_PUB_SELF_CONVENTION),
1264 LintId::of(&misc::FLOAT_CMP_CONST),
1265 LintId::of(&misc_early::UNNEEDED_FIELD_PATTERN),
1266 LintId::of(&missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS),
1267 LintId::of(&missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS),
1268 LintId::of(&modulo_arithmetic::MODULO_ARITHMETIC),
1269 LintId::of(&panic_in_result_fn::PANIC_IN_RESULT_FN),
1270 LintId::of(&panic_unimplemented::PANIC),
1271 LintId::of(&panic_unimplemented::TODO),
1272 LintId::of(&panic_unimplemented::UNIMPLEMENTED),
1273 LintId::of(&panic_unimplemented::UNREACHABLE),
1274 LintId::of(&pattern_type_mismatch::PATTERN_TYPE_MISMATCH),
1275 LintId::of(&shadow::SHADOW_REUSE),
1276 LintId::of(&shadow::SHADOW_SAME),
1277 LintId::of(&strings::STRING_ADD),
1278 LintId::of(&strings::STRING_TO_STRING),
1279 LintId::of(&strings::STR_TO_STRING),
1280 LintId::of(&types::RC_BUFFER),
1281 LintId::of(&unwrap_in_result::UNWRAP_IN_RESULT),
1282 LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
1283 LintId::of(&write::PRINT_STDERR),
1284 LintId::of(&write::PRINT_STDOUT),
1285 LintId::of(&write::USE_DEBUG),
1288 store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
1289 LintId::of(&attrs::INLINE_ALWAYS),
1290 LintId::of(&await_holding_invalid::AWAIT_HOLDING_LOCK),
1291 LintId::of(&await_holding_invalid::AWAIT_HOLDING_REFCELL_REF),
1292 LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1293 LintId::of(&case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS),
1294 LintId::of(&checked_conversions::CHECKED_CONVERSIONS),
1295 LintId::of(&copies::SAME_FUNCTIONS_IN_IF_CONDITION),
1296 LintId::of(©_iterator::COPY_ITERATOR),
1297 LintId::of(&default::DEFAULT_TRAIT_ACCESS),
1298 LintId::of(&dereference::EXPLICIT_DEREF_METHODS),
1299 LintId::of(&derive::EXPL_IMPL_CLONE_ON_COPY),
1300 LintId::of(&derive::UNSAFE_DERIVE_DESERIALIZE),
1301 LintId::of(&doc::DOC_MARKDOWN),
1302 LintId::of(&doc::MISSING_ERRORS_DOC),
1303 LintId::of(&empty_enum::EMPTY_ENUM),
1304 LintId::of(&enum_variants::MODULE_NAME_REPETITIONS),
1305 LintId::of(&enum_variants::PUB_ENUM_VARIANT_NAMES),
1306 LintId::of(&eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS),
1307 LintId::of(&excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS),
1308 LintId::of(&excessive_bools::STRUCT_EXCESSIVE_BOOLS),
1309 LintId::of(&functions::MUST_USE_CANDIDATE),
1310 LintId::of(&functions::TOO_MANY_LINES),
1311 LintId::of(&if_not_else::IF_NOT_ELSE),
1312 LintId::of(&implicit_saturating_sub::IMPLICIT_SATURATING_SUB),
1313 LintId::of(&infinite_iter::MAYBE_INFINITE_ITER),
1314 LintId::of(&items_after_statements::ITEMS_AFTER_STATEMENTS),
1315 LintId::of(&large_stack_arrays::LARGE_STACK_ARRAYS),
1316 LintId::of(&let_underscore::LET_UNDERSCORE_DROP),
1317 LintId::of(&literal_representation::LARGE_DIGIT_GROUPS),
1318 LintId::of(&literal_representation::UNREADABLE_LITERAL),
1319 LintId::of(&loops::EXPLICIT_INTO_ITER_LOOP),
1320 LintId::of(&loops::EXPLICIT_ITER_LOOP),
1321 LintId::of(¯o_use::MACRO_USE_IMPORTS),
1322 LintId::of(&manual_ok_or::MANUAL_OK_OR),
1323 LintId::of(&match_on_vec_items::MATCH_ON_VEC_ITEMS),
1324 LintId::of(&matches::MATCH_BOOL),
1325 LintId::of(&matches::MATCH_SAME_ARMS),
1326 LintId::of(&matches::MATCH_WILDCARD_FOR_SINGLE_VARIANTS),
1327 LintId::of(&matches::MATCH_WILD_ERR_ARM),
1328 LintId::of(&matches::SINGLE_MATCH_ELSE),
1329 LintId::of(&methods::FILTER_MAP),
1330 LintId::of(&methods::FILTER_MAP_NEXT),
1331 LintId::of(&methods::FIND_MAP),
1332 LintId::of(&methods::INEFFICIENT_TO_STRING),
1333 LintId::of(&methods::MAP_FLATTEN),
1334 LintId::of(&methods::MAP_UNWRAP_OR),
1335 LintId::of(&misc::USED_UNDERSCORE_BINDING),
1336 LintId::of(&misc_early::UNSEPARATED_LITERAL_SUFFIX),
1337 LintId::of(&mut_mut::MUT_MUT),
1338 LintId::of(&needless_continue::NEEDLESS_CONTINUE),
1339 LintId::of(&needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
1340 LintId::of(&non_expressive_names::SIMILAR_NAMES),
1341 LintId::of(&option_if_let_else::OPTION_IF_LET_ELSE),
1342 LintId::of(&pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE),
1343 LintId::of(&pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF),
1344 LintId::of(&ranges::RANGE_MINUS_ONE),
1345 LintId::of(&ranges::RANGE_PLUS_ONE),
1346 LintId::of(&redundant_else::REDUNDANT_ELSE),
1347 LintId::of(&ref_option_ref::REF_OPTION_REF),
1348 LintId::of(&shadow::SHADOW_UNRELATED),
1349 LintId::of(&strings::STRING_ADD_ASSIGN),
1350 LintId::of(&trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),
1351 LintId::of(&trait_bounds::TYPE_REPETITION_IN_BOUNDS),
1352 LintId::of(&types::CAST_LOSSLESS),
1353 LintId::of(&types::CAST_POSSIBLE_TRUNCATION),
1354 LintId::of(&types::CAST_POSSIBLE_WRAP),
1355 LintId::of(&types::CAST_PRECISION_LOSS),
1356 LintId::of(&types::CAST_PTR_ALIGNMENT),
1357 LintId::of(&types::CAST_SIGN_LOSS),
1358 LintId::of(&types::IMPLICIT_HASHER),
1359 LintId::of(&types::INVALID_UPCAST_COMPARISONS),
1360 LintId::of(&types::LET_UNIT_VALUE),
1361 LintId::of(&types::LINKEDLIST),
1362 LintId::of(&types::OPTION_OPTION),
1363 LintId::of(&types::PTR_AS_PTR),
1364 LintId::of(&unicode::NON_ASCII_LITERAL),
1365 LintId::of(&unicode::UNICODE_NOT_NFC),
1366 LintId::of(&unnested_or_patterns::UNNESTED_OR_PATTERNS),
1367 LintId::of(&unused_self::UNUSED_SELF),
1368 LintId::of(&wildcard_imports::ENUM_GLOB_USE),
1369 LintId::of(&wildcard_imports::WILDCARD_IMPORTS),
1370 LintId::of(&zero_sized_map_values::ZERO_SIZED_MAP_VALUES),
1373 #[cfg(feature = "internal-lints")]
1374 store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![
1375 LintId::of(&utils::internal_lints::CLIPPY_LINTS_INTERNAL),
1376 LintId::of(&utils::internal_lints::COLLAPSIBLE_SPAN_LINT_CALLS),
1377 LintId::of(&utils::internal_lints::COMPILER_LINT_FUNCTIONS),
1378 LintId::of(&utils::internal_lints::DEFAULT_LINT),
1379 LintId::of(&utils::internal_lints::INTERNING_DEFINED_SYMBOL),
1380 LintId::of(&utils::internal_lints::INVALID_PATHS),
1381 LintId::of(&utils::internal_lints::LINT_WITHOUT_LINT_PASS),
1382 LintId::of(&utils::internal_lints::MATCH_TYPE_ON_DIAGNOSTIC_ITEM),
1383 LintId::of(&utils::internal_lints::OUTER_EXPN_EXPN_DATA),
1384 LintId::of(&utils::internal_lints::PRODUCE_ICE),
1385 LintId::of(&utils::internal_lints::UNNECESSARY_SYMBOL_STR),
1388 store.register_group(true, "clippy::all", Some("clippy"), vec![
1389 LintId::of(&approx_const::APPROX_CONSTANT),
1390 LintId::of(&assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
1391 LintId::of(&assign_ops::ASSIGN_OP_PATTERN),
1392 LintId::of(&assign_ops::MISREFACTORED_ASSIGN_OP),
1393 LintId::of(&async_yields_async::ASYNC_YIELDS_ASYNC),
1394 LintId::of(&atomic_ordering::INVALID_ATOMIC_ORDERING),
1395 LintId::of(&attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
1396 LintId::of(&attrs::DEPRECATED_CFG_ATTR),
1397 LintId::of(&attrs::DEPRECATED_SEMVER),
1398 LintId::of(&attrs::MISMATCHED_TARGET_OS),
1399 LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
1400 LintId::of(&attrs::USELESS_ATTRIBUTE),
1401 LintId::of(&bit_mask::BAD_BIT_MASK),
1402 LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
1403 LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1404 LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
1405 LintId::of(&booleans::LOGIC_BUG),
1406 LintId::of(&booleans::NONMINIMAL_BOOL),
1407 LintId::of(&bytecount::NAIVE_BYTECOUNT),
1408 LintId::of(&collapsible_if::COLLAPSIBLE_ELSE_IF),
1409 LintId::of(&collapsible_if::COLLAPSIBLE_IF),
1410 LintId::of(&collapsible_match::COLLAPSIBLE_MATCH),
1411 LintId::of(&comparison_chain::COMPARISON_CHAIN),
1412 LintId::of(&copies::IFS_SAME_COND),
1413 LintId::of(&copies::IF_SAME_THEN_ELSE),
1414 LintId::of(&default::FIELD_REASSIGN_WITH_DEFAULT),
1415 LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1416 LintId::of(&derive::DERIVE_ORD_XOR_PARTIAL_ORD),
1417 LintId::of(&doc::MISSING_SAFETY_DOC),
1418 LintId::of(&doc::NEEDLESS_DOCTEST_MAIN),
1419 LintId::of(&double_comparison::DOUBLE_COMPARISONS),
1420 LintId::of(&double_parens::DOUBLE_PARENS),
1421 LintId::of(&drop_forget_ref::DROP_COPY),
1422 LintId::of(&drop_forget_ref::DROP_REF),
1423 LintId::of(&drop_forget_ref::FORGET_COPY),
1424 LintId::of(&drop_forget_ref::FORGET_REF),
1425 LintId::of(&duration_subsec::DURATION_SUBSEC),
1426 LintId::of(&entry::MAP_ENTRY),
1427 LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
1428 LintId::of(&enum_variants::ENUM_VARIANT_NAMES),
1429 LintId::of(&enum_variants::MODULE_INCEPTION),
1430 LintId::of(&eq_op::EQ_OP),
1431 LintId::of(&eq_op::OP_REF),
1432 LintId::of(&erasing_op::ERASING_OP),
1433 LintId::of(&escape::BOXED_LOCAL),
1434 LintId::of(&eta_reduction::REDUNDANT_CLOSURE),
1435 LintId::of(&eval_order_dependence::DIVERGING_SUB_EXPRESSION),
1436 LintId::of(&eval_order_dependence::EVAL_ORDER_DEPENDENCE),
1437 LintId::of(&explicit_write::EXPLICIT_WRITE),
1438 LintId::of(&float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
1439 LintId::of(&float_literal::EXCESSIVE_PRECISION),
1440 LintId::of(&format::USELESS_FORMAT),
1441 LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
1442 LintId::of(&formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1443 LintId::of(&formatting::SUSPICIOUS_ELSE_FORMATTING),
1444 LintId::of(&formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
1445 LintId::of(&from_over_into::FROM_OVER_INTO),
1446 LintId::of(&functions::DOUBLE_MUST_USE),
1447 LintId::of(&functions::MUST_USE_UNIT),
1448 LintId::of(&functions::NOT_UNSAFE_PTR_ARG_DEREF),
1449 LintId::of(&functions::RESULT_UNIT_ERR),
1450 LintId::of(&functions::TOO_MANY_ARGUMENTS),
1451 LintId::of(&get_last_with_len::GET_LAST_WITH_LEN),
1452 LintId::of(&identity_op::IDENTITY_OP),
1453 LintId::of(&if_let_mutex::IF_LET_MUTEX),
1454 LintId::of(&if_let_some_result::IF_LET_SOME_RESULT),
1455 LintId::of(&indexing_slicing::OUT_OF_BOUNDS_INDEXING),
1456 LintId::of(&infinite_iter::INFINITE_ITER),
1457 LintId::of(&inherent_to_string::INHERENT_TO_STRING),
1458 LintId::of(&inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
1459 LintId::of(&inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
1460 LintId::of(&int_plus_one::INT_PLUS_ONE),
1461 LintId::of(&large_const_arrays::LARGE_CONST_ARRAYS),
1462 LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
1463 LintId::of(&len_zero::COMPARISON_TO_EMPTY),
1464 LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
1465 LintId::of(&len_zero::LEN_ZERO),
1466 LintId::of(&let_underscore::LET_UNDERSCORE_LOCK),
1467 LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
1468 LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
1469 LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
1470 LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1471 LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPINGS),
1472 LintId::of(&loops::EMPTY_LOOP),
1473 LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
1474 LintId::of(&loops::FOR_KV_MAP),
1475 LintId::of(&loops::FOR_LOOPS_OVER_FALLIBLES),
1476 LintId::of(&loops::ITER_NEXT_LOOP),
1477 LintId::of(&loops::MANUAL_MEMCPY),
1478 LintId::of(&loops::MUT_RANGE_BOUND),
1479 LintId::of(&loops::NEEDLESS_COLLECT),
1480 LintId::of(&loops::NEEDLESS_RANGE_LOOP),
1481 LintId::of(&loops::NEVER_LOOP),
1482 LintId::of(&loops::SAME_ITEM_PUSH),
1483 LintId::of(&loops::SINGLE_ELEMENT_LOOP),
1484 LintId::of(&loops::WHILE_IMMUTABLE_CONDITION),
1485 LintId::of(&loops::WHILE_LET_LOOP),
1486 LintId::of(&loops::WHILE_LET_ON_ITERATOR),
1487 LintId::of(&main_recursion::MAIN_RECURSION),
1488 LintId::of(&manual_async_fn::MANUAL_ASYNC_FN),
1489 LintId::of(&manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE),
1490 LintId::of(&manual_strip::MANUAL_STRIP),
1491 LintId::of(&manual_unwrap_or::MANUAL_UNWRAP_OR),
1492 LintId::of(&map_clone::MAP_CLONE),
1493 LintId::of(&map_identity::MAP_IDENTITY),
1494 LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
1495 LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
1496 LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
1497 LintId::of(&matches::MATCH_AS_REF),
1498 LintId::of(&matches::MATCH_LIKE_MATCHES_MACRO),
1499 LintId::of(&matches::MATCH_OVERLAPPING_ARM),
1500 LintId::of(&matches::MATCH_REF_PATS),
1501 LintId::of(&matches::MATCH_SINGLE_BINDING),
1502 LintId::of(&matches::REDUNDANT_PATTERN_MATCHING),
1503 LintId::of(&matches::SINGLE_MATCH),
1504 LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
1505 LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
1506 LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
1507 LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
1508 LintId::of(&mem_replace::MEM_REPLACE_WITH_UNINIT),
1509 LintId::of(&methods::BIND_INSTEAD_OF_MAP),
1510 LintId::of(&methods::CHARS_LAST_CMP),
1511 LintId::of(&methods::CHARS_NEXT_CMP),
1512 LintId::of(&methods::CLONE_DOUBLE_REF),
1513 LintId::of(&methods::CLONE_ON_COPY),
1514 LintId::of(&methods::EXPECT_FUN_CALL),
1515 LintId::of(&methods::FILTER_NEXT),
1516 LintId::of(&methods::FLAT_MAP_IDENTITY),
1517 LintId::of(&methods::FROM_ITER_INSTEAD_OF_COLLECT),
1518 LintId::of(&methods::INSPECT_FOR_EACH),
1519 LintId::of(&methods::INTO_ITER_ON_REF),
1520 LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
1521 LintId::of(&methods::ITER_CLONED_COLLECT),
1522 LintId::of(&methods::ITER_NEXT_SLICE),
1523 LintId::of(&methods::ITER_NTH),
1524 LintId::of(&methods::ITER_NTH_ZERO),
1525 LintId::of(&methods::ITER_SKIP_NEXT),
1526 LintId::of(&methods::MANUAL_SATURATING_ARITHMETIC),
1527 LintId::of(&methods::MAP_COLLECT_RESULT_UNIT),
1528 LintId::of(&methods::NEW_RET_NO_SELF),
1529 LintId::of(&methods::OK_EXPECT),
1530 LintId::of(&methods::OPTION_AS_REF_DEREF),
1531 LintId::of(&methods::OPTION_MAP_OR_NONE),
1532 LintId::of(&methods::OR_FUN_CALL),
1533 LintId::of(&methods::RESULT_MAP_OR_INTO_OPTION),
1534 LintId::of(&methods::SEARCH_IS_SOME),
1535 LintId::of(&methods::SHOULD_IMPLEMENT_TRAIT),
1536 LintId::of(&methods::SINGLE_CHAR_ADD_STR),
1537 LintId::of(&methods::SINGLE_CHAR_PATTERN),
1538 LintId::of(&methods::SKIP_WHILE_NEXT),
1539 LintId::of(&methods::STRING_EXTEND_CHARS),
1540 LintId::of(&methods::SUSPICIOUS_MAP),
1541 LintId::of(&methods::UNINIT_ASSUMED_INIT),
1542 LintId::of(&methods::UNNECESSARY_FILTER_MAP),
1543 LintId::of(&methods::UNNECESSARY_FOLD),
1544 LintId::of(&methods::UNNECESSARY_LAZY_EVALUATIONS),
1545 LintId::of(&methods::USELESS_ASREF),
1546 LintId::of(&methods::WRONG_SELF_CONVENTION),
1547 LintId::of(&methods::ZST_OFFSET),
1548 LintId::of(&minmax::MIN_MAX),
1549 LintId::of(&misc::CMP_NAN),
1550 LintId::of(&misc::CMP_OWNED),
1551 LintId::of(&misc::FLOAT_CMP),
1552 LintId::of(&misc::MODULO_ONE),
1553 LintId::of(&misc::SHORT_CIRCUIT_STATEMENT),
1554 LintId::of(&misc::TOPLEVEL_REF_ARG),
1555 LintId::of(&misc::ZERO_PTR),
1556 LintId::of(&misc_early::BUILTIN_TYPE_SHADOW),
1557 LintId::of(&misc_early::DOUBLE_NEG),
1558 LintId::of(&misc_early::DUPLICATE_UNDERSCORE_ARGUMENT),
1559 LintId::of(&misc_early::MIXED_CASE_HEX_LITERALS),
1560 LintId::of(&misc_early::REDUNDANT_PATTERN),
1561 LintId::of(&misc_early::UNNEEDED_WILDCARD_PATTERN),
1562 LintId::of(&misc_early::ZERO_PREFIXED_LITERAL),
1563 LintId::of(&mut_key::MUTABLE_KEY_TYPE),
1564 LintId::of(&mut_mutex_lock::MUT_MUTEX_LOCK),
1565 LintId::of(&mut_reference::UNNECESSARY_MUT_PASSED),
1566 LintId::of(&mutex_atomic::MUTEX_ATOMIC),
1567 LintId::of(&needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE),
1568 LintId::of(&needless_bool::BOOL_COMPARISON),
1569 LintId::of(&needless_bool::NEEDLESS_BOOL),
1570 LintId::of(&needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
1571 LintId::of(&needless_question_mark::NEEDLESS_QUESTION_MARK),
1572 LintId::of(&needless_update::NEEDLESS_UPDATE),
1573 LintId::of(&neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
1574 LintId::of(&neg_multiply::NEG_MULTIPLY),
1575 LintId::of(&new_without_default::NEW_WITHOUT_DEFAULT),
1576 LintId::of(&no_effect::NO_EFFECT),
1577 LintId::of(&no_effect::UNNECESSARY_OPERATION),
1578 LintId::of(&non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
1579 LintId::of(&non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
1580 LintId::of(&non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
1581 LintId::of(&non_expressive_names::MANY_SINGLE_CHAR_NAMES),
1582 LintId::of(&open_options::NONSENSICAL_OPEN_OPTIONS),
1583 LintId::of(&option_env_unwrap::OPTION_ENV_UNWRAP),
1584 LintId::of(&overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL),
1585 LintId::of(&partialeq_ne_impl::PARTIALEQ_NE_IMPL),
1586 LintId::of(&precedence::PRECEDENCE),
1587 LintId::of(&ptr::CMP_NULL),
1588 LintId::of(&ptr::MUT_FROM_REF),
1589 LintId::of(&ptr::PTR_ARG),
1590 LintId::of(&ptr_eq::PTR_EQ),
1591 LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
1592 LintId::of(&question_mark::QUESTION_MARK),
1593 LintId::of(&ranges::MANUAL_RANGE_CONTAINS),
1594 LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
1595 LintId::of(&ranges::REVERSED_EMPTY_RANGES),
1596 LintId::of(&redundant_clone::REDUNDANT_CLONE),
1597 LintId::of(&redundant_closure_call::REDUNDANT_CLOSURE_CALL),
1598 LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
1599 LintId::of(&redundant_slicing::REDUNDANT_SLICING),
1600 LintId::of(&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
1601 LintId::of(&reference::DEREF_ADDROF),
1602 LintId::of(&reference::REF_IN_DEREF),
1603 LintId::of(®ex::INVALID_REGEX),
1604 LintId::of(®ex::TRIVIAL_REGEX),
1605 LintId::of(&repeat_once::REPEAT_ONCE),
1606 LintId::of(&returns::LET_AND_RETURN),
1607 LintId::of(&returns::NEEDLESS_RETURN),
1608 LintId::of(&self_assignment::SELF_ASSIGNMENT),
1609 LintId::of(&serde_api::SERDE_API_MISUSE),
1610 LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
1611 LintId::of(&size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
1612 LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
1613 LintId::of(&stable_sort_primitive::STABLE_SORT_PRIMITIVE),
1614 LintId::of(&strings::STRING_FROM_UTF8_AS_BYTES),
1615 LintId::of(&suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS),
1616 LintId::of(&suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1617 LintId::of(&suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1618 LintId::of(&swap::ALMOST_SWAPPED),
1619 LintId::of(&swap::MANUAL_SWAP),
1620 LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
1621 LintId::of(&temporary_assignment::TEMPORARY_ASSIGNMENT),
1622 LintId::of(&to_digit_is_some::TO_DIGIT_IS_SOME),
1623 LintId::of(&to_string_in_display::TO_STRING_IN_DISPLAY),
1624 LintId::of(&transmute::CROSSPOINTER_TRANSMUTE),
1625 LintId::of(&transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS),
1626 LintId::of(&transmute::TRANSMUTE_BYTES_TO_STR),
1627 LintId::of(&transmute::TRANSMUTE_FLOAT_TO_INT),
1628 LintId::of(&transmute::TRANSMUTE_INT_TO_BOOL),
1629 LintId::of(&transmute::TRANSMUTE_INT_TO_CHAR),
1630 LintId::of(&transmute::TRANSMUTE_INT_TO_FLOAT),
1631 LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
1632 LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
1633 LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
1634 LintId::of(&transmute::WRONG_TRANSMUTE),
1635 LintId::of(&transmuting_null::TRANSMUTING_NULL),
1636 LintId::of(&try_err::TRY_ERR),
1637 LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
1638 LintId::of(&types::BORROWED_BOX),
1639 LintId::of(&types::BOX_VEC),
1640 LintId::of(&types::CAST_REF_TO_MUT),
1641 LintId::of(&types::CHAR_LIT_AS_U8),
1642 LintId::of(&types::FN_TO_NUMERIC_CAST),
1643 LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
1644 LintId::of(&types::REDUNDANT_ALLOCATION),
1645 LintId::of(&types::TYPE_COMPLEXITY),
1646 LintId::of(&types::UNIT_ARG),
1647 LintId::of(&types::UNIT_CMP),
1648 LintId::of(&types::UNNECESSARY_CAST),
1649 LintId::of(&types::VEC_BOX),
1650 LintId::of(&undropped_manually_drops::UNDROPPED_MANUALLY_DROPS),
1651 LintId::of(&unicode::INVISIBLE_CHARACTERS),
1652 LintId::of(&unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
1653 LintId::of(&unnamed_address::FN_ADDRESS_COMPARISONS),
1654 LintId::of(&unnamed_address::VTABLE_ADDRESS_COMPARISONS),
1655 LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
1656 LintId::of(&unnecessary_wraps::UNNECESSARY_WRAPS),
1657 LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
1658 LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
1659 LintId::of(&unused_unit::UNUSED_UNIT),
1660 LintId::of(&unwrap::PANICKING_UNWRAP),
1661 LintId::of(&unwrap::UNNECESSARY_UNWRAP),
1662 LintId::of(&useless_conversion::USELESS_CONVERSION),
1663 LintId::of(&vec::USELESS_VEC),
1664 LintId::of(&vec_init_then_push::VEC_INIT_THEN_PUSH),
1665 LintId::of(&vec_resize_to_zero::VEC_RESIZE_TO_ZERO),
1666 LintId::of(&write::PRINTLN_EMPTY_STRING),
1667 LintId::of(&write::PRINT_LITERAL),
1668 LintId::of(&write::PRINT_WITH_NEWLINE),
1669 LintId::of(&write::WRITELN_EMPTY_STRING),
1670 LintId::of(&write::WRITE_LITERAL),
1671 LintId::of(&write::WRITE_WITH_NEWLINE),
1672 LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
1675 store.register_group(true, "clippy::style", Some("clippy_style"), vec![
1676 LintId::of(&assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
1677 LintId::of(&assign_ops::ASSIGN_OP_PATTERN),
1678 LintId::of(&attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
1679 LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
1680 LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1681 LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
1682 LintId::of(&collapsible_if::COLLAPSIBLE_ELSE_IF),
1683 LintId::of(&collapsible_if::COLLAPSIBLE_IF),
1684 LintId::of(&collapsible_match::COLLAPSIBLE_MATCH),
1685 LintId::of(&comparison_chain::COMPARISON_CHAIN),
1686 LintId::of(&default::FIELD_REASSIGN_WITH_DEFAULT),
1687 LintId::of(&doc::MISSING_SAFETY_DOC),
1688 LintId::of(&doc::NEEDLESS_DOCTEST_MAIN),
1689 LintId::of(&enum_variants::ENUM_VARIANT_NAMES),
1690 LintId::of(&enum_variants::MODULE_INCEPTION),
1691 LintId::of(&eq_op::OP_REF),
1692 LintId::of(&eta_reduction::REDUNDANT_CLOSURE),
1693 LintId::of(&float_literal::EXCESSIVE_PRECISION),
1694 LintId::of(&formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1695 LintId::of(&formatting::SUSPICIOUS_ELSE_FORMATTING),
1696 LintId::of(&formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
1697 LintId::of(&from_over_into::FROM_OVER_INTO),
1698 LintId::of(&functions::DOUBLE_MUST_USE),
1699 LintId::of(&functions::MUST_USE_UNIT),
1700 LintId::of(&functions::RESULT_UNIT_ERR),
1701 LintId::of(&if_let_some_result::IF_LET_SOME_RESULT),
1702 LintId::of(&inherent_to_string::INHERENT_TO_STRING),
1703 LintId::of(&len_zero::COMPARISON_TO_EMPTY),
1704 LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
1705 LintId::of(&len_zero::LEN_ZERO),
1706 LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
1707 LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPINGS),
1708 LintId::of(&loops::EMPTY_LOOP),
1709 LintId::of(&loops::FOR_KV_MAP),
1710 LintId::of(&loops::NEEDLESS_RANGE_LOOP),
1711 LintId::of(&loops::SAME_ITEM_PUSH),
1712 LintId::of(&loops::WHILE_LET_ON_ITERATOR),
1713 LintId::of(&main_recursion::MAIN_RECURSION),
1714 LintId::of(&manual_async_fn::MANUAL_ASYNC_FN),
1715 LintId::of(&manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE),
1716 LintId::of(&map_clone::MAP_CLONE),
1717 LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
1718 LintId::of(&matches::MATCH_LIKE_MATCHES_MACRO),
1719 LintId::of(&matches::MATCH_OVERLAPPING_ARM),
1720 LintId::of(&matches::MATCH_REF_PATS),
1721 LintId::of(&matches::REDUNDANT_PATTERN_MATCHING),
1722 LintId::of(&matches::SINGLE_MATCH),
1723 LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
1724 LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
1725 LintId::of(&methods::CHARS_LAST_CMP),
1726 LintId::of(&methods::CHARS_NEXT_CMP),
1727 LintId::of(&methods::FROM_ITER_INSTEAD_OF_COLLECT),
1728 LintId::of(&methods::INTO_ITER_ON_REF),
1729 LintId::of(&methods::ITER_CLONED_COLLECT),
1730 LintId::of(&methods::ITER_NEXT_SLICE),
1731 LintId::of(&methods::ITER_NTH_ZERO),
1732 LintId::of(&methods::ITER_SKIP_NEXT),
1733 LintId::of(&methods::MANUAL_SATURATING_ARITHMETIC),
1734 LintId::of(&methods::MAP_COLLECT_RESULT_UNIT),
1735 LintId::of(&methods::NEW_RET_NO_SELF),
1736 LintId::of(&methods::OK_EXPECT),
1737 LintId::of(&methods::OPTION_MAP_OR_NONE),
1738 LintId::of(&methods::RESULT_MAP_OR_INTO_OPTION),
1739 LintId::of(&methods::SHOULD_IMPLEMENT_TRAIT),
1740 LintId::of(&methods::SINGLE_CHAR_ADD_STR),
1741 LintId::of(&methods::STRING_EXTEND_CHARS),
1742 LintId::of(&methods::UNNECESSARY_FOLD),
1743 LintId::of(&methods::UNNECESSARY_LAZY_EVALUATIONS),
1744 LintId::of(&methods::WRONG_SELF_CONVENTION),
1745 LintId::of(&misc::TOPLEVEL_REF_ARG),
1746 LintId::of(&misc::ZERO_PTR),
1747 LintId::of(&misc_early::BUILTIN_TYPE_SHADOW),
1748 LintId::of(&misc_early::DOUBLE_NEG),
1749 LintId::of(&misc_early::DUPLICATE_UNDERSCORE_ARGUMENT),
1750 LintId::of(&misc_early::MIXED_CASE_HEX_LITERALS),
1751 LintId::of(&misc_early::REDUNDANT_PATTERN),
1752 LintId::of(&mut_mutex_lock::MUT_MUTEX_LOCK),
1753 LintId::of(&mut_reference::UNNECESSARY_MUT_PASSED),
1754 LintId::of(&neg_multiply::NEG_MULTIPLY),
1755 LintId::of(&new_without_default::NEW_WITHOUT_DEFAULT),
1756 LintId::of(&non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
1757 LintId::of(&non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
1758 LintId::of(&non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
1759 LintId::of(&non_expressive_names::MANY_SINGLE_CHAR_NAMES),
1760 LintId::of(&ptr::CMP_NULL),
1761 LintId::of(&ptr::PTR_ARG),
1762 LintId::of(&ptr_eq::PTR_EQ),
1763 LintId::of(&question_mark::QUESTION_MARK),
1764 LintId::of(&ranges::MANUAL_RANGE_CONTAINS),
1765 LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
1766 LintId::of(&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
1767 LintId::of(®ex::TRIVIAL_REGEX),
1768 LintId::of(&returns::LET_AND_RETURN),
1769 LintId::of(&returns::NEEDLESS_RETURN),
1770 LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
1771 LintId::of(&suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS),
1772 LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
1773 LintId::of(&to_digit_is_some::TO_DIGIT_IS_SOME),
1774 LintId::of(&try_err::TRY_ERR),
1775 LintId::of(&types::FN_TO_NUMERIC_CAST),
1776 LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
1777 LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
1778 LintId::of(&unused_unit::UNUSED_UNIT),
1779 LintId::of(&write::PRINTLN_EMPTY_STRING),
1780 LintId::of(&write::PRINT_LITERAL),
1781 LintId::of(&write::PRINT_WITH_NEWLINE),
1782 LintId::of(&write::WRITELN_EMPTY_STRING),
1783 LintId::of(&write::WRITE_LITERAL),
1784 LintId::of(&write::WRITE_WITH_NEWLINE),
1787 store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![
1788 LintId::of(&assign_ops::MISREFACTORED_ASSIGN_OP),
1789 LintId::of(&attrs::DEPRECATED_CFG_ATTR),
1790 LintId::of(&booleans::NONMINIMAL_BOOL),
1791 LintId::of(&double_comparison::DOUBLE_COMPARISONS),
1792 LintId::of(&double_parens::DOUBLE_PARENS),
1793 LintId::of(&duration_subsec::DURATION_SUBSEC),
1794 LintId::of(&eval_order_dependence::DIVERGING_SUB_EXPRESSION),
1795 LintId::of(&eval_order_dependence::EVAL_ORDER_DEPENDENCE),
1796 LintId::of(&explicit_write::EXPLICIT_WRITE),
1797 LintId::of(&format::USELESS_FORMAT),
1798 LintId::of(&functions::TOO_MANY_ARGUMENTS),
1799 LintId::of(&get_last_with_len::GET_LAST_WITH_LEN),
1800 LintId::of(&identity_op::IDENTITY_OP),
1801 LintId::of(&int_plus_one::INT_PLUS_ONE),
1802 LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
1803 LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
1804 LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
1805 LintId::of(&loops::MUT_RANGE_BOUND),
1806 LintId::of(&loops::SINGLE_ELEMENT_LOOP),
1807 LintId::of(&loops::WHILE_LET_LOOP),
1808 LintId::of(&manual_strip::MANUAL_STRIP),
1809 LintId::of(&manual_unwrap_or::MANUAL_UNWRAP_OR),
1810 LintId::of(&map_identity::MAP_IDENTITY),
1811 LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
1812 LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
1813 LintId::of(&matches::MATCH_AS_REF),
1814 LintId::of(&matches::MATCH_SINGLE_BINDING),
1815 LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
1816 LintId::of(&methods::BIND_INSTEAD_OF_MAP),
1817 LintId::of(&methods::CLONE_ON_COPY),
1818 LintId::of(&methods::FILTER_NEXT),
1819 LintId::of(&methods::FLAT_MAP_IDENTITY),
1820 LintId::of(&methods::INSPECT_FOR_EACH),
1821 LintId::of(&methods::OPTION_AS_REF_DEREF),
1822 LintId::of(&methods::SEARCH_IS_SOME),
1823 LintId::of(&methods::SKIP_WHILE_NEXT),
1824 LintId::of(&methods::SUSPICIOUS_MAP),
1825 LintId::of(&methods::UNNECESSARY_FILTER_MAP),
1826 LintId::of(&methods::USELESS_ASREF),
1827 LintId::of(&misc::SHORT_CIRCUIT_STATEMENT),
1828 LintId::of(&misc_early::UNNEEDED_WILDCARD_PATTERN),
1829 LintId::of(&misc_early::ZERO_PREFIXED_LITERAL),
1830 LintId::of(&needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE),
1831 LintId::of(&needless_bool::BOOL_COMPARISON),
1832 LintId::of(&needless_bool::NEEDLESS_BOOL),
1833 LintId::of(&needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
1834 LintId::of(&needless_question_mark::NEEDLESS_QUESTION_MARK),
1835 LintId::of(&needless_update::NEEDLESS_UPDATE),
1836 LintId::of(&neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
1837 LintId::of(&no_effect::NO_EFFECT),
1838 LintId::of(&no_effect::UNNECESSARY_OPERATION),
1839 LintId::of(&overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL),
1840 LintId::of(&partialeq_ne_impl::PARTIALEQ_NE_IMPL),
1841 LintId::of(&precedence::PRECEDENCE),
1842 LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
1843 LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
1844 LintId::of(&redundant_closure_call::REDUNDANT_CLOSURE_CALL),
1845 LintId::of(&redundant_slicing::REDUNDANT_SLICING),
1846 LintId::of(&reference::DEREF_ADDROF),
1847 LintId::of(&reference::REF_IN_DEREF),
1848 LintId::of(&repeat_once::REPEAT_ONCE),
1849 LintId::of(&strings::STRING_FROM_UTF8_AS_BYTES),
1850 LintId::of(&swap::MANUAL_SWAP),
1851 LintId::of(&temporary_assignment::TEMPORARY_ASSIGNMENT),
1852 LintId::of(&transmute::CROSSPOINTER_TRANSMUTE),
1853 LintId::of(&transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS),
1854 LintId::of(&transmute::TRANSMUTE_BYTES_TO_STR),
1855 LintId::of(&transmute::TRANSMUTE_FLOAT_TO_INT),
1856 LintId::of(&transmute::TRANSMUTE_INT_TO_BOOL),
1857 LintId::of(&transmute::TRANSMUTE_INT_TO_CHAR),
1858 LintId::of(&transmute::TRANSMUTE_INT_TO_FLOAT),
1859 LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
1860 LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
1861 LintId::of(&types::BORROWED_BOX),
1862 LintId::of(&types::CHAR_LIT_AS_U8),
1863 LintId::of(&types::TYPE_COMPLEXITY),
1864 LintId::of(&types::UNIT_ARG),
1865 LintId::of(&types::UNNECESSARY_CAST),
1866 LintId::of(&types::VEC_BOX),
1867 LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
1868 LintId::of(&unnecessary_wraps::UNNECESSARY_WRAPS),
1869 LintId::of(&unwrap::UNNECESSARY_UNWRAP),
1870 LintId::of(&useless_conversion::USELESS_CONVERSION),
1871 LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
1874 store.register_group(true, "clippy::correctness", Some("clippy_correctness"), vec![
1875 LintId::of(&approx_const::APPROX_CONSTANT),
1876 LintId::of(&async_yields_async::ASYNC_YIELDS_ASYNC),
1877 LintId::of(&atomic_ordering::INVALID_ATOMIC_ORDERING),
1878 LintId::of(&attrs::DEPRECATED_SEMVER),
1879 LintId::of(&attrs::MISMATCHED_TARGET_OS),
1880 LintId::of(&attrs::USELESS_ATTRIBUTE),
1881 LintId::of(&bit_mask::BAD_BIT_MASK),
1882 LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
1883 LintId::of(&booleans::LOGIC_BUG),
1884 LintId::of(&copies::IFS_SAME_COND),
1885 LintId::of(&copies::IF_SAME_THEN_ELSE),
1886 LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1887 LintId::of(&derive::DERIVE_ORD_XOR_PARTIAL_ORD),
1888 LintId::of(&drop_forget_ref::DROP_COPY),
1889 LintId::of(&drop_forget_ref::DROP_REF),
1890 LintId::of(&drop_forget_ref::FORGET_COPY),
1891 LintId::of(&drop_forget_ref::FORGET_REF),
1892 LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
1893 LintId::of(&eq_op::EQ_OP),
1894 LintId::of(&erasing_op::ERASING_OP),
1895 LintId::of(&float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
1896 LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
1897 LintId::of(&functions::NOT_UNSAFE_PTR_ARG_DEREF),
1898 LintId::of(&if_let_mutex::IF_LET_MUTEX),
1899 LintId::of(&indexing_slicing::OUT_OF_BOUNDS_INDEXING),
1900 LintId::of(&infinite_iter::INFINITE_ITER),
1901 LintId::of(&inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
1902 LintId::of(&inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
1903 LintId::of(&let_underscore::LET_UNDERSCORE_LOCK),
1904 LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1905 LintId::of(&loops::FOR_LOOPS_OVER_FALLIBLES),
1906 LintId::of(&loops::ITER_NEXT_LOOP),
1907 LintId::of(&loops::NEVER_LOOP),
1908 LintId::of(&loops::WHILE_IMMUTABLE_CONDITION),
1909 LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
1910 LintId::of(&mem_replace::MEM_REPLACE_WITH_UNINIT),
1911 LintId::of(&methods::CLONE_DOUBLE_REF),
1912 LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
1913 LintId::of(&methods::UNINIT_ASSUMED_INIT),
1914 LintId::of(&methods::ZST_OFFSET),
1915 LintId::of(&minmax::MIN_MAX),
1916 LintId::of(&misc::CMP_NAN),
1917 LintId::of(&misc::FLOAT_CMP),
1918 LintId::of(&misc::MODULO_ONE),
1919 LintId::of(&mut_key::MUTABLE_KEY_TYPE),
1920 LintId::of(&open_options::NONSENSICAL_OPEN_OPTIONS),
1921 LintId::of(&option_env_unwrap::OPTION_ENV_UNWRAP),
1922 LintId::of(&ptr::MUT_FROM_REF),
1923 LintId::of(&ranges::REVERSED_EMPTY_RANGES),
1924 LintId::of(®ex::INVALID_REGEX),
1925 LintId::of(&self_assignment::SELF_ASSIGNMENT),
1926 LintId::of(&serde_api::SERDE_API_MISUSE),
1927 LintId::of(&size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
1928 LintId::of(&suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1929 LintId::of(&suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1930 LintId::of(&swap::ALMOST_SWAPPED),
1931 LintId::of(&to_string_in_display::TO_STRING_IN_DISPLAY),
1932 LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
1933 LintId::of(&transmute::WRONG_TRANSMUTE),
1934 LintId::of(&transmuting_null::TRANSMUTING_NULL),
1935 LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
1936 LintId::of(&types::CAST_REF_TO_MUT),
1937 LintId::of(&types::UNIT_CMP),
1938 LintId::of(&undropped_manually_drops::UNDROPPED_MANUALLY_DROPS),
1939 LintId::of(&unicode::INVISIBLE_CHARACTERS),
1940 LintId::of(&unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
1941 LintId::of(&unnamed_address::FN_ADDRESS_COMPARISONS),
1942 LintId::of(&unnamed_address::VTABLE_ADDRESS_COMPARISONS),
1943 LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
1944 LintId::of(&unwrap::PANICKING_UNWRAP),
1945 LintId::of(&vec_resize_to_zero::VEC_RESIZE_TO_ZERO),
1948 store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
1949 LintId::of(&bytecount::NAIVE_BYTECOUNT),
1950 LintId::of(&entry::MAP_ENTRY),
1951 LintId::of(&escape::BOXED_LOCAL),
1952 LintId::of(&large_const_arrays::LARGE_CONST_ARRAYS),
1953 LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
1954 LintId::of(&loops::MANUAL_MEMCPY),
1955 LintId::of(&loops::NEEDLESS_COLLECT),
1956 LintId::of(&methods::EXPECT_FUN_CALL),
1957 LintId::of(&methods::ITER_NTH),
1958 LintId::of(&methods::OR_FUN_CALL),
1959 LintId::of(&methods::SINGLE_CHAR_PATTERN),
1960 LintId::of(&misc::CMP_OWNED),
1961 LintId::of(&mutex_atomic::MUTEX_ATOMIC),
1962 LintId::of(&redundant_clone::REDUNDANT_CLONE),
1963 LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
1964 LintId::of(&stable_sort_primitive::STABLE_SORT_PRIMITIVE),
1965 LintId::of(&types::BOX_VEC),
1966 LintId::of(&types::REDUNDANT_ALLOCATION),
1967 LintId::of(&vec::USELESS_VEC),
1968 LintId::of(&vec_init_then_push::VEC_INIT_THEN_PUSH),
1971 store.register_group(true, "clippy::cargo", Some("clippy_cargo"), vec![
1972 LintId::of(&cargo_common_metadata::CARGO_COMMON_METADATA),
1973 LintId::of(&multiple_crate_versions::MULTIPLE_CRATE_VERSIONS),
1974 LintId::of(&wildcard_dependencies::WILDCARD_DEPENDENCIES),
1977 store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
1978 LintId::of(&attrs::EMPTY_LINE_AFTER_OUTER_ATTR),
1979 LintId::of(&cognitive_complexity::COGNITIVE_COMPLEXITY),
1980 LintId::of(&disallowed_method::DISALLOWED_METHOD),
1981 LintId::of(&fallible_impl_from::FALLIBLE_IMPL_FROM),
1982 LintId::of(&floating_point_arithmetic::IMPRECISE_FLOPS),
1983 LintId::of(&floating_point_arithmetic::SUBOPTIMAL_FLOPS),
1984 LintId::of(&future_not_send::FUTURE_NOT_SEND),
1985 LintId::of(&let_if_seq::USELESS_LET_IF_SEQ),
1986 LintId::of(&missing_const_for_fn::MISSING_CONST_FOR_FN),
1987 LintId::of(&mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
1988 LintId::of(&mutex_atomic::MUTEX_INTEGER),
1989 LintId::of(&needless_borrow::NEEDLESS_BORROW),
1990 LintId::of(&path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),
1991 LintId::of(&redundant_pub_crate::REDUNDANT_PUB_CRATE),
1992 LintId::of(&strings::STRING_LIT_AS_BYTES),
1993 LintId::of(&transmute::USELESS_TRANSMUTE),
1994 LintId::of(&use_self::USE_SELF),
1999 fn register_removed_non_tool_lints(store: &mut rustc_lint::LintStore) {
2000 store.register_removed(
2002 "`assert!()` will be more flexible with RFC 2011",
2004 store.register_removed(
2005 "extend_from_slice",
2006 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
2008 store.register_removed(
2009 "range_step_by_zero",
2010 "`iterator.step_by(0)` panics nowadays",
2012 store.register_removed(
2013 "unstable_as_slice",
2014 "`Vec::as_slice` has been stabilized in 1.7",
2016 store.register_removed(
2017 "unstable_as_mut_slice",
2018 "`Vec::as_mut_slice` has been stabilized in 1.7",
2020 store.register_removed(
2021 "misaligned_transmute",
2022 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
2024 store.register_removed(
2026 "using compound assignment operators (e.g., `+=`) is harmless",
2028 store.register_removed(
2029 "if_let_redundant_pattern_matching",
2030 "this lint has been changed to redundant_pattern_matching",
2032 store.register_removed(
2033 "unsafe_vector_initialization",
2034 "the replacement suggested by this lint had substantially different behavior",
2036 store.register_removed(
2037 "reverse_range_loop",
2038 "this lint is now included in reversed_empty_ranges",
2042 /// Register renamed lints.
2044 /// Used in `./src/driver.rs`.
2045 pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
2046 ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
2047 ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
2048 ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
2049 ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
2050 ls.register_renamed("clippy::option_and_then_some", "clippy::bind_instead_of_map");
2051 ls.register_renamed("clippy::block_in_if_condition_expr", "clippy::blocks_in_if_conditions");
2052 ls.register_renamed("clippy::block_in_if_condition_stmt", "clippy::blocks_in_if_conditions");
2053 ls.register_renamed("clippy::option_map_unwrap_or", "clippy::map_unwrap_or");
2054 ls.register_renamed("clippy::option_map_unwrap_or_else", "clippy::map_unwrap_or");
2055 ls.register_renamed("clippy::result_map_unwrap_or_else", "clippy::map_unwrap_or");
2056 ls.register_renamed("clippy::option_unwrap_used", "clippy::unwrap_used");
2057 ls.register_renamed("clippy::result_unwrap_used", "clippy::unwrap_used");
2058 ls.register_renamed("clippy::option_expect_used", "clippy::expect_used");
2059 ls.register_renamed("clippy::result_expect_used", "clippy::expect_used");
2060 ls.register_renamed("clippy::for_loop_over_option", "clippy::for_loops_over_fallibles");
2061 ls.register_renamed("clippy::for_loop_over_result", "clippy::for_loops_over_fallibles");
2062 ls.register_renamed("clippy::identity_conversion", "clippy::useless_conversion");
2063 ls.register_renamed("clippy::zero_width_space", "clippy::invisible_characters");
2064 ls.register_renamed("clippy::single_char_push_str", "clippy::single_char_add_str");
2067 // only exists to let the dogfood integration test works.
2068 // Don't run clippy as an executable directly
2071 panic!("Please use the cargo-clippy executable");