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