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