1 // error-pattern:cargo-clippy
3 #![feature(box_syntax)]
4 #![feature(box_patterns)]
5 #![feature(or_patterns)]
6 #![feature(rustc_private)]
7 #![feature(stmt_expr_attributes)]
8 #![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
9 #![recursion_limit = "512"]
10 #![warn(rust_2018_idioms, trivial_casts, trivial_numeric_casts)]
11 #![deny(rustc::internal)]
12 #![cfg_attr(feature = "deny-warnings", deny(warnings))]
13 #![feature(crate_visibility_modifier)]
14 #![feature(concat_idents)]
16 // FIXME: switch to something more ergonomic here, once available.
17 // (Currently there is no way to opt into sysroot crates without `extern crate`.)
18 #[allow(unused_extern_crates)]
19 extern crate fmt_macros;
20 #[allow(unused_extern_crates)]
22 #[allow(unused_extern_crates)]
23 extern crate rustc_ast;
24 #[allow(unused_extern_crates)]
25 extern crate rustc_ast_pretty;
26 #[allow(unused_extern_crates)]
27 extern crate rustc_attr;
28 #[allow(unused_extern_crates)]
29 extern crate rustc_data_structures;
30 #[allow(unused_extern_crates)]
31 extern crate rustc_driver;
32 #[allow(unused_extern_crates)]
33 extern crate rustc_errors;
34 #[allow(unused_extern_crates)]
35 extern crate rustc_hir;
36 #[allow(unused_extern_crates)]
37 extern crate rustc_index;
38 #[allow(unused_extern_crates)]
39 extern crate rustc_infer;
40 #[allow(unused_extern_crates)]
41 extern crate rustc_lexer;
42 #[allow(unused_extern_crates)]
43 extern crate rustc_lint;
44 #[allow(unused_extern_crates)]
45 extern crate rustc_mir;
46 #[allow(unused_extern_crates)]
47 extern crate rustc_parse;
48 #[allow(unused_extern_crates)]
49 extern crate rustc_session;
50 #[allow(unused_extern_crates)]
51 extern crate rustc_span;
52 #[allow(unused_extern_crates)]
53 extern crate rustc_target;
54 #[allow(unused_extern_crates)]
55 extern crate rustc_trait_selection;
56 #[allow(unused_extern_crates)]
57 extern crate rustc_typeck;
59 use rustc_data_structures::fx::FxHashSet;
60 use rustc_lint::LintId;
61 use rustc_session::Session;
63 /// Macro used to declare a Clippy lint.
65 /// Every lint declaration consists of 4 parts:
67 /// 1. The documentation, which is used for the website
68 /// 2. The `LINT_NAME`. See [lint naming][lint_naming] on lint naming conventions.
69 /// 3. The `lint_level`, which is a mapping from *one* of our lint groups to `Allow`, `Warn` or
70 /// `Deny`. The lint level here has nothing to do with what lint groups the lint is a part of.
71 /// 4. The `description` that contains a short explanation on what's wrong with code where the
72 /// lint is triggered.
74 /// Currently the categories `style`, `correctness`, `complexity` and `perf` are enabled by default.
75 /// As said in the README.md of this repository, if the lint level mapping changes, please update
81 /// # #![feature(rustc_private)]
82 /// # #[allow(unused_extern_crates)]
83 /// # extern crate rustc;
84 /// # #[allow(unused_extern_crates)]
85 /// # extern crate rustc_session;
87 /// # use clippy_lints::declare_clippy_lint;
88 /// use rustc_session::declare_tool_lint;
90 /// declare_clippy_lint! {
91 /// /// **What it does:** Checks for ... (describe what the lint matches).
93 /// /// **Why is this bad?** Supply the reason for linting the code.
95 /// /// **Known problems:** None. (Or describe where it could go wrong.)
101 /// /// Insert a short example of code that triggers the lint
104 /// /// Insert a short example of improved code that doesn't trigger the lint
111 /// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
113 macro_rules! declare_clippy_lint {
114 { $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
116 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
119 { $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
121 $(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
124 { $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
126 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
129 { $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
131 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
134 { $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
136 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
139 { $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
141 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
144 { $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
146 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
149 { $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
151 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
154 { $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
156 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
159 { $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
161 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
170 // begin lints modules, do not remove this comment, it’s used in `update_lints`
171 pub mod approx_const;
173 pub mod as_conversions;
174 pub mod assertions_on_constants;
176 pub mod atomic_ordering;
179 pub mod blacklisted_name;
180 pub mod block_in_if_condition;
183 pub mod cargo_common_metadata;
184 pub mod checked_conversions;
185 pub mod cognitive_complexity;
186 pub mod collapsible_if;
187 pub mod comparison_chain;
189 pub mod copy_iterator;
191 pub mod default_trait_access;
194 pub mod double_comparison;
195 pub mod double_parens;
197 pub mod drop_forget_ref;
198 pub mod duration_subsec;
199 pub mod else_if_without_else;
203 pub mod enum_variants;
207 pub mod eta_reduction;
208 pub mod eval_order_dependence;
209 pub mod excessive_bools;
211 pub mod explicit_write;
212 pub mod fallible_impl_from;
213 pub mod float_literal;
214 pub mod floating_point_arithmetic;
218 pub mod get_last_with_len;
219 pub mod identity_conversion;
221 pub mod if_let_some_result;
223 pub mod implicit_return;
224 pub mod indexing_slicing;
225 pub mod infinite_iter;
226 pub mod inherent_impl;
227 pub mod inherent_to_string;
228 pub mod inline_fn_without_body;
229 pub mod int_plus_one;
230 pub mod integer_division;
231 pub mod items_after_statements;
232 pub mod large_enum_variant;
233 pub mod large_stack_arrays;
236 pub mod let_underscore;
238 pub mod literal_representation;
241 pub mod main_recursion;
245 pub mod mem_discriminant;
252 pub mod missing_const_for_fn;
254 pub mod missing_inline;
255 pub mod modulo_arithmetic;
256 pub mod multiple_crate_versions;
259 pub mod mut_reference;
260 pub mod mutable_debug_assertion;
261 pub mod mutex_atomic;
262 pub mod needless_bool;
263 pub mod needless_borrow;
264 pub mod needless_borrowed_ref;
265 pub mod needless_continue;
266 pub mod needless_pass_by_value;
267 pub mod needless_update;
268 pub mod neg_cmp_op_on_partial_ord;
269 pub mod neg_multiply;
270 pub mod new_without_default;
272 pub mod non_copy_const;
273 pub mod non_expressive_names;
274 pub mod open_options;
275 pub mod option_env_unwrap;
276 pub mod overflow_check_conditional;
277 pub mod panic_unimplemented;
278 pub mod partialeq_ne_impl;
279 pub mod path_buf_push_overwrite;
282 pub mod ptr_offset_with_cast;
283 pub mod question_mark;
285 pub mod redundant_clone;
286 pub mod redundant_field_names;
287 pub mod redundant_pattern_matching;
288 pub mod redundant_static_lifetimes;
291 pub mod replace_consts;
295 pub mod single_component_path_imports;
296 pub mod slow_vector_initialization;
298 pub mod suspicious_trait_impl;
300 pub mod tabs_in_doc_comments;
301 pub mod temporary_assignment;
302 pub mod to_digit_is_some;
303 pub mod trait_bounds;
305 pub mod transmuting_null;
306 pub mod trivially_copy_pass_by_ref;
310 pub mod unsafe_removed_from_name;
311 pub mod unused_io_amount;
316 pub mod verbose_file_reads;
317 pub mod wildcard_dependencies;
318 pub mod wildcard_imports;
320 pub mod zero_div_zero;
321 // end lints modules, do not remove this comment, it’s used in `update_lints`
323 pub use crate::utils::conf::Conf;
326 crate use rustc_ast::ast::Name;
329 /// Register all pre expansion lints
331 /// Pre-expansion lints run before any macro expansion has happened.
333 /// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
334 /// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
336 /// Used in `./src/driver.rs`.
337 pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore, conf: &Conf) {
338 store.register_pre_expansion_pass(|| box write::Write::default());
339 store.register_pre_expansion_pass(|| box redundant_field_names::RedundantFieldNames);
340 let single_char_binding_names_threshold = conf.single_char_binding_names_threshold;
341 store.register_pre_expansion_pass(move || box non_expressive_names::NonExpressiveNames {
342 single_char_binding_names_threshold,
344 store.register_pre_expansion_pass(|| box attrs::DeprecatedCfgAttribute);
345 store.register_pre_expansion_pass(|| box dbg_macro::DbgMacro);
349 pub fn read_conf(args: &[rustc_ast::ast::NestedMetaItem], sess: &Session) -> Conf {
351 match utils::conf::file_from_args(args) {
353 // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
354 // do not require the file to exist
355 let file_name = match file_name {
356 Some(file_name) => file_name,
357 None => match utils::conf::lookup_conf_file() {
358 Ok(Some(path)) => path,
359 Ok(None) => return Conf::default(),
361 sess.struct_err(&format!("error finding Clippy's configuration file: {}", error))
363 return Conf::default();
368 let file_name = if file_name.is_relative() {
369 sess.local_crate_source_file
371 .and_then(Path::parent)
372 .unwrap_or_else(|| Path::new(""))
378 let (conf, errors) = utils::conf::read(&file_name);
380 // all conf errors are non-fatal, we just use the default conf in case of error
381 for error in errors {
382 sess.struct_err(&format!(
383 "error reading Clippy's configuration file `{}`: {}",
392 Err((err, span)) => {
393 sess.struct_span_err(span, err)
394 .span_note(span, "Clippy will use default configuration")
401 /// Register all lints and lint groups with the rustc plugin registry
403 /// Used in `./src/driver.rs`.
404 #[allow(clippy::too_many_lines)]
406 pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) {
407 register_removed_non_tool_lints(store);
409 // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
410 store.register_removed(
411 "clippy::should_assert_eq",
412 "`assert!()` will be more flexible with RFC 2011",
414 store.register_removed(
415 "clippy::extend_from_slice",
416 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
418 store.register_removed(
419 "clippy::range_step_by_zero",
420 "`iterator.step_by(0)` panics nowadays",
422 store.register_removed(
423 "clippy::unstable_as_slice",
424 "`Vec::as_slice` has been stabilized in 1.7",
426 store.register_removed(
427 "clippy::unstable_as_mut_slice",
428 "`Vec::as_mut_slice` has been stabilized in 1.7",
430 store.register_removed(
431 "clippy::str_to_string",
432 "using `str::to_string` is common even today and specialization will likely happen soon",
434 store.register_removed(
435 "clippy::string_to_string",
436 "using `string::to_string` is common even today and specialization will likely happen soon",
438 store.register_removed(
439 "clippy::misaligned_transmute",
440 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
442 store.register_removed(
443 "clippy::assign_ops",
444 "using compound assignment operators (e.g., `+=`) is harmless",
446 store.register_removed(
447 "clippy::if_let_redundant_pattern_matching",
448 "this lint has been changed to redundant_pattern_matching",
450 store.register_removed(
451 "clippy::unsafe_vector_initialization",
452 "the replacement suggested by this lint had substantially different behavior",
454 store.register_removed(
455 "clippy::invalid_ref",
456 "superseded by rustc lint `invalid_value`",
458 store.register_removed(
459 "clippy::unused_collect",
460 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint",
462 store.register_removed(
463 "clippy::into_iter_on_array",
464 "this lint has been uplifted to rustc and is now called `array_into_iter`",
466 store.register_removed(
467 "clippy::unused_label",
468 "this lint has been uplifted to rustc and is now called `unused_labels`",
470 // end deprecated lints, do not remove this comment, it’s used in `update_lints`
472 // begin register lints, do not remove this comment, it’s used in `update_lints`
473 store.register_lints(&[
474 &approx_const::APPROX_CONSTANT,
475 &arithmetic::FLOAT_ARITHMETIC,
476 &arithmetic::INTEGER_ARITHMETIC,
477 &as_conversions::AS_CONVERSIONS,
478 &assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
479 &assign_ops::ASSIGN_OP_PATTERN,
480 &assign_ops::MISREFACTORED_ASSIGN_OP,
481 &atomic_ordering::INVALID_ATOMIC_ORDERING,
482 &attrs::DEPRECATED_CFG_ATTR,
483 &attrs::DEPRECATED_SEMVER,
484 &attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
485 &attrs::INLINE_ALWAYS,
486 &attrs::UNKNOWN_CLIPPY_LINTS,
487 &attrs::USELESS_ATTRIBUTE,
488 &bit_mask::BAD_BIT_MASK,
489 &bit_mask::INEFFECTIVE_BIT_MASK,
490 &bit_mask::VERBOSE_BIT_MASK,
491 &blacklisted_name::BLACKLISTED_NAME,
492 &block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
493 &block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
494 &booleans::LOGIC_BUG,
495 &booleans::NONMINIMAL_BOOL,
496 &bytecount::NAIVE_BYTECOUNT,
497 &cargo_common_metadata::CARGO_COMMON_METADATA,
498 &checked_conversions::CHECKED_CONVERSIONS,
499 &cognitive_complexity::COGNITIVE_COMPLEXITY,
500 &collapsible_if::COLLAPSIBLE_IF,
501 &comparison_chain::COMPARISON_CHAIN,
502 &copies::IFS_SAME_COND,
503 &copies::IF_SAME_THEN_ELSE,
504 &copies::MATCH_SAME_ARMS,
505 &copies::SAME_FUNCTIONS_IN_IF_CONDITION,
506 ©_iterator::COPY_ITERATOR,
507 &dbg_macro::DBG_MACRO,
508 &default_trait_access::DEFAULT_TRAIT_ACCESS,
509 &derive::DERIVE_HASH_XOR_EQ,
510 &derive::EXPL_IMPL_CLONE_ON_COPY,
512 &doc::MISSING_ERRORS_DOC,
513 &doc::MISSING_SAFETY_DOC,
514 &doc::NEEDLESS_DOCTEST_MAIN,
515 &double_comparison::DOUBLE_COMPARISONS,
516 &double_parens::DOUBLE_PARENS,
517 &drop_bounds::DROP_BOUNDS,
518 &drop_forget_ref::DROP_COPY,
519 &drop_forget_ref::DROP_REF,
520 &drop_forget_ref::FORGET_COPY,
521 &drop_forget_ref::FORGET_REF,
522 &duration_subsec::DURATION_SUBSEC,
523 &else_if_without_else::ELSE_IF_WITHOUT_ELSE,
524 &empty_enum::EMPTY_ENUM,
526 &enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
527 &enum_variants::ENUM_VARIANT_NAMES,
528 &enum_variants::MODULE_INCEPTION,
529 &enum_variants::MODULE_NAME_REPETITIONS,
530 &enum_variants::PUB_ENUM_VARIANT_NAMES,
533 &erasing_op::ERASING_OP,
534 &escape::BOXED_LOCAL,
535 &eta_reduction::REDUNDANT_CLOSURE,
536 &eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
537 &eval_order_dependence::DIVERGING_SUB_EXPRESSION,
538 &eval_order_dependence::EVAL_ORDER_DEPENDENCE,
539 &excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS,
540 &excessive_bools::STRUCT_EXCESSIVE_BOOLS,
542 &explicit_write::EXPLICIT_WRITE,
543 &fallible_impl_from::FALLIBLE_IMPL_FROM,
544 &float_literal::EXCESSIVE_PRECISION,
545 &float_literal::LOSSY_FLOAT_LITERAL,
546 &floating_point_arithmetic::IMPRECISE_FLOPS,
547 &floating_point_arithmetic::SUBOPTIMAL_FLOPS,
548 &format::USELESS_FORMAT,
549 &formatting::POSSIBLE_MISSING_COMMA,
550 &formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
551 &formatting::SUSPICIOUS_ELSE_FORMATTING,
552 &formatting::SUSPICIOUS_UNARY_OP_FORMATTING,
553 &functions::DOUBLE_MUST_USE,
554 &functions::MUST_USE_CANDIDATE,
555 &functions::MUST_USE_UNIT,
556 &functions::NOT_UNSAFE_PTR_ARG_DEREF,
557 &functions::TOO_MANY_ARGUMENTS,
558 &functions::TOO_MANY_LINES,
559 &get_last_with_len::GET_LAST_WITH_LEN,
560 &identity_conversion::IDENTITY_CONVERSION,
561 &identity_op::IDENTITY_OP,
562 &if_let_some_result::IF_LET_SOME_RESULT,
563 &if_not_else::IF_NOT_ELSE,
564 &implicit_return::IMPLICIT_RETURN,
565 &indexing_slicing::INDEXING_SLICING,
566 &indexing_slicing::OUT_OF_BOUNDS_INDEXING,
567 &infinite_iter::INFINITE_ITER,
568 &infinite_iter::MAYBE_INFINITE_ITER,
569 &inherent_impl::MULTIPLE_INHERENT_IMPL,
570 &inherent_to_string::INHERENT_TO_STRING,
571 &inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
572 &inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
573 &int_plus_one::INT_PLUS_ONE,
574 &integer_division::INTEGER_DIVISION,
575 &items_after_statements::ITEMS_AFTER_STATEMENTS,
576 &large_enum_variant::LARGE_ENUM_VARIANT,
577 &large_stack_arrays::LARGE_STACK_ARRAYS,
578 &len_zero::LEN_WITHOUT_IS_EMPTY,
580 &let_if_seq::USELESS_LET_IF_SEQ,
581 &let_underscore::LET_UNDERSCORE_LOCK,
582 &let_underscore::LET_UNDERSCORE_MUST_USE,
583 &lifetimes::EXTRA_UNUSED_LIFETIMES,
584 &lifetimes::NEEDLESS_LIFETIMES,
585 &literal_representation::DECIMAL_LITERAL_REPRESENTATION,
586 &literal_representation::INCONSISTENT_DIGIT_GROUPING,
587 &literal_representation::LARGE_DIGIT_GROUPS,
588 &literal_representation::MISTYPED_LITERAL_SUFFIXES,
589 &literal_representation::UNREADABLE_LITERAL,
591 &loops::EXPLICIT_COUNTER_LOOP,
592 &loops::EXPLICIT_INTO_ITER_LOOP,
593 &loops::EXPLICIT_ITER_LOOP,
595 &loops::FOR_LOOP_OVER_OPTION,
596 &loops::FOR_LOOP_OVER_RESULT,
597 &loops::ITER_NEXT_LOOP,
598 &loops::MANUAL_MEMCPY,
599 &loops::MUT_RANGE_BOUND,
600 &loops::NEEDLESS_COLLECT,
601 &loops::NEEDLESS_RANGE_LOOP,
603 &loops::REVERSE_RANGE_LOOP,
604 &loops::WHILE_IMMUTABLE_CONDITION,
605 &loops::WHILE_LET_LOOP,
606 &loops::WHILE_LET_ON_ITERATOR,
607 ¯o_use::MACRO_USE_IMPORTS,
608 &main_recursion::MAIN_RECURSION,
609 &map_clone::MAP_CLONE,
610 &map_unit_fn::OPTION_MAP_UNIT_FN,
611 &map_unit_fn::RESULT_MAP_UNIT_FN,
612 &matches::INFALLIBLE_DESTRUCTURING_MATCH,
613 &matches::MATCH_AS_REF,
614 &matches::MATCH_BOOL,
615 &matches::MATCH_OVERLAPPING_ARM,
616 &matches::MATCH_REF_PATS,
617 &matches::MATCH_SINGLE_BINDING,
618 &matches::MATCH_WILD_ERR_ARM,
619 &matches::REST_PAT_IN_FULLY_BOUND_STRUCTS,
620 &matches::SINGLE_MATCH,
621 &matches::SINGLE_MATCH_ELSE,
622 &matches::WILDCARD_ENUM_MATCH_ARM,
623 &matches::WILDCARD_IN_OR_PATTERNS,
624 &mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
625 &mem_forget::MEM_FORGET,
626 &mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
627 &mem_replace::MEM_REPLACE_WITH_DEFAULT,
628 &mem_replace::MEM_REPLACE_WITH_UNINIT,
629 &methods::CHARS_LAST_CMP,
630 &methods::CHARS_NEXT_CMP,
631 &methods::CLONE_DOUBLE_REF,
632 &methods::CLONE_ON_COPY,
633 &methods::CLONE_ON_REF_PTR,
634 &methods::EXPECT_FUN_CALL,
635 &methods::FILETYPE_IS_FILE,
636 &methods::FILTER_MAP,
637 &methods::FILTER_MAP_NEXT,
638 &methods::FILTER_NEXT,
640 &methods::FLAT_MAP_IDENTITY,
641 &methods::GET_UNWRAP,
642 &methods::INEFFICIENT_TO_STRING,
643 &methods::INTO_ITER_ON_REF,
644 &methods::ITERATOR_STEP_BY_ZERO,
645 &methods::ITER_CLONED_COLLECT,
647 &methods::ITER_NTH_ZERO,
648 &methods::ITER_SKIP_NEXT,
649 &methods::MANUAL_SATURATING_ARITHMETIC,
650 &methods::MAP_FLATTEN,
651 &methods::NEW_RET_NO_SELF,
653 &methods::OPTION_AND_THEN_SOME,
654 &methods::OPTION_AS_REF_DEREF,
655 &methods::OPTION_EXPECT_USED,
656 &methods::OPTION_MAP_OR_NONE,
657 &methods::OPTION_MAP_UNWRAP_OR,
658 &methods::OPTION_MAP_UNWRAP_OR_ELSE,
659 &methods::OPTION_UNWRAP_USED,
660 &methods::OR_FUN_CALL,
661 &methods::RESULT_EXPECT_USED,
662 &methods::RESULT_MAP_UNWRAP_OR_ELSE,
663 &methods::RESULT_UNWRAP_USED,
664 &methods::SEARCH_IS_SOME,
665 &methods::SHOULD_IMPLEMENT_TRAIT,
666 &methods::SINGLE_CHAR_PATTERN,
667 &methods::SKIP_WHILE_NEXT,
668 &methods::STRING_EXTEND_CHARS,
669 &methods::SUSPICIOUS_MAP,
670 &methods::TEMPORARY_CSTRING_AS_PTR,
671 &methods::UNINIT_ASSUMED_INIT,
672 &methods::UNNECESSARY_FILTER_MAP,
673 &methods::UNNECESSARY_FOLD,
674 &methods::USELESS_ASREF,
675 &methods::WRONG_PUB_SELF_CONVENTION,
676 &methods::WRONG_SELF_CONVENTION,
677 &methods::ZST_OFFSET,
682 &misc::FLOAT_CMP_CONST,
684 &misc::SHORT_CIRCUIT_STATEMENT,
685 &misc::TOPLEVEL_REF_ARG,
686 &misc::USED_UNDERSCORE_BINDING,
688 &misc_early::BUILTIN_TYPE_SHADOW,
689 &misc_early::DOUBLE_NEG,
690 &misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
691 &misc_early::MIXED_CASE_HEX_LITERALS,
692 &misc_early::REDUNDANT_CLOSURE_CALL,
693 &misc_early::REDUNDANT_PATTERN,
694 &misc_early::UNNEEDED_FIELD_PATTERN,
695 &misc_early::UNNEEDED_WILDCARD_PATTERN,
696 &misc_early::UNSEPARATED_LITERAL_SUFFIX,
697 &misc_early::ZERO_PREFIXED_LITERAL,
698 &missing_const_for_fn::MISSING_CONST_FOR_FN,
699 &missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
700 &missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
701 &modulo_arithmetic::MODULO_ARITHMETIC,
702 &multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
703 &mut_key::MUTABLE_KEY_TYPE,
705 &mut_reference::UNNECESSARY_MUT_PASSED,
706 &mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL,
707 &mutex_atomic::MUTEX_ATOMIC,
708 &mutex_atomic::MUTEX_INTEGER,
709 &needless_bool::BOOL_COMPARISON,
710 &needless_bool::NEEDLESS_BOOL,
711 &needless_borrow::NEEDLESS_BORROW,
712 &needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
713 &needless_continue::NEEDLESS_CONTINUE,
714 &needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
715 &needless_update::NEEDLESS_UPDATE,
716 &neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
717 &neg_multiply::NEG_MULTIPLY,
718 &new_without_default::NEW_WITHOUT_DEFAULT,
719 &no_effect::NO_EFFECT,
720 &no_effect::UNNECESSARY_OPERATION,
721 &non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
722 &non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
723 &non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
724 &non_expressive_names::MANY_SINGLE_CHAR_NAMES,
725 &non_expressive_names::SIMILAR_NAMES,
726 &open_options::NONSENSICAL_OPEN_OPTIONS,
727 &option_env_unwrap::OPTION_ENV_UNWRAP,
728 &overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
729 &panic_unimplemented::PANIC,
730 &panic_unimplemented::PANIC_PARAMS,
731 &panic_unimplemented::TODO,
732 &panic_unimplemented::UNIMPLEMENTED,
733 &panic_unimplemented::UNREACHABLE,
734 &partialeq_ne_impl::PARTIALEQ_NE_IMPL,
735 &path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
736 &precedence::PRECEDENCE,
740 &ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
741 &question_mark::QUESTION_MARK,
742 &ranges::RANGE_MINUS_ONE,
743 &ranges::RANGE_PLUS_ONE,
744 &ranges::RANGE_ZIP_WITH_LEN,
745 &redundant_clone::REDUNDANT_CLONE,
746 &redundant_field_names::REDUNDANT_FIELD_NAMES,
747 &redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
748 &redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
749 &reference::DEREF_ADDROF,
750 &reference::REF_IN_DEREF,
751 ®ex::INVALID_REGEX,
753 ®ex::TRIVIAL_REGEX,
754 &replace_consts::REPLACE_CONSTS,
755 &returns::LET_AND_RETURN,
756 &returns::NEEDLESS_RETURN,
757 &returns::UNUSED_UNIT,
758 &serde_api::SERDE_API_MISUSE,
759 &shadow::SHADOW_REUSE,
760 &shadow::SHADOW_SAME,
761 &shadow::SHADOW_UNRELATED,
762 &single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS,
763 &slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
764 &strings::STRING_ADD,
765 &strings::STRING_ADD_ASSIGN,
766 &strings::STRING_LIT_AS_BYTES,
767 &suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
768 &suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
769 &swap::ALMOST_SWAPPED,
771 &tabs_in_doc_comments::TABS_IN_DOC_COMMENTS,
772 &temporary_assignment::TEMPORARY_ASSIGNMENT,
773 &to_digit_is_some::TO_DIGIT_IS_SOME,
774 &trait_bounds::TYPE_REPETITION_IN_BOUNDS,
775 &transmute::CROSSPOINTER_TRANSMUTE,
776 &transmute::TRANSMUTE_BYTES_TO_STR,
777 &transmute::TRANSMUTE_FLOAT_TO_INT,
778 &transmute::TRANSMUTE_INT_TO_BOOL,
779 &transmute::TRANSMUTE_INT_TO_CHAR,
780 &transmute::TRANSMUTE_INT_TO_FLOAT,
781 &transmute::TRANSMUTE_PTR_TO_PTR,
782 &transmute::TRANSMUTE_PTR_TO_REF,
783 &transmute::UNSOUND_COLLECTION_TRANSMUTE,
784 &transmute::USELESS_TRANSMUTE,
785 &transmute::WRONG_TRANSMUTE,
786 &transmuting_null::TRANSMUTING_NULL,
787 &trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
789 &types::ABSURD_EXTREME_COMPARISONS,
790 &types::BORROWED_BOX,
792 &types::CAST_LOSSLESS,
793 &types::CAST_POSSIBLE_TRUNCATION,
794 &types::CAST_POSSIBLE_WRAP,
795 &types::CAST_PRECISION_LOSS,
796 &types::CAST_PTR_ALIGNMENT,
797 &types::CAST_REF_TO_MUT,
798 &types::CAST_SIGN_LOSS,
799 &types::CHAR_LIT_AS_U8,
800 &types::FN_TO_NUMERIC_CAST,
801 &types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
802 &types::IMPLICIT_HASHER,
803 &types::INVALID_UPCAST_COMPARISONS,
804 &types::LET_UNIT_VALUE,
806 &types::OPTION_OPTION,
807 &types::TYPE_COMPLEXITY,
810 &types::UNNECESSARY_CAST,
812 &unicode::NON_ASCII_LITERAL,
813 &unicode::UNICODE_NOT_NFC,
814 &unicode::ZERO_WIDTH_SPACE,
815 &unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
816 &unused_io_amount::UNUSED_IO_AMOUNT,
817 &unused_self::UNUSED_SELF,
818 &unwrap::PANICKING_UNWRAP,
819 &unwrap::UNNECESSARY_UNWRAP,
822 &verbose_file_reads::VERBOSE_FILE_READS,
823 &wildcard_dependencies::WILDCARD_DEPENDENCIES,
824 &wildcard_imports::ENUM_GLOB_USE,
825 &wildcard_imports::WILDCARD_IMPORTS,
826 &write::PRINTLN_EMPTY_STRING,
827 &write::PRINT_LITERAL,
828 &write::PRINT_STDOUT,
829 &write::PRINT_WITH_NEWLINE,
831 &write::WRITELN_EMPTY_STRING,
832 &write::WRITE_LITERAL,
833 &write::WRITE_WITH_NEWLINE,
834 &zero_div_zero::ZERO_DIVIDED_BY_ZERO,
836 // end register lints, do not remove this comment, it’s used in `update_lints`
838 store.register_late_pass(|| box serde_api::SerdeAPI);
839 store.register_late_pass(|| box utils::internal_lints::CompilerLintFunctions::new());
840 store.register_late_pass(|| box utils::internal_lints::LintWithoutLintPass::default());
841 store.register_late_pass(|| box utils::internal_lints::OuterExpnDataPass);
842 store.register_late_pass(|| box utils::inspector::DeepCodeInspector);
843 store.register_late_pass(|| box utils::author::Author);
844 let vec_box_size_threshold = conf.vec_box_size_threshold;
845 store.register_late_pass(move || box types::Types::new(vec_box_size_threshold));
846 store.register_late_pass(|| box booleans::NonminimalBool);
847 store.register_late_pass(|| box eq_op::EqOp);
848 store.register_late_pass(|| box enum_clike::UnportableVariant);
849 store.register_late_pass(|| box float_literal::FloatLiteral);
850 let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
851 store.register_late_pass(move || box bit_mask::BitMask::new(verbose_bit_mask_threshold));
852 store.register_late_pass(|| box ptr::Ptr);
853 store.register_late_pass(|| box needless_bool::NeedlessBool);
854 store.register_late_pass(|| box needless_bool::BoolComparison);
855 store.register_late_pass(|| box approx_const::ApproxConstant);
856 store.register_late_pass(|| box misc::MiscLints);
857 store.register_late_pass(|| box eta_reduction::EtaReduction);
858 store.register_late_pass(|| box identity_op::IdentityOp);
859 store.register_late_pass(|| box erasing_op::ErasingOp);
860 store.register_late_pass(|| box mut_mut::MutMut);
861 store.register_late_pass(|| box mut_reference::UnnecessaryMutPassed);
862 store.register_late_pass(|| box len_zero::LenZero);
863 store.register_late_pass(|| box attrs::Attributes);
864 store.register_late_pass(|| box block_in_if_condition::BlockInIfCondition);
865 store.register_late_pass(|| box unicode::Unicode);
866 store.register_late_pass(|| box strings::StringAdd);
867 store.register_late_pass(|| box implicit_return::ImplicitReturn);
868 store.register_late_pass(|| box methods::Methods);
869 store.register_late_pass(|| box map_clone::MapClone);
870 store.register_late_pass(|| box shadow::Shadow);
871 store.register_late_pass(|| box types::LetUnitValue);
872 store.register_late_pass(|| box types::UnitCmp);
873 store.register_late_pass(|| box loops::Loops);
874 store.register_late_pass(|| box main_recursion::MainRecursion::default());
875 store.register_late_pass(|| box lifetimes::Lifetimes);
876 store.register_late_pass(|| box entry::HashMapPass);
877 store.register_late_pass(|| box ranges::Ranges);
878 store.register_late_pass(|| box types::Casts);
879 let type_complexity_threshold = conf.type_complexity_threshold;
880 store.register_late_pass(move || box types::TypeComplexity::new(type_complexity_threshold));
881 store.register_late_pass(|| box matches::Matches::default());
882 store.register_late_pass(|| box minmax::MinMaxPass);
883 store.register_late_pass(|| box open_options::OpenOptions);
884 store.register_late_pass(|| box zero_div_zero::ZeroDiv);
885 store.register_late_pass(|| box mutex_atomic::Mutex);
886 store.register_late_pass(|| box needless_update::NeedlessUpdate);
887 store.register_late_pass(|| box needless_borrow::NeedlessBorrow::default());
888 store.register_late_pass(|| box needless_borrowed_ref::NeedlessBorrowedRef);
889 store.register_late_pass(|| box no_effect::NoEffect);
890 store.register_late_pass(|| box temporary_assignment::TemporaryAssignment);
891 store.register_late_pass(|| box transmute::Transmute);
892 let cognitive_complexity_threshold = conf.cognitive_complexity_threshold;
893 store.register_late_pass(move || box cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold));
894 let too_large_for_stack = conf.too_large_for_stack;
895 store.register_late_pass(move || box escape::BoxedLocal{too_large_for_stack});
896 store.register_late_pass(|| box panic_unimplemented::PanicUnimplemented);
897 store.register_late_pass(|| box strings::StringLitAsBytes);
898 store.register_late_pass(|| box derive::Derive);
899 store.register_late_pass(|| box types::CharLitAsU8);
900 store.register_late_pass(|| box vec::UselessVec);
901 store.register_late_pass(|| box drop_bounds::DropBounds);
902 store.register_late_pass(|| box get_last_with_len::GetLastWithLen);
903 store.register_late_pass(|| box drop_forget_ref::DropForgetRef);
904 store.register_late_pass(|| box empty_enum::EmptyEnum);
905 store.register_late_pass(|| box types::AbsurdExtremeComparisons);
906 store.register_late_pass(|| box types::InvalidUpcastComparisons);
907 store.register_late_pass(|| box regex::Regex::default());
908 store.register_late_pass(|| box copies::CopyAndPaste);
909 store.register_late_pass(|| box copy_iterator::CopyIterator);
910 store.register_late_pass(|| box format::UselessFormat);
911 store.register_late_pass(|| box swap::Swap);
912 store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
913 store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
914 let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
915 store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
916 let too_many_arguments_threshold1 = conf.too_many_arguments_threshold;
917 let too_many_lines_threshold2 = conf.too_many_lines_threshold;
918 store.register_late_pass(move || box functions::Functions::new(too_many_arguments_threshold1, too_many_lines_threshold2));
919 let doc_valid_idents = conf.doc_valid_idents.iter().cloned().collect::<FxHashSet<_>>();
920 store.register_late_pass(move || box doc::DocMarkdown::new(doc_valid_idents.clone()));
921 store.register_late_pass(|| box neg_multiply::NegMultiply);
922 store.register_late_pass(|| box mem_discriminant::MemDiscriminant);
923 store.register_late_pass(|| box mem_forget::MemForget);
924 store.register_late_pass(|| box mem_replace::MemReplace);
925 store.register_late_pass(|| box arithmetic::Arithmetic::default());
926 store.register_late_pass(|| box assign_ops::AssignOps);
927 store.register_late_pass(|| box let_if_seq::LetIfSeq);
928 store.register_late_pass(|| box eval_order_dependence::EvalOrderDependence);
929 store.register_late_pass(|| box missing_doc::MissingDoc::new());
930 store.register_late_pass(|| box missing_inline::MissingInline);
931 store.register_late_pass(|| box if_let_some_result::OkIfLet);
932 store.register_late_pass(|| box redundant_pattern_matching::RedundantPatternMatching);
933 store.register_late_pass(|| box partialeq_ne_impl::PartialEqNeImpl);
934 store.register_late_pass(|| box unused_io_amount::UnusedIoAmount);
935 let enum_variant_size_threshold = conf.enum_variant_size_threshold;
936 store.register_late_pass(move || box large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold));
937 store.register_late_pass(|| box explicit_write::ExplicitWrite);
938 store.register_late_pass(|| box needless_pass_by_value::NeedlessPassByValue);
939 let trivially_copy_pass_by_ref = trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
940 conf.trivial_copy_size_limit,
943 store.register_late_pass(move || box trivially_copy_pass_by_ref);
944 store.register_late_pass(|| box try_err::TryErr);
945 store.register_late_pass(|| box use_self::UseSelf);
946 store.register_late_pass(|| box bytecount::ByteCount);
947 store.register_late_pass(|| box infinite_iter::InfiniteIter);
948 store.register_late_pass(|| box inline_fn_without_body::InlineFnWithoutBody);
949 store.register_late_pass(|| box identity_conversion::IdentityConversion::default());
950 store.register_late_pass(|| box types::ImplicitHasher);
951 store.register_late_pass(|| box fallible_impl_from::FallibleImplFrom);
952 store.register_late_pass(|| box replace_consts::ReplaceConsts);
953 store.register_late_pass(|| box types::UnitArg);
954 store.register_late_pass(|| box double_comparison::DoubleComparisons);
955 store.register_late_pass(|| box question_mark::QuestionMark);
956 store.register_late_pass(|| box suspicious_trait_impl::SuspiciousImpl);
957 store.register_late_pass(|| box map_unit_fn::MapUnit);
958 store.register_late_pass(|| box inherent_impl::MultipleInherentImpl::default());
959 store.register_late_pass(|| box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
960 store.register_late_pass(|| box unwrap::Unwrap);
961 store.register_late_pass(|| box duration_subsec::DurationSubsec);
962 store.register_late_pass(|| box default_trait_access::DefaultTraitAccess);
963 store.register_late_pass(|| box indexing_slicing::IndexingSlicing);
964 store.register_late_pass(|| box non_copy_const::NonCopyConst);
965 store.register_late_pass(|| box ptr_offset_with_cast::PtrOffsetWithCast);
966 store.register_late_pass(|| box redundant_clone::RedundantClone);
967 store.register_late_pass(|| box slow_vector_initialization::SlowVectorInit);
968 store.register_late_pass(|| box types::RefToMut);
969 store.register_late_pass(|| box assertions_on_constants::AssertionsOnConstants);
970 store.register_late_pass(|| box missing_const_for_fn::MissingConstForFn);
971 store.register_late_pass(|| box transmuting_null::TransmutingNull);
972 store.register_late_pass(|| box path_buf_push_overwrite::PathBufPushOverwrite);
973 store.register_late_pass(|| box checked_conversions::CheckedConversions);
974 store.register_late_pass(|| box integer_division::IntegerDivision);
975 store.register_late_pass(|| box inherent_to_string::InherentToString);
976 store.register_late_pass(|| box trait_bounds::TraitBounds);
977 store.register_late_pass(|| box comparison_chain::ComparisonChain);
978 store.register_late_pass(|| box mut_key::MutableKeyType);
979 store.register_late_pass(|| box modulo_arithmetic::ModuloArithmetic);
980 store.register_early_pass(|| box reference::DerefAddrOf);
981 store.register_early_pass(|| box reference::RefInDeref);
982 store.register_early_pass(|| box double_parens::DoubleParens);
983 store.register_early_pass(|| box unsafe_removed_from_name::UnsafeNameRemoval);
984 store.register_early_pass(|| box if_not_else::IfNotElse);
985 store.register_early_pass(|| box else_if_without_else::ElseIfWithoutElse);
986 store.register_early_pass(|| box int_plus_one::IntPlusOne);
987 store.register_early_pass(|| box formatting::Formatting);
988 store.register_early_pass(|| box misc_early::MiscEarlyLints);
989 store.register_early_pass(|| box returns::Return);
990 store.register_early_pass(|| box collapsible_if::CollapsibleIf);
991 store.register_early_pass(|| box items_after_statements::ItemsAfterStatements);
992 store.register_early_pass(|| box precedence::Precedence);
993 store.register_early_pass(|| box needless_continue::NeedlessContinue);
994 store.register_early_pass(|| box redundant_static_lifetimes::RedundantStaticLifetimes);
995 store.register_early_pass(|| box cargo_common_metadata::CargoCommonMetadata);
996 store.register_early_pass(|| box multiple_crate_versions::MultipleCrateVersions);
997 store.register_early_pass(|| box wildcard_dependencies::WildcardDependencies);
998 store.register_early_pass(|| box literal_representation::LiteralDigitGrouping);
999 let literal_representation_threshold = conf.literal_representation_threshold;
1000 store.register_early_pass(move || box literal_representation::DecimalLiteralRepresentation::new(literal_representation_threshold));
1001 store.register_early_pass(|| box utils::internal_lints::ClippyLintsInternal);
1002 let enum_variant_name_threshold = conf.enum_variant_name_threshold;
1003 store.register_early_pass(move || box enum_variants::EnumVariantNames::new(enum_variant_name_threshold));
1004 store.register_early_pass(|| box tabs_in_doc_comments::TabsInDocComments);
1005 store.register_late_pass(|| box unused_self::UnusedSelf);
1006 store.register_late_pass(|| box mutable_debug_assertion::DebugAssertWithMutCall);
1007 store.register_late_pass(|| box exit::Exit);
1008 store.register_late_pass(|| box to_digit_is_some::ToDigitIsSome);
1009 let array_size_threshold = conf.array_size_threshold;
1010 store.register_late_pass(move || box large_stack_arrays::LargeStackArrays::new(array_size_threshold));
1011 store.register_late_pass(move || box floating_point_arithmetic::FloatingPointArithmetic);
1012 store.register_early_pass(|| box as_conversions::AsConversions);
1013 store.register_early_pass(|| box utils::internal_lints::ProduceIce);
1014 store.register_late_pass(|| box let_underscore::LetUnderscore);
1015 store.register_late_pass(|| box atomic_ordering::AtomicOrdering);
1016 store.register_early_pass(|| box single_component_path_imports::SingleComponentPathImports);
1017 let max_fn_params_bools = conf.max_fn_params_bools;
1018 let max_struct_bools = conf.max_struct_bools;
1019 store.register_early_pass(move || box excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools));
1020 store.register_early_pass(|| box option_env_unwrap::OptionEnvUnwrap);
1021 store.register_late_pass(|| box wildcard_imports::WildcardImports);
1022 store.register_early_pass(|| box macro_use::MacroUseImports);
1023 store.register_late_pass(|| box verbose_file_reads::VerboseFileReads);
1025 store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
1026 LintId::of(&arithmetic::FLOAT_ARITHMETIC),
1027 LintId::of(&arithmetic::INTEGER_ARITHMETIC),
1028 LintId::of(&as_conversions::AS_CONVERSIONS),
1029 LintId::of(&dbg_macro::DBG_MACRO),
1030 LintId::of(&else_if_without_else::ELSE_IF_WITHOUT_ELSE),
1031 LintId::of(&exit::EXIT),
1032 LintId::of(&float_literal::LOSSY_FLOAT_LITERAL),
1033 LintId::of(&implicit_return::IMPLICIT_RETURN),
1034 LintId::of(&indexing_slicing::INDEXING_SLICING),
1035 LintId::of(&inherent_impl::MULTIPLE_INHERENT_IMPL),
1036 LintId::of(&integer_division::INTEGER_DIVISION),
1037 LintId::of(&let_underscore::LET_UNDERSCORE_MUST_USE),
1038 LintId::of(&literal_representation::DECIMAL_LITERAL_REPRESENTATION),
1039 LintId::of(&matches::REST_PAT_IN_FULLY_BOUND_STRUCTS),
1040 LintId::of(&matches::WILDCARD_ENUM_MATCH_ARM),
1041 LintId::of(&mem_forget::MEM_FORGET),
1042 LintId::of(&methods::CLONE_ON_REF_PTR),
1043 LintId::of(&methods::FILETYPE_IS_FILE),
1044 LintId::of(&methods::GET_UNWRAP),
1045 LintId::of(&methods::OPTION_EXPECT_USED),
1046 LintId::of(&methods::OPTION_UNWRAP_USED),
1047 LintId::of(&methods::RESULT_EXPECT_USED),
1048 LintId::of(&methods::RESULT_UNWRAP_USED),
1049 LintId::of(&methods::WRONG_PUB_SELF_CONVENTION),
1050 LintId::of(&misc::FLOAT_CMP_CONST),
1051 LintId::of(&misc_early::UNNEEDED_FIELD_PATTERN),
1052 LintId::of(&missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS),
1053 LintId::of(&missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS),
1054 LintId::of(&modulo_arithmetic::MODULO_ARITHMETIC),
1055 LintId::of(&panic_unimplemented::PANIC),
1056 LintId::of(&panic_unimplemented::TODO),
1057 LintId::of(&panic_unimplemented::UNIMPLEMENTED),
1058 LintId::of(&panic_unimplemented::UNREACHABLE),
1059 LintId::of(&shadow::SHADOW_REUSE),
1060 LintId::of(&shadow::SHADOW_SAME),
1061 LintId::of(&strings::STRING_ADD),
1062 LintId::of(&write::PRINT_STDOUT),
1063 LintId::of(&write::USE_DEBUG),
1066 store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
1067 LintId::of(&attrs::INLINE_ALWAYS),
1068 LintId::of(&checked_conversions::CHECKED_CONVERSIONS),
1069 LintId::of(&copies::MATCH_SAME_ARMS),
1070 LintId::of(&copies::SAME_FUNCTIONS_IN_IF_CONDITION),
1071 LintId::of(©_iterator::COPY_ITERATOR),
1072 LintId::of(&default_trait_access::DEFAULT_TRAIT_ACCESS),
1073 LintId::of(&derive::EXPL_IMPL_CLONE_ON_COPY),
1074 LintId::of(&doc::DOC_MARKDOWN),
1075 LintId::of(&doc::MISSING_ERRORS_DOC),
1076 LintId::of(&empty_enum::EMPTY_ENUM),
1077 LintId::of(&enum_variants::MODULE_NAME_REPETITIONS),
1078 LintId::of(&enum_variants::PUB_ENUM_VARIANT_NAMES),
1079 LintId::of(&eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS),
1080 LintId::of(&excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS),
1081 LintId::of(&excessive_bools::STRUCT_EXCESSIVE_BOOLS),
1082 LintId::of(&functions::MUST_USE_CANDIDATE),
1083 LintId::of(&functions::TOO_MANY_LINES),
1084 LintId::of(&if_not_else::IF_NOT_ELSE),
1085 LintId::of(&infinite_iter::MAYBE_INFINITE_ITER),
1086 LintId::of(&items_after_statements::ITEMS_AFTER_STATEMENTS),
1087 LintId::of(&large_stack_arrays::LARGE_STACK_ARRAYS),
1088 LintId::of(&literal_representation::LARGE_DIGIT_GROUPS),
1089 LintId::of(&loops::EXPLICIT_INTO_ITER_LOOP),
1090 LintId::of(&loops::EXPLICIT_ITER_LOOP),
1091 LintId::of(¯o_use::MACRO_USE_IMPORTS),
1092 LintId::of(&matches::SINGLE_MATCH_ELSE),
1093 LintId::of(&methods::FILTER_MAP),
1094 LintId::of(&methods::FILTER_MAP_NEXT),
1095 LintId::of(&methods::FIND_MAP),
1096 LintId::of(&methods::MAP_FLATTEN),
1097 LintId::of(&methods::OPTION_MAP_UNWRAP_OR),
1098 LintId::of(&methods::OPTION_MAP_UNWRAP_OR_ELSE),
1099 LintId::of(&methods::RESULT_MAP_UNWRAP_OR_ELSE),
1100 LintId::of(&misc::USED_UNDERSCORE_BINDING),
1101 LintId::of(&misc_early::UNSEPARATED_LITERAL_SUFFIX),
1102 LintId::of(&mut_mut::MUT_MUT),
1103 LintId::of(&needless_continue::NEEDLESS_CONTINUE),
1104 LintId::of(&needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
1105 LintId::of(&non_expressive_names::SIMILAR_NAMES),
1106 LintId::of(&ranges::RANGE_PLUS_ONE),
1107 LintId::of(&replace_consts::REPLACE_CONSTS),
1108 LintId::of(&shadow::SHADOW_UNRELATED),
1109 LintId::of(&strings::STRING_ADD_ASSIGN),
1110 LintId::of(&trait_bounds::TYPE_REPETITION_IN_BOUNDS),
1111 LintId::of(&types::CAST_LOSSLESS),
1112 LintId::of(&types::CAST_POSSIBLE_TRUNCATION),
1113 LintId::of(&types::CAST_POSSIBLE_WRAP),
1114 LintId::of(&types::CAST_PRECISION_LOSS),
1115 LintId::of(&types::CAST_SIGN_LOSS),
1116 LintId::of(&types::INVALID_UPCAST_COMPARISONS),
1117 LintId::of(&types::LINKEDLIST),
1118 LintId::of(&unicode::NON_ASCII_LITERAL),
1119 LintId::of(&unicode::UNICODE_NOT_NFC),
1120 LintId::of(&unused_self::UNUSED_SELF),
1121 LintId::of(&wildcard_imports::ENUM_GLOB_USE),
1122 LintId::of(&wildcard_imports::WILDCARD_IMPORTS),
1125 store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![
1126 LintId::of(&utils::internal_lints::CLIPPY_LINTS_INTERNAL),
1127 LintId::of(&utils::internal_lints::COMPILER_LINT_FUNCTIONS),
1128 LintId::of(&utils::internal_lints::DEFAULT_LINT),
1129 LintId::of(&utils::internal_lints::LINT_WITHOUT_LINT_PASS),
1130 LintId::of(&utils::internal_lints::OUTER_EXPN_EXPN_DATA),
1131 LintId::of(&utils::internal_lints::PRODUCE_ICE),
1134 store.register_group(true, "clippy::all", Some("clippy"), vec![
1135 LintId::of(&approx_const::APPROX_CONSTANT),
1136 LintId::of(&assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
1137 LintId::of(&assign_ops::ASSIGN_OP_PATTERN),
1138 LintId::of(&assign_ops::MISREFACTORED_ASSIGN_OP),
1139 LintId::of(&atomic_ordering::INVALID_ATOMIC_ORDERING),
1140 LintId::of(&attrs::DEPRECATED_CFG_ATTR),
1141 LintId::of(&attrs::DEPRECATED_SEMVER),
1142 LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
1143 LintId::of(&attrs::USELESS_ATTRIBUTE),
1144 LintId::of(&bit_mask::BAD_BIT_MASK),
1145 LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
1146 LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1147 LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1148 LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR),
1149 LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT),
1150 LintId::of(&booleans::LOGIC_BUG),
1151 LintId::of(&booleans::NONMINIMAL_BOOL),
1152 LintId::of(&bytecount::NAIVE_BYTECOUNT),
1153 LintId::of(&cognitive_complexity::COGNITIVE_COMPLEXITY),
1154 LintId::of(&collapsible_if::COLLAPSIBLE_IF),
1155 LintId::of(&comparison_chain::COMPARISON_CHAIN),
1156 LintId::of(&copies::IFS_SAME_COND),
1157 LintId::of(&copies::IF_SAME_THEN_ELSE),
1158 LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1159 LintId::of(&doc::MISSING_SAFETY_DOC),
1160 LintId::of(&doc::NEEDLESS_DOCTEST_MAIN),
1161 LintId::of(&double_comparison::DOUBLE_COMPARISONS),
1162 LintId::of(&double_parens::DOUBLE_PARENS),
1163 LintId::of(&drop_bounds::DROP_BOUNDS),
1164 LintId::of(&drop_forget_ref::DROP_COPY),
1165 LintId::of(&drop_forget_ref::DROP_REF),
1166 LintId::of(&drop_forget_ref::FORGET_COPY),
1167 LintId::of(&drop_forget_ref::FORGET_REF),
1168 LintId::of(&duration_subsec::DURATION_SUBSEC),
1169 LintId::of(&entry::MAP_ENTRY),
1170 LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
1171 LintId::of(&enum_variants::ENUM_VARIANT_NAMES),
1172 LintId::of(&enum_variants::MODULE_INCEPTION),
1173 LintId::of(&eq_op::EQ_OP),
1174 LintId::of(&eq_op::OP_REF),
1175 LintId::of(&erasing_op::ERASING_OP),
1176 LintId::of(&escape::BOXED_LOCAL),
1177 LintId::of(&eta_reduction::REDUNDANT_CLOSURE),
1178 LintId::of(&eval_order_dependence::DIVERGING_SUB_EXPRESSION),
1179 LintId::of(&eval_order_dependence::EVAL_ORDER_DEPENDENCE),
1180 LintId::of(&explicit_write::EXPLICIT_WRITE),
1181 LintId::of(&float_literal::EXCESSIVE_PRECISION),
1182 LintId::of(&format::USELESS_FORMAT),
1183 LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
1184 LintId::of(&formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1185 LintId::of(&formatting::SUSPICIOUS_ELSE_FORMATTING),
1186 LintId::of(&formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
1187 LintId::of(&functions::DOUBLE_MUST_USE),
1188 LintId::of(&functions::MUST_USE_UNIT),
1189 LintId::of(&functions::NOT_UNSAFE_PTR_ARG_DEREF),
1190 LintId::of(&functions::TOO_MANY_ARGUMENTS),
1191 LintId::of(&get_last_with_len::GET_LAST_WITH_LEN),
1192 LintId::of(&identity_conversion::IDENTITY_CONVERSION),
1193 LintId::of(&identity_op::IDENTITY_OP),
1194 LintId::of(&if_let_some_result::IF_LET_SOME_RESULT),
1195 LintId::of(&indexing_slicing::OUT_OF_BOUNDS_INDEXING),
1196 LintId::of(&infinite_iter::INFINITE_ITER),
1197 LintId::of(&inherent_to_string::INHERENT_TO_STRING),
1198 LintId::of(&inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
1199 LintId::of(&inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
1200 LintId::of(&int_plus_one::INT_PLUS_ONE),
1201 LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
1202 LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
1203 LintId::of(&len_zero::LEN_ZERO),
1204 LintId::of(&let_if_seq::USELESS_LET_IF_SEQ),
1205 LintId::of(&let_underscore::LET_UNDERSCORE_LOCK),
1206 LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
1207 LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
1208 LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
1209 LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1210 LintId::of(&literal_representation::UNREADABLE_LITERAL),
1211 LintId::of(&loops::EMPTY_LOOP),
1212 LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
1213 LintId::of(&loops::FOR_KV_MAP),
1214 LintId::of(&loops::FOR_LOOP_OVER_OPTION),
1215 LintId::of(&loops::FOR_LOOP_OVER_RESULT),
1216 LintId::of(&loops::ITER_NEXT_LOOP),
1217 LintId::of(&loops::MANUAL_MEMCPY),
1218 LintId::of(&loops::MUT_RANGE_BOUND),
1219 LintId::of(&loops::NEEDLESS_COLLECT),
1220 LintId::of(&loops::NEEDLESS_RANGE_LOOP),
1221 LintId::of(&loops::NEVER_LOOP),
1222 LintId::of(&loops::REVERSE_RANGE_LOOP),
1223 LintId::of(&loops::WHILE_IMMUTABLE_CONDITION),
1224 LintId::of(&loops::WHILE_LET_LOOP),
1225 LintId::of(&loops::WHILE_LET_ON_ITERATOR),
1226 LintId::of(&main_recursion::MAIN_RECURSION),
1227 LintId::of(&map_clone::MAP_CLONE),
1228 LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
1229 LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
1230 LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
1231 LintId::of(&matches::MATCH_AS_REF),
1232 LintId::of(&matches::MATCH_BOOL),
1233 LintId::of(&matches::MATCH_OVERLAPPING_ARM),
1234 LintId::of(&matches::MATCH_REF_PATS),
1235 LintId::of(&matches::MATCH_SINGLE_BINDING),
1236 LintId::of(&matches::MATCH_WILD_ERR_ARM),
1237 LintId::of(&matches::SINGLE_MATCH),
1238 LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
1239 LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
1240 LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
1241 LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
1242 LintId::of(&mem_replace::MEM_REPLACE_WITH_UNINIT),
1243 LintId::of(&methods::CHARS_LAST_CMP),
1244 LintId::of(&methods::CHARS_NEXT_CMP),
1245 LintId::of(&methods::CLONE_DOUBLE_REF),
1246 LintId::of(&methods::CLONE_ON_COPY),
1247 LintId::of(&methods::EXPECT_FUN_CALL),
1248 LintId::of(&methods::FILTER_NEXT),
1249 LintId::of(&methods::FLAT_MAP_IDENTITY),
1250 LintId::of(&methods::INEFFICIENT_TO_STRING),
1251 LintId::of(&methods::INTO_ITER_ON_REF),
1252 LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
1253 LintId::of(&methods::ITER_CLONED_COLLECT),
1254 LintId::of(&methods::ITER_NTH),
1255 LintId::of(&methods::ITER_NTH_ZERO),
1256 LintId::of(&methods::ITER_SKIP_NEXT),
1257 LintId::of(&methods::MANUAL_SATURATING_ARITHMETIC),
1258 LintId::of(&methods::NEW_RET_NO_SELF),
1259 LintId::of(&methods::OK_EXPECT),
1260 LintId::of(&methods::OPTION_AND_THEN_SOME),
1261 LintId::of(&methods::OPTION_AS_REF_DEREF),
1262 LintId::of(&methods::OPTION_MAP_OR_NONE),
1263 LintId::of(&methods::OR_FUN_CALL),
1264 LintId::of(&methods::SEARCH_IS_SOME),
1265 LintId::of(&methods::SHOULD_IMPLEMENT_TRAIT),
1266 LintId::of(&methods::SINGLE_CHAR_PATTERN),
1267 LintId::of(&methods::SKIP_WHILE_NEXT),
1268 LintId::of(&methods::STRING_EXTEND_CHARS),
1269 LintId::of(&methods::SUSPICIOUS_MAP),
1270 LintId::of(&methods::TEMPORARY_CSTRING_AS_PTR),
1271 LintId::of(&methods::UNINIT_ASSUMED_INIT),
1272 LintId::of(&methods::UNNECESSARY_FILTER_MAP),
1273 LintId::of(&methods::UNNECESSARY_FOLD),
1274 LintId::of(&methods::USELESS_ASREF),
1275 LintId::of(&methods::WRONG_SELF_CONVENTION),
1276 LintId::of(&methods::ZST_OFFSET),
1277 LintId::of(&minmax::MIN_MAX),
1278 LintId::of(&misc::CMP_NAN),
1279 LintId::of(&misc::CMP_OWNED),
1280 LintId::of(&misc::FLOAT_CMP),
1281 LintId::of(&misc::MODULO_ONE),
1282 LintId::of(&misc::SHORT_CIRCUIT_STATEMENT),
1283 LintId::of(&misc::TOPLEVEL_REF_ARG),
1284 LintId::of(&misc::ZERO_PTR),
1285 LintId::of(&misc_early::BUILTIN_TYPE_SHADOW),
1286 LintId::of(&misc_early::DOUBLE_NEG),
1287 LintId::of(&misc_early::DUPLICATE_UNDERSCORE_ARGUMENT),
1288 LintId::of(&misc_early::MIXED_CASE_HEX_LITERALS),
1289 LintId::of(&misc_early::REDUNDANT_CLOSURE_CALL),
1290 LintId::of(&misc_early::REDUNDANT_PATTERN),
1291 LintId::of(&misc_early::UNNEEDED_WILDCARD_PATTERN),
1292 LintId::of(&misc_early::ZERO_PREFIXED_LITERAL),
1293 LintId::of(&mut_key::MUTABLE_KEY_TYPE),
1294 LintId::of(&mut_reference::UNNECESSARY_MUT_PASSED),
1295 LintId::of(&mutex_atomic::MUTEX_ATOMIC),
1296 LintId::of(&needless_bool::BOOL_COMPARISON),
1297 LintId::of(&needless_bool::NEEDLESS_BOOL),
1298 LintId::of(&needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
1299 LintId::of(&needless_update::NEEDLESS_UPDATE),
1300 LintId::of(&neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
1301 LintId::of(&neg_multiply::NEG_MULTIPLY),
1302 LintId::of(&new_without_default::NEW_WITHOUT_DEFAULT),
1303 LintId::of(&no_effect::NO_EFFECT),
1304 LintId::of(&no_effect::UNNECESSARY_OPERATION),
1305 LintId::of(&non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
1306 LintId::of(&non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
1307 LintId::of(&non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
1308 LintId::of(&non_expressive_names::MANY_SINGLE_CHAR_NAMES),
1309 LintId::of(&open_options::NONSENSICAL_OPEN_OPTIONS),
1310 LintId::of(&option_env_unwrap::OPTION_ENV_UNWRAP),
1311 LintId::of(&overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL),
1312 LintId::of(&panic_unimplemented::PANIC_PARAMS),
1313 LintId::of(&partialeq_ne_impl::PARTIALEQ_NE_IMPL),
1314 LintId::of(&precedence::PRECEDENCE),
1315 LintId::of(&ptr::CMP_NULL),
1316 LintId::of(&ptr::MUT_FROM_REF),
1317 LintId::of(&ptr::PTR_ARG),
1318 LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
1319 LintId::of(&question_mark::QUESTION_MARK),
1320 LintId::of(&ranges::RANGE_MINUS_ONE),
1321 LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
1322 LintId::of(&redundant_clone::REDUNDANT_CLONE),
1323 LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
1324 LintId::of(&redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING),
1325 LintId::of(&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
1326 LintId::of(&reference::DEREF_ADDROF),
1327 LintId::of(&reference::REF_IN_DEREF),
1328 LintId::of(®ex::INVALID_REGEX),
1329 LintId::of(®ex::REGEX_MACRO),
1330 LintId::of(®ex::TRIVIAL_REGEX),
1331 LintId::of(&returns::LET_AND_RETURN),
1332 LintId::of(&returns::NEEDLESS_RETURN),
1333 LintId::of(&returns::UNUSED_UNIT),
1334 LintId::of(&serde_api::SERDE_API_MISUSE),
1335 LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
1336 LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
1337 LintId::of(&strings::STRING_LIT_AS_BYTES),
1338 LintId::of(&suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1339 LintId::of(&suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1340 LintId::of(&swap::ALMOST_SWAPPED),
1341 LintId::of(&swap::MANUAL_SWAP),
1342 LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
1343 LintId::of(&temporary_assignment::TEMPORARY_ASSIGNMENT),
1344 LintId::of(&to_digit_is_some::TO_DIGIT_IS_SOME),
1345 LintId::of(&transmute::CROSSPOINTER_TRANSMUTE),
1346 LintId::of(&transmute::TRANSMUTE_BYTES_TO_STR),
1347 LintId::of(&transmute::TRANSMUTE_FLOAT_TO_INT),
1348 LintId::of(&transmute::TRANSMUTE_INT_TO_BOOL),
1349 LintId::of(&transmute::TRANSMUTE_INT_TO_CHAR),
1350 LintId::of(&transmute::TRANSMUTE_INT_TO_FLOAT),
1351 LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
1352 LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
1353 LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
1354 LintId::of(&transmute::USELESS_TRANSMUTE),
1355 LintId::of(&transmute::WRONG_TRANSMUTE),
1356 LintId::of(&transmuting_null::TRANSMUTING_NULL),
1357 LintId::of(&trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF),
1358 LintId::of(&try_err::TRY_ERR),
1359 LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
1360 LintId::of(&types::BORROWED_BOX),
1361 LintId::of(&types::BOX_VEC),
1362 LintId::of(&types::CAST_PTR_ALIGNMENT),
1363 LintId::of(&types::CAST_REF_TO_MUT),
1364 LintId::of(&types::CHAR_LIT_AS_U8),
1365 LintId::of(&types::FN_TO_NUMERIC_CAST),
1366 LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
1367 LintId::of(&types::IMPLICIT_HASHER),
1368 LintId::of(&types::LET_UNIT_VALUE),
1369 LintId::of(&types::OPTION_OPTION),
1370 LintId::of(&types::TYPE_COMPLEXITY),
1371 LintId::of(&types::UNIT_ARG),
1372 LintId::of(&types::UNIT_CMP),
1373 LintId::of(&types::UNNECESSARY_CAST),
1374 LintId::of(&types::VEC_BOX),
1375 LintId::of(&unicode::ZERO_WIDTH_SPACE),
1376 LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
1377 LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
1378 LintId::of(&unwrap::PANICKING_UNWRAP),
1379 LintId::of(&unwrap::UNNECESSARY_UNWRAP),
1380 LintId::of(&vec::USELESS_VEC),
1381 LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
1382 LintId::of(&write::PRINTLN_EMPTY_STRING),
1383 LintId::of(&write::PRINT_LITERAL),
1384 LintId::of(&write::PRINT_WITH_NEWLINE),
1385 LintId::of(&write::WRITELN_EMPTY_STRING),
1386 LintId::of(&write::WRITE_LITERAL),
1387 LintId::of(&write::WRITE_WITH_NEWLINE),
1388 LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
1391 store.register_group(true, "clippy::style", Some("clippy_style"), vec![
1392 LintId::of(&assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
1393 LintId::of(&assign_ops::ASSIGN_OP_PATTERN),
1394 LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
1395 LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1396 LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1397 LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR),
1398 LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT),
1399 LintId::of(&collapsible_if::COLLAPSIBLE_IF),
1400 LintId::of(&comparison_chain::COMPARISON_CHAIN),
1401 LintId::of(&doc::MISSING_SAFETY_DOC),
1402 LintId::of(&doc::NEEDLESS_DOCTEST_MAIN),
1403 LintId::of(&enum_variants::ENUM_VARIANT_NAMES),
1404 LintId::of(&enum_variants::MODULE_INCEPTION),
1405 LintId::of(&eq_op::OP_REF),
1406 LintId::of(&eta_reduction::REDUNDANT_CLOSURE),
1407 LintId::of(&float_literal::EXCESSIVE_PRECISION),
1408 LintId::of(&formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1409 LintId::of(&formatting::SUSPICIOUS_ELSE_FORMATTING),
1410 LintId::of(&formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
1411 LintId::of(&functions::DOUBLE_MUST_USE),
1412 LintId::of(&functions::MUST_USE_UNIT),
1413 LintId::of(&if_let_some_result::IF_LET_SOME_RESULT),
1414 LintId::of(&inherent_to_string::INHERENT_TO_STRING),
1415 LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
1416 LintId::of(&len_zero::LEN_ZERO),
1417 LintId::of(&let_if_seq::USELESS_LET_IF_SEQ),
1418 LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
1419 LintId::of(&literal_representation::UNREADABLE_LITERAL),
1420 LintId::of(&loops::EMPTY_LOOP),
1421 LintId::of(&loops::FOR_KV_MAP),
1422 LintId::of(&loops::NEEDLESS_RANGE_LOOP),
1423 LintId::of(&loops::WHILE_LET_ON_ITERATOR),
1424 LintId::of(&main_recursion::MAIN_RECURSION),
1425 LintId::of(&map_clone::MAP_CLONE),
1426 LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
1427 LintId::of(&matches::MATCH_BOOL),
1428 LintId::of(&matches::MATCH_OVERLAPPING_ARM),
1429 LintId::of(&matches::MATCH_REF_PATS),
1430 LintId::of(&matches::MATCH_WILD_ERR_ARM),
1431 LintId::of(&matches::SINGLE_MATCH),
1432 LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
1433 LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
1434 LintId::of(&methods::CHARS_LAST_CMP),
1435 LintId::of(&methods::CHARS_NEXT_CMP),
1436 LintId::of(&methods::INTO_ITER_ON_REF),
1437 LintId::of(&methods::ITER_CLONED_COLLECT),
1438 LintId::of(&methods::ITER_NTH_ZERO),
1439 LintId::of(&methods::ITER_SKIP_NEXT),
1440 LintId::of(&methods::MANUAL_SATURATING_ARITHMETIC),
1441 LintId::of(&methods::NEW_RET_NO_SELF),
1442 LintId::of(&methods::OK_EXPECT),
1443 LintId::of(&methods::OPTION_MAP_OR_NONE),
1444 LintId::of(&methods::SHOULD_IMPLEMENT_TRAIT),
1445 LintId::of(&methods::STRING_EXTEND_CHARS),
1446 LintId::of(&methods::UNNECESSARY_FOLD),
1447 LintId::of(&methods::WRONG_SELF_CONVENTION),
1448 LintId::of(&misc::TOPLEVEL_REF_ARG),
1449 LintId::of(&misc::ZERO_PTR),
1450 LintId::of(&misc_early::BUILTIN_TYPE_SHADOW),
1451 LintId::of(&misc_early::DOUBLE_NEG),
1452 LintId::of(&misc_early::DUPLICATE_UNDERSCORE_ARGUMENT),
1453 LintId::of(&misc_early::MIXED_CASE_HEX_LITERALS),
1454 LintId::of(&misc_early::REDUNDANT_PATTERN),
1455 LintId::of(&mut_reference::UNNECESSARY_MUT_PASSED),
1456 LintId::of(&neg_multiply::NEG_MULTIPLY),
1457 LintId::of(&new_without_default::NEW_WITHOUT_DEFAULT),
1458 LintId::of(&non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
1459 LintId::of(&non_expressive_names::MANY_SINGLE_CHAR_NAMES),
1460 LintId::of(&panic_unimplemented::PANIC_PARAMS),
1461 LintId::of(&ptr::CMP_NULL),
1462 LintId::of(&ptr::PTR_ARG),
1463 LintId::of(&question_mark::QUESTION_MARK),
1464 LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
1465 LintId::of(&redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING),
1466 LintId::of(&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
1467 LintId::of(®ex::REGEX_MACRO),
1468 LintId::of(®ex::TRIVIAL_REGEX),
1469 LintId::of(&returns::LET_AND_RETURN),
1470 LintId::of(&returns::NEEDLESS_RETURN),
1471 LintId::of(&returns::UNUSED_UNIT),
1472 LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
1473 LintId::of(&strings::STRING_LIT_AS_BYTES),
1474 LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
1475 LintId::of(&to_digit_is_some::TO_DIGIT_IS_SOME),
1476 LintId::of(&try_err::TRY_ERR),
1477 LintId::of(&types::FN_TO_NUMERIC_CAST),
1478 LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
1479 LintId::of(&types::IMPLICIT_HASHER),
1480 LintId::of(&types::LET_UNIT_VALUE),
1481 LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
1482 LintId::of(&write::PRINTLN_EMPTY_STRING),
1483 LintId::of(&write::PRINT_LITERAL),
1484 LintId::of(&write::PRINT_WITH_NEWLINE),
1485 LintId::of(&write::WRITELN_EMPTY_STRING),
1486 LintId::of(&write::WRITE_LITERAL),
1487 LintId::of(&write::WRITE_WITH_NEWLINE),
1490 store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![
1491 LintId::of(&assign_ops::MISREFACTORED_ASSIGN_OP),
1492 LintId::of(&attrs::DEPRECATED_CFG_ATTR),
1493 LintId::of(&booleans::NONMINIMAL_BOOL),
1494 LintId::of(&cognitive_complexity::COGNITIVE_COMPLEXITY),
1495 LintId::of(&double_comparison::DOUBLE_COMPARISONS),
1496 LintId::of(&double_parens::DOUBLE_PARENS),
1497 LintId::of(&duration_subsec::DURATION_SUBSEC),
1498 LintId::of(&eval_order_dependence::DIVERGING_SUB_EXPRESSION),
1499 LintId::of(&eval_order_dependence::EVAL_ORDER_DEPENDENCE),
1500 LintId::of(&explicit_write::EXPLICIT_WRITE),
1501 LintId::of(&format::USELESS_FORMAT),
1502 LintId::of(&functions::TOO_MANY_ARGUMENTS),
1503 LintId::of(&get_last_with_len::GET_LAST_WITH_LEN),
1504 LintId::of(&identity_conversion::IDENTITY_CONVERSION),
1505 LintId::of(&identity_op::IDENTITY_OP),
1506 LintId::of(&int_plus_one::INT_PLUS_ONE),
1507 LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
1508 LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
1509 LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
1510 LintId::of(&loops::MUT_RANGE_BOUND),
1511 LintId::of(&loops::WHILE_LET_LOOP),
1512 LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
1513 LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
1514 LintId::of(&matches::MATCH_AS_REF),
1515 LintId::of(&matches::MATCH_SINGLE_BINDING),
1516 LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
1517 LintId::of(&methods::CLONE_ON_COPY),
1518 LintId::of(&methods::FILTER_NEXT),
1519 LintId::of(&methods::FLAT_MAP_IDENTITY),
1520 LintId::of(&methods::OPTION_AND_THEN_SOME),
1521 LintId::of(&methods::OPTION_AS_REF_DEREF),
1522 LintId::of(&methods::SEARCH_IS_SOME),
1523 LintId::of(&methods::SKIP_WHILE_NEXT),
1524 LintId::of(&methods::SUSPICIOUS_MAP),
1525 LintId::of(&methods::UNNECESSARY_FILTER_MAP),
1526 LintId::of(&methods::USELESS_ASREF),
1527 LintId::of(&misc::SHORT_CIRCUIT_STATEMENT),
1528 LintId::of(&misc_early::REDUNDANT_CLOSURE_CALL),
1529 LintId::of(&misc_early::UNNEEDED_WILDCARD_PATTERN),
1530 LintId::of(&misc_early::ZERO_PREFIXED_LITERAL),
1531 LintId::of(&needless_bool::BOOL_COMPARISON),
1532 LintId::of(&needless_bool::NEEDLESS_BOOL),
1533 LintId::of(&needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
1534 LintId::of(&needless_update::NEEDLESS_UPDATE),
1535 LintId::of(&neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
1536 LintId::of(&no_effect::NO_EFFECT),
1537 LintId::of(&no_effect::UNNECESSARY_OPERATION),
1538 LintId::of(&overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL),
1539 LintId::of(&partialeq_ne_impl::PARTIALEQ_NE_IMPL),
1540 LintId::of(&precedence::PRECEDENCE),
1541 LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
1542 LintId::of(&ranges::RANGE_MINUS_ONE),
1543 LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
1544 LintId::of(&reference::DEREF_ADDROF),
1545 LintId::of(&reference::REF_IN_DEREF),
1546 LintId::of(&swap::MANUAL_SWAP),
1547 LintId::of(&temporary_assignment::TEMPORARY_ASSIGNMENT),
1548 LintId::of(&transmute::CROSSPOINTER_TRANSMUTE),
1549 LintId::of(&transmute::TRANSMUTE_BYTES_TO_STR),
1550 LintId::of(&transmute::TRANSMUTE_FLOAT_TO_INT),
1551 LintId::of(&transmute::TRANSMUTE_INT_TO_BOOL),
1552 LintId::of(&transmute::TRANSMUTE_INT_TO_CHAR),
1553 LintId::of(&transmute::TRANSMUTE_INT_TO_FLOAT),
1554 LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
1555 LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
1556 LintId::of(&transmute::USELESS_TRANSMUTE),
1557 LintId::of(&types::BORROWED_BOX),
1558 LintId::of(&types::CHAR_LIT_AS_U8),
1559 LintId::of(&types::OPTION_OPTION),
1560 LintId::of(&types::TYPE_COMPLEXITY),
1561 LintId::of(&types::UNIT_ARG),
1562 LintId::of(&types::UNNECESSARY_CAST),
1563 LintId::of(&types::VEC_BOX),
1564 LintId::of(&unwrap::UNNECESSARY_UNWRAP),
1565 LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
1566 LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
1569 store.register_group(true, "clippy::correctness", Some("clippy_correctness"), vec![
1570 LintId::of(&approx_const::APPROX_CONSTANT),
1571 LintId::of(&atomic_ordering::INVALID_ATOMIC_ORDERING),
1572 LintId::of(&attrs::DEPRECATED_SEMVER),
1573 LintId::of(&attrs::USELESS_ATTRIBUTE),
1574 LintId::of(&bit_mask::BAD_BIT_MASK),
1575 LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
1576 LintId::of(&booleans::LOGIC_BUG),
1577 LintId::of(&copies::IFS_SAME_COND),
1578 LintId::of(&copies::IF_SAME_THEN_ELSE),
1579 LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1580 LintId::of(&drop_bounds::DROP_BOUNDS),
1581 LintId::of(&drop_forget_ref::DROP_COPY),
1582 LintId::of(&drop_forget_ref::DROP_REF),
1583 LintId::of(&drop_forget_ref::FORGET_COPY),
1584 LintId::of(&drop_forget_ref::FORGET_REF),
1585 LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
1586 LintId::of(&eq_op::EQ_OP),
1587 LintId::of(&erasing_op::ERASING_OP),
1588 LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
1589 LintId::of(&functions::NOT_UNSAFE_PTR_ARG_DEREF),
1590 LintId::of(&indexing_slicing::OUT_OF_BOUNDS_INDEXING),
1591 LintId::of(&infinite_iter::INFINITE_ITER),
1592 LintId::of(&inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
1593 LintId::of(&inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
1594 LintId::of(&let_underscore::LET_UNDERSCORE_LOCK),
1595 LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1596 LintId::of(&loops::FOR_LOOP_OVER_OPTION),
1597 LintId::of(&loops::FOR_LOOP_OVER_RESULT),
1598 LintId::of(&loops::ITER_NEXT_LOOP),
1599 LintId::of(&loops::NEVER_LOOP),
1600 LintId::of(&loops::REVERSE_RANGE_LOOP),
1601 LintId::of(&loops::WHILE_IMMUTABLE_CONDITION),
1602 LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
1603 LintId::of(&mem_replace::MEM_REPLACE_WITH_UNINIT),
1604 LintId::of(&methods::CLONE_DOUBLE_REF),
1605 LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
1606 LintId::of(&methods::TEMPORARY_CSTRING_AS_PTR),
1607 LintId::of(&methods::UNINIT_ASSUMED_INIT),
1608 LintId::of(&methods::ZST_OFFSET),
1609 LintId::of(&minmax::MIN_MAX),
1610 LintId::of(&misc::CMP_NAN),
1611 LintId::of(&misc::FLOAT_CMP),
1612 LintId::of(&misc::MODULO_ONE),
1613 LintId::of(&mut_key::MUTABLE_KEY_TYPE),
1614 LintId::of(&non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
1615 LintId::of(&non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
1616 LintId::of(&open_options::NONSENSICAL_OPEN_OPTIONS),
1617 LintId::of(&option_env_unwrap::OPTION_ENV_UNWRAP),
1618 LintId::of(&ptr::MUT_FROM_REF),
1619 LintId::of(®ex::INVALID_REGEX),
1620 LintId::of(&serde_api::SERDE_API_MISUSE),
1621 LintId::of(&suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1622 LintId::of(&suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1623 LintId::of(&swap::ALMOST_SWAPPED),
1624 LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
1625 LintId::of(&transmute::WRONG_TRANSMUTE),
1626 LintId::of(&transmuting_null::TRANSMUTING_NULL),
1627 LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
1628 LintId::of(&types::CAST_PTR_ALIGNMENT),
1629 LintId::of(&types::CAST_REF_TO_MUT),
1630 LintId::of(&types::UNIT_CMP),
1631 LintId::of(&unicode::ZERO_WIDTH_SPACE),
1632 LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
1633 LintId::of(&unwrap::PANICKING_UNWRAP),
1636 store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
1637 LintId::of(&bytecount::NAIVE_BYTECOUNT),
1638 LintId::of(&entry::MAP_ENTRY),
1639 LintId::of(&escape::BOXED_LOCAL),
1640 LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
1641 LintId::of(&loops::MANUAL_MEMCPY),
1642 LintId::of(&loops::NEEDLESS_COLLECT),
1643 LintId::of(&methods::EXPECT_FUN_CALL),
1644 LintId::of(&methods::INEFFICIENT_TO_STRING),
1645 LintId::of(&methods::ITER_NTH),
1646 LintId::of(&methods::OR_FUN_CALL),
1647 LintId::of(&methods::SINGLE_CHAR_PATTERN),
1648 LintId::of(&misc::CMP_OWNED),
1649 LintId::of(&mutex_atomic::MUTEX_ATOMIC),
1650 LintId::of(&redundant_clone::REDUNDANT_CLONE),
1651 LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
1652 LintId::of(&trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF),
1653 LintId::of(&types::BOX_VEC),
1654 LintId::of(&vec::USELESS_VEC),
1657 store.register_group(true, "clippy::cargo", Some("clippy_cargo"), vec![
1658 LintId::of(&cargo_common_metadata::CARGO_COMMON_METADATA),
1659 LintId::of(&multiple_crate_versions::MULTIPLE_CRATE_VERSIONS),
1660 LintId::of(&wildcard_dependencies::WILDCARD_DEPENDENCIES),
1663 store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
1664 LintId::of(&attrs::EMPTY_LINE_AFTER_OUTER_ATTR),
1665 LintId::of(&fallible_impl_from::FALLIBLE_IMPL_FROM),
1666 LintId::of(&floating_point_arithmetic::IMPRECISE_FLOPS),
1667 LintId::of(&floating_point_arithmetic::SUBOPTIMAL_FLOPS),
1668 LintId::of(&missing_const_for_fn::MISSING_CONST_FOR_FN),
1669 LintId::of(&mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
1670 LintId::of(&mutex_atomic::MUTEX_INTEGER),
1671 LintId::of(&needless_borrow::NEEDLESS_BORROW),
1672 LintId::of(&path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),
1673 LintId::of(&use_self::USE_SELF),
1678 fn register_removed_non_tool_lints(store: &mut rustc_lint::LintStore) {
1679 store.register_removed(
1681 "`assert!()` will be more flexible with RFC 2011",
1683 store.register_removed(
1684 "extend_from_slice",
1685 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
1687 store.register_removed(
1688 "range_step_by_zero",
1689 "`iterator.step_by(0)` panics nowadays",
1691 store.register_removed(
1692 "unstable_as_slice",
1693 "`Vec::as_slice` has been stabilized in 1.7",
1695 store.register_removed(
1696 "unstable_as_mut_slice",
1697 "`Vec::as_mut_slice` has been stabilized in 1.7",
1699 store.register_removed(
1701 "using `str::to_string` is common even today and specialization will likely happen soon",
1703 store.register_removed(
1705 "using `string::to_string` is common even today and specialization will likely happen soon",
1707 store.register_removed(
1708 "misaligned_transmute",
1709 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
1711 store.register_removed(
1713 "using compound assignment operators (e.g., `+=`) is harmless",
1715 store.register_removed(
1716 "if_let_redundant_pattern_matching",
1717 "this lint has been changed to redundant_pattern_matching",
1719 store.register_removed(
1720 "unsafe_vector_initialization",
1721 "the replacement suggested by this lint had substantially different behavior",
1725 /// Register renamed lints.
1727 /// Used in `./src/driver.rs`.
1728 pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
1729 ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1730 ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
1731 ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
1732 ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
1735 // only exists to let the dogfood integration test works.
1736 // Don't run clippy as an executable directly
1739 panic!("Please use the cargo-clippy executable");