]> git.lizzy.rs Git - rust.git/blob - clippy_lints/src/lib.rs
Auto merge of #4938 - flip1995:rustup, r=flip1995
[rust.git] / clippy_lints / src / lib.rs
1 // error-pattern:cargo-clippy
2
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)]
15
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)]
21 extern crate rustc;
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)]
43 extern crate syntax;
44 #[allow(unused_extern_crates)]
45 extern crate syntax_pos;
46
47 use rustc::lint::{self, LintId};
48 use rustc::session::Session;
49 use rustc_data_structures::fx::FxHashSet;
50 use toml;
51
52 /// Macro used to declare a Clippy lint.
53 ///
54 /// Every lint declaration consists of 4 parts:
55 ///
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.
62 ///
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
65 /// README.md.
66 ///
67 /// # Example
68 ///
69 /// ```
70 /// # #![feature(rustc_private)]
71 /// # #[allow(unused_extern_crates)]
72 /// # extern crate rustc;
73 /// # #[allow(unused_extern_crates)]
74 /// # extern crate rustc_session;
75 /// # #[macro_use]
76 /// # use clippy_lints::declare_clippy_lint;
77 /// use rustc_session::declare_tool_lint;
78 ///
79 /// declare_clippy_lint! {
80 ///     /// **What it does:** Checks for ... (describe what the lint matches).
81 ///     ///
82 ///     /// **Why is this bad?** Supply the reason for linting the code.
83 ///     ///
84 ///     /// **Known problems:** None. (Or describe where it could go wrong.)
85 ///     ///
86 ///     /// **Example:**
87 ///     ///
88 ///     /// ```rust
89 ///     /// // Bad
90 ///     /// Insert a short example of code that triggers the lint
91 ///     ///
92 ///     /// // Good
93 ///     /// Insert a short example of improved code that doesn't trigger the lint
94 ///     /// ```
95 ///     pub LINT_NAME,
96 ///     pedantic,
97 ///     "description"
98 /// }
99 /// ```
100 /// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
101 #[macro_export]
102 macro_rules! declare_clippy_lint {
103     { $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
104         declare_tool_lint! {
105             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
106         }
107     };
108     { $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
109         declare_tool_lint! {
110             $(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
111         }
112     };
113     { $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
114         declare_tool_lint! {
115             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
116         }
117     };
118     { $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
119         declare_tool_lint! {
120             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
121         }
122     };
123     { $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
124         declare_tool_lint! {
125             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
126         }
127     };
128     { $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
129         declare_tool_lint! {
130             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
131         }
132     };
133     { $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
134         declare_tool_lint! {
135             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
136         }
137     };
138     { $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
139         declare_tool_lint! {
140             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
141         }
142     };
143     { $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
144         declare_tool_lint! {
145             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
146         }
147     };
148     { $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
149         declare_tool_lint! {
150             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
151         }
152     };
153 }
154
155 mod consts;
156 #[macro_use]
157 mod utils;
158
159 // begin lints modules, do not remove this comment, it’s used in `update_lints`
160 pub mod approx_const;
161 pub mod arithmetic;
162 pub mod as_conversions;
163 pub mod assertions_on_constants;
164 pub mod assign_ops;
165 pub mod attrs;
166 pub mod bit_mask;
167 pub mod blacklisted_name;
168 pub mod block_in_if_condition;
169 pub mod booleans;
170 pub mod bytecount;
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;
176 pub mod copies;
177 pub mod copy_iterator;
178 pub mod dbg_macro;
179 pub mod default_trait_access;
180 pub mod derive;
181 pub mod doc;
182 pub mod double_comparison;
183 pub mod double_parens;
184 pub mod drop_bounds;
185 pub mod drop_forget_ref;
186 pub mod duration_subsec;
187 pub mod else_if_without_else;
188 pub mod empty_enum;
189 pub mod entry;
190 pub mod enum_clike;
191 pub mod enum_glob_use;
192 pub mod enum_variants;
193 pub mod eq_op;
194 pub mod erasing_op;
195 pub mod escape;
196 pub mod eta_reduction;
197 pub mod eval_order_dependence;
198 pub mod excessive_precision;
199 pub mod exit;
200 pub mod explicit_write;
201 pub mod fallible_impl_from;
202 pub mod format;
203 pub mod formatting;
204 pub mod functions;
205 pub mod get_last_with_len;
206 pub mod identity_conversion;
207 pub mod identity_op;
208 pub mod if_not_else;
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;
221 pub mod len_zero;
222 pub mod let_if_seq;
223 pub mod lifetimes;
224 pub mod literal_representation;
225 pub mod loops;
226 pub mod main_recursion;
227 pub mod map_clone;
228 pub mod map_unit_fn;
229 pub mod matches;
230 pub mod mem_discriminant;
231 pub mod mem_forget;
232 pub mod mem_replace;
233 pub mod methods;
234 pub mod minmax;
235 pub mod misc;
236 pub mod misc_early;
237 pub mod missing_const_for_fn;
238 pub mod missing_doc;
239 pub mod missing_inline;
240 pub mod mul_add;
241 pub mod multiple_crate_versions;
242 pub mod mut_mut;
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;
255 pub mod no_effect;
256 pub mod non_copy_const;
257 pub mod non_expressive_names;
258 pub mod ok_if_let;
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;
264 pub mod precedence;
265 pub mod ptr;
266 pub mod ptr_offset_with_cast;
267 pub mod question_mark;
268 pub mod ranges;
269 pub mod redundant_clone;
270 pub mod redundant_field_names;
271 pub mod redundant_pattern_matching;
272 pub mod redundant_static_lifetimes;
273 pub mod reference;
274 pub mod regex;
275 pub mod replace_consts;
276 pub mod returns;
277 pub mod serde_api;
278 pub mod shadow;
279 pub mod slow_vector_initialization;
280 pub mod strings;
281 pub mod suspicious_trait_impl;
282 pub mod swap;
283 pub mod tabs_in_doc_comments;
284 pub mod temporary_assignment;
285 pub mod to_digit_is_some;
286 pub mod trait_bounds;
287 pub mod transmute;
288 pub mod transmuting_null;
289 pub mod trivially_copy_pass_by_ref;
290 pub mod try_err;
291 pub mod types;
292 pub mod unicode;
293 pub mod unsafe_removed_from_name;
294 pub mod unused_io_amount;
295 pub mod unused_self;
296 pub mod unwrap;
297 pub mod use_self;
298 pub mod vec;
299 pub mod wildcard_dependencies;
300 pub mod write;
301 pub mod zero_div_zero;
302 // end lints modules, do not remove this comment, it’s used in `update_lints`
303
304 pub use crate::utils::conf::Conf;
305
306 mod reexport {
307     crate use syntax::ast::Name;
308 }
309
310 /// Register all pre expansion lints
311 ///
312 /// Pre-expansion lints run before any macro expansion has happened.
313 ///
314 /// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
315 /// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
316 ///
317 /// Used in `./src/driver.rs`.
318 pub fn register_pre_expansion_lints(store: &mut rustc::lint::LintStore, conf: &Conf) {
319     store.register_pre_expansion_pass(|| box write::Write);
320     store.register_pre_expansion_pass(|| box redundant_field_names::RedundantFieldNames);
321     let single_char_binding_names_threshold = conf.single_char_binding_names_threshold;
322     store.register_pre_expansion_pass(move || box non_expressive_names::NonExpressiveNames {
323         single_char_binding_names_threshold,
324     });
325     store.register_pre_expansion_pass(|| box attrs::DeprecatedCfgAttribute);
326     store.register_pre_expansion_pass(|| box dbg_macro::DbgMacro);
327 }
328
329 #[doc(hidden)]
330 pub fn read_conf(args: &[syntax::ast::NestedMetaItem], sess: &Session) -> Conf {
331     match utils::conf::file_from_args(args) {
332         Ok(file_name) => {
333             // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
334             // do not require the file to exist
335             let file_name = if let Some(file_name) = file_name {
336                 Some(file_name)
337             } else {
338                 match utils::conf::lookup_conf_file() {
339                     Ok(path) => path,
340                     Err(error) => {
341                         sess.struct_err(&format!("error finding Clippy's configuration file: {}", error))
342                             .emit();
343                         None
344                     },
345                 }
346             };
347
348             let file_name = file_name.map(|file_name| {
349                 if file_name.is_relative() {
350                     sess.local_crate_source_file
351                         .as_ref()
352                         .and_then(|file| std::path::Path::new(&file).parent().map(std::path::Path::to_path_buf))
353                         .unwrap_or_default()
354                         .join(file_name)
355                 } else {
356                     file_name
357                 }
358             });
359
360             let (conf, errors) = utils::conf::read(file_name.as_ref().map(std::convert::AsRef::as_ref));
361
362             // all conf errors are non-fatal, we just use the default conf in case of error
363             for error in errors {
364                 sess.struct_err(&format!(
365                     "error reading Clippy's configuration file `{}`: {}",
366                     file_name.as_ref().and_then(|p| p.to_str()).unwrap_or(""),
367                     error
368                 ))
369                 .emit();
370             }
371
372             conf
373         },
374         Err((err, span)) => {
375             sess.struct_span_err(span, err)
376                 .span_note(span, "Clippy will use default configuration")
377                 .emit();
378             toml::from_str("").expect("we never error on empty config files")
379         },
380     }
381 }
382
383 /// Register all lints and lint groups with the rustc plugin registry
384 ///
385 /// Used in `./src/driver.rs`.
386 #[allow(clippy::too_many_lines)]
387 #[rustfmt::skip]
388 pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf) {
389     register_removed_non_tool_lints(store);
390
391     // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
392     store.register_removed(
393         "clippy::should_assert_eq",
394         "`assert!()` will be more flexible with RFC 2011",
395     );
396     store.register_removed(
397         "clippy::extend_from_slice",
398         "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
399     );
400     store.register_removed(
401         "clippy::range_step_by_zero",
402         "`iterator.step_by(0)` panics nowadays",
403     );
404     store.register_removed(
405         "clippy::unstable_as_slice",
406         "`Vec::as_slice` has been stabilized in 1.7",
407     );
408     store.register_removed(
409         "clippy::unstable_as_mut_slice",
410         "`Vec::as_mut_slice` has been stabilized in 1.7",
411     );
412     store.register_removed(
413         "clippy::str_to_string",
414         "using `str::to_string` is common even today and specialization will likely happen soon",
415     );
416     store.register_removed(
417         "clippy::string_to_string",
418         "using `string::to_string` is common even today and specialization will likely happen soon",
419     );
420     store.register_removed(
421         "clippy::misaligned_transmute",
422         "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
423     );
424     store.register_removed(
425         "clippy::assign_ops",
426         "using compound assignment operators (e.g., `+=`) is harmless",
427     );
428     store.register_removed(
429         "clippy::if_let_redundant_pattern_matching",
430         "this lint has been changed to redundant_pattern_matching",
431     );
432     store.register_removed(
433         "clippy::unsafe_vector_initialization",
434         "the replacement suggested by this lint had substantially different behavior",
435     );
436     store.register_removed(
437         "clippy::invalid_ref",
438         "superseded by rustc lint `invalid_value`",
439     );
440     store.register_removed(
441         "clippy::unused_collect",
442         "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint",
443     );
444     store.register_removed(
445         "clippy::into_iter_on_array",
446         "this lint has been uplifted to rustc and is now called `array_into_iter`",
447     );
448     store.register_removed(
449         "clippy::unused_label",
450         "this lint has been uplifted to rustc and is now called `unused_labels`",
451     );
452     // end deprecated lints, do not remove this comment, it’s used in `update_lints`
453
454     // begin register lints, do not remove this comment, it’s used in `update_lints`
455     store.register_lints(&[
456         &approx_const::APPROX_CONSTANT,
457         &arithmetic::FLOAT_ARITHMETIC,
458         &arithmetic::INTEGER_ARITHMETIC,
459         &as_conversions::AS_CONVERSIONS,
460         &assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
461         &assign_ops::ASSIGN_OP_PATTERN,
462         &assign_ops::MISREFACTORED_ASSIGN_OP,
463         &attrs::DEPRECATED_CFG_ATTR,
464         &attrs::DEPRECATED_SEMVER,
465         &attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
466         &attrs::INLINE_ALWAYS,
467         &attrs::UNKNOWN_CLIPPY_LINTS,
468         &attrs::USELESS_ATTRIBUTE,
469         &bit_mask::BAD_BIT_MASK,
470         &bit_mask::INEFFECTIVE_BIT_MASK,
471         &bit_mask::VERBOSE_BIT_MASK,
472         &blacklisted_name::BLACKLISTED_NAME,
473         &block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
474         &block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
475         &booleans::LOGIC_BUG,
476         &booleans::NONMINIMAL_BOOL,
477         &bytecount::NAIVE_BYTECOUNT,
478         &cargo_common_metadata::CARGO_COMMON_METADATA,
479         &checked_conversions::CHECKED_CONVERSIONS,
480         &cognitive_complexity::COGNITIVE_COMPLEXITY,
481         &collapsible_if::COLLAPSIBLE_IF,
482         &comparison_chain::COMPARISON_CHAIN,
483         &copies::IFS_SAME_COND,
484         &copies::IF_SAME_THEN_ELSE,
485         &copies::MATCH_SAME_ARMS,
486         &copies::SAME_FUNCTIONS_IN_IF_CONDITION,
487         &copy_iterator::COPY_ITERATOR,
488         &dbg_macro::DBG_MACRO,
489         &default_trait_access::DEFAULT_TRAIT_ACCESS,
490         &derive::DERIVE_HASH_XOR_EQ,
491         &derive::EXPL_IMPL_CLONE_ON_COPY,
492         &doc::DOC_MARKDOWN,
493         &doc::MISSING_ERRORS_DOC,
494         &doc::MISSING_SAFETY_DOC,
495         &doc::NEEDLESS_DOCTEST_MAIN,
496         &double_comparison::DOUBLE_COMPARISONS,
497         &double_parens::DOUBLE_PARENS,
498         &drop_bounds::DROP_BOUNDS,
499         &drop_forget_ref::DROP_COPY,
500         &drop_forget_ref::DROP_REF,
501         &drop_forget_ref::FORGET_COPY,
502         &drop_forget_ref::FORGET_REF,
503         &duration_subsec::DURATION_SUBSEC,
504         &else_if_without_else::ELSE_IF_WITHOUT_ELSE,
505         &empty_enum::EMPTY_ENUM,
506         &entry::MAP_ENTRY,
507         &enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
508         &enum_glob_use::ENUM_GLOB_USE,
509         &enum_variants::ENUM_VARIANT_NAMES,
510         &enum_variants::MODULE_INCEPTION,
511         &enum_variants::MODULE_NAME_REPETITIONS,
512         &enum_variants::PUB_ENUM_VARIANT_NAMES,
513         &eq_op::EQ_OP,
514         &eq_op::OP_REF,
515         &erasing_op::ERASING_OP,
516         &escape::BOXED_LOCAL,
517         &eta_reduction::REDUNDANT_CLOSURE,
518         &eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
519         &eval_order_dependence::DIVERGING_SUB_EXPRESSION,
520         &eval_order_dependence::EVAL_ORDER_DEPENDENCE,
521         &excessive_precision::EXCESSIVE_PRECISION,
522         &exit::EXIT,
523         &explicit_write::EXPLICIT_WRITE,
524         &fallible_impl_from::FALLIBLE_IMPL_FROM,
525         &format::USELESS_FORMAT,
526         &formatting::POSSIBLE_MISSING_COMMA,
527         &formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
528         &formatting::SUSPICIOUS_ELSE_FORMATTING,
529         &formatting::SUSPICIOUS_UNARY_OP_FORMATTING,
530         &functions::DOUBLE_MUST_USE,
531         &functions::MUST_USE_CANDIDATE,
532         &functions::MUST_USE_UNIT,
533         &functions::NOT_UNSAFE_PTR_ARG_DEREF,
534         &functions::TOO_MANY_ARGUMENTS,
535         &functions::TOO_MANY_LINES,
536         &get_last_with_len::GET_LAST_WITH_LEN,
537         &identity_conversion::IDENTITY_CONVERSION,
538         &identity_op::IDENTITY_OP,
539         &if_not_else::IF_NOT_ELSE,
540         &implicit_return::IMPLICIT_RETURN,
541         &indexing_slicing::INDEXING_SLICING,
542         &indexing_slicing::OUT_OF_BOUNDS_INDEXING,
543         &infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
544         &infinite_iter::INFINITE_ITER,
545         &infinite_iter::MAYBE_INFINITE_ITER,
546         &inherent_impl::MULTIPLE_INHERENT_IMPL,
547         &inherent_to_string::INHERENT_TO_STRING,
548         &inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
549         &inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
550         &int_plus_one::INT_PLUS_ONE,
551         &integer_division::INTEGER_DIVISION,
552         &items_after_statements::ITEMS_AFTER_STATEMENTS,
553         &large_enum_variant::LARGE_ENUM_VARIANT,
554         &large_stack_arrays::LARGE_STACK_ARRAYS,
555         &len_zero::LEN_WITHOUT_IS_EMPTY,
556         &len_zero::LEN_ZERO,
557         &let_if_seq::USELESS_LET_IF_SEQ,
558         &lifetimes::EXTRA_UNUSED_LIFETIMES,
559         &lifetimes::NEEDLESS_LIFETIMES,
560         &literal_representation::DECIMAL_LITERAL_REPRESENTATION,
561         &literal_representation::INCONSISTENT_DIGIT_GROUPING,
562         &literal_representation::LARGE_DIGIT_GROUPS,
563         &literal_representation::MISTYPED_LITERAL_SUFFIXES,
564         &literal_representation::UNREADABLE_LITERAL,
565         &loops::EMPTY_LOOP,
566         &loops::EXPLICIT_COUNTER_LOOP,
567         &loops::EXPLICIT_INTO_ITER_LOOP,
568         &loops::EXPLICIT_ITER_LOOP,
569         &loops::FOR_KV_MAP,
570         &loops::FOR_LOOP_OVER_OPTION,
571         &loops::FOR_LOOP_OVER_RESULT,
572         &loops::ITER_NEXT_LOOP,
573         &loops::MANUAL_MEMCPY,
574         &loops::MUT_RANGE_BOUND,
575         &loops::NEEDLESS_COLLECT,
576         &loops::NEEDLESS_RANGE_LOOP,
577         &loops::NEVER_LOOP,
578         &loops::REVERSE_RANGE_LOOP,
579         &loops::WHILE_IMMUTABLE_CONDITION,
580         &loops::WHILE_LET_LOOP,
581         &loops::WHILE_LET_ON_ITERATOR,
582         &main_recursion::MAIN_RECURSION,
583         &map_clone::MAP_CLONE,
584         &map_unit_fn::OPTION_MAP_UNIT_FN,
585         &map_unit_fn::RESULT_MAP_UNIT_FN,
586         &matches::MATCH_AS_REF,
587         &matches::MATCH_BOOL,
588         &matches::MATCH_OVERLAPPING_ARM,
589         &matches::MATCH_REF_PATS,
590         &matches::MATCH_WILD_ERR_ARM,
591         &matches::SINGLE_MATCH,
592         &matches::SINGLE_MATCH_ELSE,
593         &matches::WILDCARD_ENUM_MATCH_ARM,
594         &mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
595         &mem_forget::MEM_FORGET,
596         &mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
597         &mem_replace::MEM_REPLACE_WITH_UNINIT,
598         &methods::CHARS_LAST_CMP,
599         &methods::CHARS_NEXT_CMP,
600         &methods::CLONE_DOUBLE_REF,
601         &methods::CLONE_ON_COPY,
602         &methods::CLONE_ON_REF_PTR,
603         &methods::EXPECT_FUN_CALL,
604         &methods::FILTER_MAP,
605         &methods::FILTER_MAP_NEXT,
606         &methods::FILTER_NEXT,
607         &methods::FIND_MAP,
608         &methods::FLAT_MAP_IDENTITY,
609         &methods::GET_UNWRAP,
610         &methods::INEFFICIENT_TO_STRING,
611         &methods::INTO_ITER_ON_REF,
612         &methods::ITERATOR_STEP_BY_ZERO,
613         &methods::ITER_CLONED_COLLECT,
614         &methods::ITER_NTH,
615         &methods::ITER_SKIP_NEXT,
616         &methods::MANUAL_SATURATING_ARITHMETIC,
617         &methods::MAP_FLATTEN,
618         &methods::NEW_RET_NO_SELF,
619         &methods::OK_EXPECT,
620         &methods::OPTION_AND_THEN_SOME,
621         &methods::OPTION_EXPECT_USED,
622         &methods::OPTION_MAP_OR_NONE,
623         &methods::OPTION_MAP_UNWRAP_OR,
624         &methods::OPTION_MAP_UNWRAP_OR_ELSE,
625         &methods::OPTION_UNWRAP_USED,
626         &methods::OR_FUN_CALL,
627         &methods::RESULT_EXPECT_USED,
628         &methods::RESULT_MAP_UNWRAP_OR_ELSE,
629         &methods::RESULT_UNWRAP_USED,
630         &methods::SEARCH_IS_SOME,
631         &methods::SHOULD_IMPLEMENT_TRAIT,
632         &methods::SINGLE_CHAR_PATTERN,
633         &methods::STRING_EXTEND_CHARS,
634         &methods::SUSPICIOUS_MAP,
635         &methods::TEMPORARY_CSTRING_AS_PTR,
636         &methods::UNINIT_ASSUMED_INIT,
637         &methods::UNNECESSARY_FILTER_MAP,
638         &methods::UNNECESSARY_FOLD,
639         &methods::USELESS_ASREF,
640         &methods::WRONG_PUB_SELF_CONVENTION,
641         &methods::WRONG_SELF_CONVENTION,
642         &methods::ZST_OFFSET,
643         &minmax::MIN_MAX,
644         &misc::CMP_NAN,
645         &misc::CMP_OWNED,
646         &misc::FLOAT_CMP,
647         &misc::FLOAT_CMP_CONST,
648         &misc::MODULO_ONE,
649         &misc::SHORT_CIRCUIT_STATEMENT,
650         &misc::TOPLEVEL_REF_ARG,
651         &misc::USED_UNDERSCORE_BINDING,
652         &misc::ZERO_PTR,
653         &misc_early::BUILTIN_TYPE_SHADOW,
654         &misc_early::DOUBLE_NEG,
655         &misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
656         &misc_early::MIXED_CASE_HEX_LITERALS,
657         &misc_early::REDUNDANT_CLOSURE_CALL,
658         &misc_early::REDUNDANT_PATTERN,
659         &misc_early::UNNEEDED_FIELD_PATTERN,
660         &misc_early::UNNEEDED_WILDCARD_PATTERN,
661         &misc_early::UNSEPARATED_LITERAL_SUFFIX,
662         &misc_early::ZERO_PREFIXED_LITERAL,
663         &missing_const_for_fn::MISSING_CONST_FOR_FN,
664         &missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
665         &missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
666         &mul_add::MANUAL_MUL_ADD,
667         &multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
668         &mut_mut::MUT_MUT,
669         &mut_reference::UNNECESSARY_MUT_PASSED,
670         &mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL,
671         &mutex_atomic::MUTEX_ATOMIC,
672         &mutex_atomic::MUTEX_INTEGER,
673         &needless_bool::BOOL_COMPARISON,
674         &needless_bool::NEEDLESS_BOOL,
675         &needless_borrow::NEEDLESS_BORROW,
676         &needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
677         &needless_continue::NEEDLESS_CONTINUE,
678         &needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
679         &needless_update::NEEDLESS_UPDATE,
680         &neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
681         &neg_multiply::NEG_MULTIPLY,
682         &new_without_default::NEW_WITHOUT_DEFAULT,
683         &no_effect::NO_EFFECT,
684         &no_effect::UNNECESSARY_OPERATION,
685         &non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
686         &non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
687         &non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
688         &non_expressive_names::MANY_SINGLE_CHAR_NAMES,
689         &non_expressive_names::SIMILAR_NAMES,
690         &ok_if_let::IF_LET_SOME_RESULT,
691         &open_options::NONSENSICAL_OPEN_OPTIONS,
692         &overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
693         &panic_unimplemented::PANIC,
694         &panic_unimplemented::PANIC_PARAMS,
695         &panic_unimplemented::TODO,
696         &panic_unimplemented::UNIMPLEMENTED,
697         &panic_unimplemented::UNREACHABLE,
698         &partialeq_ne_impl::PARTIALEQ_NE_IMPL,
699         &path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
700         &precedence::PRECEDENCE,
701         &ptr::CMP_NULL,
702         &ptr::MUT_FROM_REF,
703         &ptr::PTR_ARG,
704         &ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
705         &question_mark::QUESTION_MARK,
706         &ranges::RANGE_MINUS_ONE,
707         &ranges::RANGE_PLUS_ONE,
708         &ranges::RANGE_ZIP_WITH_LEN,
709         &redundant_clone::REDUNDANT_CLONE,
710         &redundant_field_names::REDUNDANT_FIELD_NAMES,
711         &redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
712         &redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
713         &reference::DEREF_ADDROF,
714         &reference::REF_IN_DEREF,
715         &regex::INVALID_REGEX,
716         &regex::REGEX_MACRO,
717         &regex::TRIVIAL_REGEX,
718         &replace_consts::REPLACE_CONSTS,
719         &returns::LET_AND_RETURN,
720         &returns::NEEDLESS_RETURN,
721         &returns::UNUSED_UNIT,
722         &serde_api::SERDE_API_MISUSE,
723         &shadow::SHADOW_REUSE,
724         &shadow::SHADOW_SAME,
725         &shadow::SHADOW_UNRELATED,
726         &slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
727         &strings::STRING_ADD,
728         &strings::STRING_ADD_ASSIGN,
729         &strings::STRING_LIT_AS_BYTES,
730         &suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
731         &suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
732         &swap::ALMOST_SWAPPED,
733         &swap::MANUAL_SWAP,
734         &tabs_in_doc_comments::TABS_IN_DOC_COMMENTS,
735         &temporary_assignment::TEMPORARY_ASSIGNMENT,
736         &to_digit_is_some::TO_DIGIT_IS_SOME,
737         &trait_bounds::TYPE_REPETITION_IN_BOUNDS,
738         &transmute::CROSSPOINTER_TRANSMUTE,
739         &transmute::TRANSMUTE_BYTES_TO_STR,
740         &transmute::TRANSMUTE_FLOAT_TO_INT,
741         &transmute::TRANSMUTE_INT_TO_BOOL,
742         &transmute::TRANSMUTE_INT_TO_CHAR,
743         &transmute::TRANSMUTE_INT_TO_FLOAT,
744         &transmute::TRANSMUTE_PTR_TO_PTR,
745         &transmute::TRANSMUTE_PTR_TO_REF,
746         &transmute::UNSOUND_COLLECTION_TRANSMUTE,
747         &transmute::USELESS_TRANSMUTE,
748         &transmute::WRONG_TRANSMUTE,
749         &transmuting_null::TRANSMUTING_NULL,
750         &trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
751         &try_err::TRY_ERR,
752         &types::ABSURD_EXTREME_COMPARISONS,
753         &types::BORROWED_BOX,
754         &types::BOX_VEC,
755         &types::CAST_LOSSLESS,
756         &types::CAST_POSSIBLE_TRUNCATION,
757         &types::CAST_POSSIBLE_WRAP,
758         &types::CAST_PRECISION_LOSS,
759         &types::CAST_PTR_ALIGNMENT,
760         &types::CAST_REF_TO_MUT,
761         &types::CAST_SIGN_LOSS,
762         &types::CHAR_LIT_AS_U8,
763         &types::FN_TO_NUMERIC_CAST,
764         &types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
765         &types::IMPLICIT_HASHER,
766         &types::INVALID_UPCAST_COMPARISONS,
767         &types::LET_UNIT_VALUE,
768         &types::LINKEDLIST,
769         &types::OPTION_OPTION,
770         &types::TYPE_COMPLEXITY,
771         &types::UNIT_ARG,
772         &types::UNIT_CMP,
773         &types::UNNECESSARY_CAST,
774         &types::VEC_BOX,
775         &unicode::NON_ASCII_LITERAL,
776         &unicode::UNICODE_NOT_NFC,
777         &unicode::ZERO_WIDTH_SPACE,
778         &unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
779         &unused_io_amount::UNUSED_IO_AMOUNT,
780         &unused_self::UNUSED_SELF,
781         &unwrap::PANICKING_UNWRAP,
782         &unwrap::UNNECESSARY_UNWRAP,
783         &use_self::USE_SELF,
784         &vec::USELESS_VEC,
785         &wildcard_dependencies::WILDCARD_DEPENDENCIES,
786         &write::PRINTLN_EMPTY_STRING,
787         &write::PRINT_LITERAL,
788         &write::PRINT_STDOUT,
789         &write::PRINT_WITH_NEWLINE,
790         &write::USE_DEBUG,
791         &write::WRITELN_EMPTY_STRING,
792         &write::WRITE_LITERAL,
793         &write::WRITE_WITH_NEWLINE,
794         &zero_div_zero::ZERO_DIVIDED_BY_ZERO,
795     ]);
796     // end register lints, do not remove this comment, it’s used in `update_lints`
797
798     store.register_late_pass(|| box serde_api::SerdeAPI);
799     store.register_late_pass(|| box utils::internal_lints::CompilerLintFunctions::new());
800     store.register_late_pass(|| box utils::internal_lints::LintWithoutLintPass::default());
801     store.register_late_pass(|| box utils::internal_lints::OuterExpnDataPass);
802     store.register_late_pass(|| box utils::inspector::DeepCodeInspector);
803     store.register_late_pass(|| box utils::author::Author);
804     store.register_late_pass(|| box types::Types);
805     store.register_late_pass(|| box booleans::NonminimalBool);
806     store.register_late_pass(|| box eq_op::EqOp);
807     store.register_late_pass(|| box enum_glob_use::EnumGlobUse);
808     store.register_late_pass(|| box enum_clike::UnportableVariant);
809     store.register_late_pass(|| box excessive_precision::ExcessivePrecision);
810     let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
811     store.register_late_pass(move || box bit_mask::BitMask::new(verbose_bit_mask_threshold));
812     store.register_late_pass(|| box ptr::Ptr);
813     store.register_late_pass(|| box needless_bool::NeedlessBool);
814     store.register_late_pass(|| box needless_bool::BoolComparison);
815     store.register_late_pass(|| box approx_const::ApproxConstant);
816     store.register_late_pass(|| box misc::MiscLints);
817     store.register_late_pass(|| box eta_reduction::EtaReduction);
818     store.register_late_pass(|| box identity_op::IdentityOp);
819     store.register_late_pass(|| box erasing_op::ErasingOp);
820     store.register_late_pass(|| box mut_mut::MutMut);
821     store.register_late_pass(|| box mut_reference::UnnecessaryMutPassed);
822     store.register_late_pass(|| box len_zero::LenZero);
823     store.register_late_pass(|| box attrs::Attributes);
824     store.register_late_pass(|| box block_in_if_condition::BlockInIfCondition);
825     store.register_late_pass(|| box unicode::Unicode);
826     store.register_late_pass(|| box strings::StringAdd);
827     store.register_late_pass(|| box implicit_return::ImplicitReturn);
828     store.register_late_pass(|| box methods::Methods);
829     store.register_late_pass(|| box map_clone::MapClone);
830     store.register_late_pass(|| box shadow::Shadow);
831     store.register_late_pass(|| box types::LetUnitValue);
832     store.register_late_pass(|| box types::UnitCmp);
833     store.register_late_pass(|| box loops::Loops);
834     store.register_late_pass(|| box main_recursion::MainRecursion::default());
835     store.register_late_pass(|| box lifetimes::Lifetimes);
836     store.register_late_pass(|| box entry::HashMapPass);
837     store.register_late_pass(|| box ranges::Ranges);
838     store.register_late_pass(|| box types::Casts);
839     let type_complexity_threshold = conf.type_complexity_threshold;
840     store.register_late_pass(move || box types::TypeComplexity::new(type_complexity_threshold));
841     store.register_late_pass(|| box matches::Matches);
842     store.register_late_pass(|| box minmax::MinMaxPass);
843     store.register_late_pass(|| box open_options::OpenOptions);
844     store.register_late_pass(|| box zero_div_zero::ZeroDiv);
845     store.register_late_pass(|| box mutex_atomic::Mutex);
846     store.register_late_pass(|| box needless_update::NeedlessUpdate);
847     store.register_late_pass(|| box needless_borrow::NeedlessBorrow::default());
848     store.register_late_pass(|| box needless_borrowed_ref::NeedlessBorrowedRef);
849     store.register_late_pass(|| box no_effect::NoEffect);
850     store.register_late_pass(|| box temporary_assignment::TemporaryAssignment);
851     store.register_late_pass(|| box transmute::Transmute);
852     let cognitive_complexity_threshold = conf.cognitive_complexity_threshold;
853     store.register_late_pass(move || box cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold));
854     let too_large_for_stack = conf.too_large_for_stack;
855     store.register_late_pass(move || box escape::BoxedLocal{too_large_for_stack});
856     store.register_late_pass(|| box panic_unimplemented::PanicUnimplemented);
857     store.register_late_pass(|| box strings::StringLitAsBytes);
858     store.register_late_pass(|| box derive::Derive);
859     store.register_late_pass(|| box types::CharLitAsU8);
860     store.register_late_pass(|| box vec::UselessVec);
861     store.register_late_pass(|| box drop_bounds::DropBounds);
862     store.register_late_pass(|| box get_last_with_len::GetLastWithLen);
863     store.register_late_pass(|| box drop_forget_ref::DropForgetRef);
864     store.register_late_pass(|| box empty_enum::EmptyEnum);
865     store.register_late_pass(|| box types::AbsurdExtremeComparisons);
866     store.register_late_pass(|| box types::InvalidUpcastComparisons);
867     store.register_late_pass(|| box regex::Regex::default());
868     store.register_late_pass(|| box copies::CopyAndPaste);
869     store.register_late_pass(|| box copy_iterator::CopyIterator);
870     store.register_late_pass(|| box format::UselessFormat);
871     store.register_late_pass(|| box swap::Swap);
872     store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
873     store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
874     let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
875     store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
876     let too_many_arguments_threshold1 = conf.too_many_arguments_threshold;
877     let too_many_lines_threshold2 = conf.too_many_lines_threshold;
878     store.register_late_pass(move || box functions::Functions::new(too_many_arguments_threshold1, too_many_lines_threshold2));
879     let doc_valid_idents = conf.doc_valid_idents.iter().cloned().collect::<FxHashSet<_>>();
880     store.register_late_pass(move || box doc::DocMarkdown::new(doc_valid_idents.clone()));
881     store.register_late_pass(|| box neg_multiply::NegMultiply);
882     store.register_late_pass(|| box mem_discriminant::MemDiscriminant);
883     store.register_late_pass(|| box mem_forget::MemForget);
884     store.register_late_pass(|| box mem_replace::MemReplace);
885     store.register_late_pass(|| box arithmetic::Arithmetic::default());
886     store.register_late_pass(|| box assign_ops::AssignOps);
887     store.register_late_pass(|| box let_if_seq::LetIfSeq);
888     store.register_late_pass(|| box eval_order_dependence::EvalOrderDependence);
889     store.register_late_pass(|| box missing_doc::MissingDoc::new());
890     store.register_late_pass(|| box missing_inline::MissingInline);
891     store.register_late_pass(|| box ok_if_let::OkIfLet);
892     store.register_late_pass(|| box redundant_pattern_matching::RedundantPatternMatching);
893     store.register_late_pass(|| box partialeq_ne_impl::PartialEqNeImpl);
894     store.register_late_pass(|| box unused_io_amount::UnusedIoAmount);
895     let enum_variant_size_threshold = conf.enum_variant_size_threshold;
896     store.register_late_pass(move || box large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold));
897     store.register_late_pass(|| box explicit_write::ExplicitWrite);
898     store.register_late_pass(|| box needless_pass_by_value::NeedlessPassByValue);
899     let trivially_copy_pass_by_ref = trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
900         conf.trivial_copy_size_limit,
901         &sess.target,
902     );
903     store.register_late_pass(move || box trivially_copy_pass_by_ref);
904     store.register_late_pass(|| box try_err::TryErr);
905     store.register_late_pass(|| box use_self::UseSelf);
906     store.register_late_pass(|| box bytecount::ByteCount);
907     store.register_late_pass(|| box infinite_iter::InfiniteIter);
908     store.register_late_pass(|| box inline_fn_without_body::InlineFnWithoutBody);
909     store.register_late_pass(|| box identity_conversion::IdentityConversion::default());
910     store.register_late_pass(|| box types::ImplicitHasher);
911     store.register_late_pass(|| box fallible_impl_from::FallibleImplFrom);
912     store.register_late_pass(|| box replace_consts::ReplaceConsts);
913     store.register_late_pass(|| box types::UnitArg);
914     store.register_late_pass(|| box double_comparison::DoubleComparisons);
915     store.register_late_pass(|| box question_mark::QuestionMark);
916     store.register_late_pass(|| box suspicious_trait_impl::SuspiciousImpl);
917     store.register_late_pass(|| box map_unit_fn::MapUnit);
918     store.register_late_pass(|| box infallible_destructuring_match::InfallibleDestructingMatch);
919     store.register_late_pass(|| box inherent_impl::MultipleInherentImpl::default());
920     store.register_late_pass(|| box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
921     store.register_late_pass(|| box unwrap::Unwrap);
922     store.register_late_pass(|| box duration_subsec::DurationSubsec);
923     store.register_late_pass(|| box default_trait_access::DefaultTraitAccess);
924     store.register_late_pass(|| box indexing_slicing::IndexingSlicing);
925     store.register_late_pass(|| box non_copy_const::NonCopyConst);
926     store.register_late_pass(|| box ptr_offset_with_cast::PtrOffsetWithCast);
927     store.register_late_pass(|| box redundant_clone::RedundantClone);
928     store.register_late_pass(|| box slow_vector_initialization::SlowVectorInit);
929     store.register_late_pass(|| box types::RefToMut);
930     store.register_late_pass(|| box assertions_on_constants::AssertionsOnConstants);
931     store.register_late_pass(|| box missing_const_for_fn::MissingConstForFn);
932     store.register_late_pass(|| box transmuting_null::TransmutingNull);
933     store.register_late_pass(|| box path_buf_push_overwrite::PathBufPushOverwrite);
934     store.register_late_pass(|| box checked_conversions::CheckedConversions);
935     store.register_late_pass(|| box integer_division::IntegerDivision);
936     store.register_late_pass(|| box inherent_to_string::InherentToString);
937     store.register_late_pass(|| box trait_bounds::TraitBounds);
938     store.register_late_pass(|| box comparison_chain::ComparisonChain);
939     store.register_late_pass(|| box mul_add::MulAddCheck);
940     store.register_early_pass(|| box reference::DerefAddrOf);
941     store.register_early_pass(|| box reference::RefInDeref);
942     store.register_early_pass(|| box double_parens::DoubleParens);
943     store.register_early_pass(|| box unsafe_removed_from_name::UnsafeNameRemoval);
944     store.register_early_pass(|| box if_not_else::IfNotElse);
945     store.register_early_pass(|| box else_if_without_else::ElseIfWithoutElse);
946     store.register_early_pass(|| box int_plus_one::IntPlusOne);
947     store.register_early_pass(|| box formatting::Formatting);
948     store.register_early_pass(|| box misc_early::MiscEarlyLints);
949     store.register_early_pass(|| box returns::Return);
950     store.register_early_pass(|| box collapsible_if::CollapsibleIf);
951     store.register_early_pass(|| box items_after_statements::ItemsAfterStatements);
952     store.register_early_pass(|| box precedence::Precedence);
953     store.register_early_pass(|| box needless_continue::NeedlessContinue);
954     store.register_early_pass(|| box redundant_static_lifetimes::RedundantStaticLifetimes);
955     store.register_early_pass(|| box cargo_common_metadata::CargoCommonMetadata);
956     store.register_early_pass(|| box multiple_crate_versions::MultipleCrateVersions);
957     store.register_early_pass(|| box wildcard_dependencies::WildcardDependencies);
958     store.register_early_pass(|| box literal_representation::LiteralDigitGrouping);
959     let literal_representation_threshold = conf.literal_representation_threshold;
960     store.register_early_pass(move || box literal_representation::DecimalLiteralRepresentation::new(literal_representation_threshold));
961     store.register_early_pass(|| box utils::internal_lints::ClippyLintsInternal);
962     let enum_variant_name_threshold = conf.enum_variant_name_threshold;
963     store.register_early_pass(move || box enum_variants::EnumVariantNames::new(enum_variant_name_threshold));
964     store.register_early_pass(|| box tabs_in_doc_comments::TabsInDocComments);
965     store.register_late_pass(|| box unused_self::UnusedSelf);
966     store.register_late_pass(|| box mutable_debug_assertion::DebugAssertWithMutCall);
967     store.register_late_pass(|| box exit::Exit);
968     store.register_late_pass(|| box to_digit_is_some::ToDigitIsSome);
969     let array_size_threshold = conf.array_size_threshold;
970     store.register_late_pass(move || box large_stack_arrays::LargeStackArrays::new(array_size_threshold));
971     store.register_early_pass(|| box as_conversions::AsConversions);
972     store.register_early_pass(|| box utils::internal_lints::ProduceIce);
973
974     store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
975         LintId::of(&arithmetic::FLOAT_ARITHMETIC),
976         LintId::of(&arithmetic::INTEGER_ARITHMETIC),
977         LintId::of(&as_conversions::AS_CONVERSIONS),
978         LintId::of(&dbg_macro::DBG_MACRO),
979         LintId::of(&else_if_without_else::ELSE_IF_WITHOUT_ELSE),
980         LintId::of(&exit::EXIT),
981         LintId::of(&implicit_return::IMPLICIT_RETURN),
982         LintId::of(&indexing_slicing::INDEXING_SLICING),
983         LintId::of(&inherent_impl::MULTIPLE_INHERENT_IMPL),
984         LintId::of(&integer_division::INTEGER_DIVISION),
985         LintId::of(&literal_representation::DECIMAL_LITERAL_REPRESENTATION),
986         LintId::of(&matches::WILDCARD_ENUM_MATCH_ARM),
987         LintId::of(&mem_forget::MEM_FORGET),
988         LintId::of(&methods::CLONE_ON_REF_PTR),
989         LintId::of(&methods::GET_UNWRAP),
990         LintId::of(&methods::OPTION_EXPECT_USED),
991         LintId::of(&methods::OPTION_UNWRAP_USED),
992         LintId::of(&methods::RESULT_EXPECT_USED),
993         LintId::of(&methods::RESULT_UNWRAP_USED),
994         LintId::of(&methods::WRONG_PUB_SELF_CONVENTION),
995         LintId::of(&misc::FLOAT_CMP_CONST),
996         LintId::of(&missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS),
997         LintId::of(&missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS),
998         LintId::of(&panic_unimplemented::PANIC),
999         LintId::of(&panic_unimplemented::TODO),
1000         LintId::of(&panic_unimplemented::UNIMPLEMENTED),
1001         LintId::of(&panic_unimplemented::UNREACHABLE),
1002         LintId::of(&shadow::SHADOW_REUSE),
1003         LintId::of(&shadow::SHADOW_SAME),
1004         LintId::of(&strings::STRING_ADD),
1005         LintId::of(&write::PRINT_STDOUT),
1006         LintId::of(&write::USE_DEBUG),
1007     ]);
1008
1009     store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
1010         LintId::of(&attrs::INLINE_ALWAYS),
1011         LintId::of(&checked_conversions::CHECKED_CONVERSIONS),
1012         LintId::of(&copies::MATCH_SAME_ARMS),
1013         LintId::of(&copies::SAME_FUNCTIONS_IN_IF_CONDITION),
1014         LintId::of(&copy_iterator::COPY_ITERATOR),
1015         LintId::of(&default_trait_access::DEFAULT_TRAIT_ACCESS),
1016         LintId::of(&derive::EXPL_IMPL_CLONE_ON_COPY),
1017         LintId::of(&doc::DOC_MARKDOWN),
1018         LintId::of(&doc::MISSING_ERRORS_DOC),
1019         LintId::of(&empty_enum::EMPTY_ENUM),
1020         LintId::of(&enum_glob_use::ENUM_GLOB_USE),
1021         LintId::of(&enum_variants::MODULE_NAME_REPETITIONS),
1022         LintId::of(&enum_variants::PUB_ENUM_VARIANT_NAMES),
1023         LintId::of(&eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS),
1024         LintId::of(&functions::MUST_USE_CANDIDATE),
1025         LintId::of(&functions::TOO_MANY_LINES),
1026         LintId::of(&if_not_else::IF_NOT_ELSE),
1027         LintId::of(&infinite_iter::MAYBE_INFINITE_ITER),
1028         LintId::of(&items_after_statements::ITEMS_AFTER_STATEMENTS),
1029         LintId::of(&large_stack_arrays::LARGE_STACK_ARRAYS),
1030         LintId::of(&literal_representation::LARGE_DIGIT_GROUPS),
1031         LintId::of(&loops::EXPLICIT_INTO_ITER_LOOP),
1032         LintId::of(&loops::EXPLICIT_ITER_LOOP),
1033         LintId::of(&matches::SINGLE_MATCH_ELSE),
1034         LintId::of(&methods::FILTER_MAP),
1035         LintId::of(&methods::FILTER_MAP_NEXT),
1036         LintId::of(&methods::FIND_MAP),
1037         LintId::of(&methods::MAP_FLATTEN),
1038         LintId::of(&methods::OPTION_MAP_UNWRAP_OR),
1039         LintId::of(&methods::OPTION_MAP_UNWRAP_OR_ELSE),
1040         LintId::of(&methods::RESULT_MAP_UNWRAP_OR_ELSE),
1041         LintId::of(&misc::USED_UNDERSCORE_BINDING),
1042         LintId::of(&misc_early::UNSEPARATED_LITERAL_SUFFIX),
1043         LintId::of(&mut_mut::MUT_MUT),
1044         LintId::of(&needless_continue::NEEDLESS_CONTINUE),
1045         LintId::of(&needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
1046         LintId::of(&non_expressive_names::SIMILAR_NAMES),
1047         LintId::of(&replace_consts::REPLACE_CONSTS),
1048         LintId::of(&shadow::SHADOW_UNRELATED),
1049         LintId::of(&strings::STRING_ADD_ASSIGN),
1050         LintId::of(&trait_bounds::TYPE_REPETITION_IN_BOUNDS),
1051         LintId::of(&types::CAST_LOSSLESS),
1052         LintId::of(&types::CAST_POSSIBLE_TRUNCATION),
1053         LintId::of(&types::CAST_POSSIBLE_WRAP),
1054         LintId::of(&types::CAST_PRECISION_LOSS),
1055         LintId::of(&types::CAST_SIGN_LOSS),
1056         LintId::of(&types::INVALID_UPCAST_COMPARISONS),
1057         LintId::of(&types::LINKEDLIST),
1058         LintId::of(&unicode::NON_ASCII_LITERAL),
1059         LintId::of(&unicode::UNICODE_NOT_NFC),
1060         LintId::of(&unused_self::UNUSED_SELF),
1061     ]);
1062
1063     store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![
1064         LintId::of(&utils::internal_lints::CLIPPY_LINTS_INTERNAL),
1065         LintId::of(&utils::internal_lints::COMPILER_LINT_FUNCTIONS),
1066         LintId::of(&utils::internal_lints::LINT_WITHOUT_LINT_PASS),
1067         LintId::of(&utils::internal_lints::OUTER_EXPN_EXPN_DATA),
1068         LintId::of(&utils::internal_lints::PRODUCE_ICE),
1069     ]);
1070
1071     store.register_group(true, "clippy::all", Some("clippy"), vec![
1072         LintId::of(&approx_const::APPROX_CONSTANT),
1073         LintId::of(&assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
1074         LintId::of(&assign_ops::ASSIGN_OP_PATTERN),
1075         LintId::of(&assign_ops::MISREFACTORED_ASSIGN_OP),
1076         LintId::of(&attrs::DEPRECATED_CFG_ATTR),
1077         LintId::of(&attrs::DEPRECATED_SEMVER),
1078         LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
1079         LintId::of(&attrs::USELESS_ATTRIBUTE),
1080         LintId::of(&bit_mask::BAD_BIT_MASK),
1081         LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
1082         LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1083         LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1084         LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR),
1085         LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT),
1086         LintId::of(&booleans::LOGIC_BUG),
1087         LintId::of(&booleans::NONMINIMAL_BOOL),
1088         LintId::of(&bytecount::NAIVE_BYTECOUNT),
1089         LintId::of(&cognitive_complexity::COGNITIVE_COMPLEXITY),
1090         LintId::of(&collapsible_if::COLLAPSIBLE_IF),
1091         LintId::of(&comparison_chain::COMPARISON_CHAIN),
1092         LintId::of(&copies::IFS_SAME_COND),
1093         LintId::of(&copies::IF_SAME_THEN_ELSE),
1094         LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1095         LintId::of(&doc::MISSING_SAFETY_DOC),
1096         LintId::of(&doc::NEEDLESS_DOCTEST_MAIN),
1097         LintId::of(&double_comparison::DOUBLE_COMPARISONS),
1098         LintId::of(&double_parens::DOUBLE_PARENS),
1099         LintId::of(&drop_bounds::DROP_BOUNDS),
1100         LintId::of(&drop_forget_ref::DROP_COPY),
1101         LintId::of(&drop_forget_ref::DROP_REF),
1102         LintId::of(&drop_forget_ref::FORGET_COPY),
1103         LintId::of(&drop_forget_ref::FORGET_REF),
1104         LintId::of(&duration_subsec::DURATION_SUBSEC),
1105         LintId::of(&entry::MAP_ENTRY),
1106         LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
1107         LintId::of(&enum_variants::ENUM_VARIANT_NAMES),
1108         LintId::of(&enum_variants::MODULE_INCEPTION),
1109         LintId::of(&eq_op::EQ_OP),
1110         LintId::of(&eq_op::OP_REF),
1111         LintId::of(&erasing_op::ERASING_OP),
1112         LintId::of(&escape::BOXED_LOCAL),
1113         LintId::of(&eta_reduction::REDUNDANT_CLOSURE),
1114         LintId::of(&eval_order_dependence::DIVERGING_SUB_EXPRESSION),
1115         LintId::of(&eval_order_dependence::EVAL_ORDER_DEPENDENCE),
1116         LintId::of(&excessive_precision::EXCESSIVE_PRECISION),
1117         LintId::of(&explicit_write::EXPLICIT_WRITE),
1118         LintId::of(&format::USELESS_FORMAT),
1119         LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
1120         LintId::of(&formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1121         LintId::of(&formatting::SUSPICIOUS_ELSE_FORMATTING),
1122         LintId::of(&formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
1123         LintId::of(&functions::DOUBLE_MUST_USE),
1124         LintId::of(&functions::MUST_USE_UNIT),
1125         LintId::of(&functions::NOT_UNSAFE_PTR_ARG_DEREF),
1126         LintId::of(&functions::TOO_MANY_ARGUMENTS),
1127         LintId::of(&get_last_with_len::GET_LAST_WITH_LEN),
1128         LintId::of(&identity_conversion::IDENTITY_CONVERSION),
1129         LintId::of(&identity_op::IDENTITY_OP),
1130         LintId::of(&indexing_slicing::OUT_OF_BOUNDS_INDEXING),
1131         LintId::of(&infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH),
1132         LintId::of(&infinite_iter::INFINITE_ITER),
1133         LintId::of(&inherent_to_string::INHERENT_TO_STRING),
1134         LintId::of(&inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
1135         LintId::of(&inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
1136         LintId::of(&int_plus_one::INT_PLUS_ONE),
1137         LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
1138         LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
1139         LintId::of(&len_zero::LEN_ZERO),
1140         LintId::of(&let_if_seq::USELESS_LET_IF_SEQ),
1141         LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
1142         LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
1143         LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
1144         LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1145         LintId::of(&literal_representation::UNREADABLE_LITERAL),
1146         LintId::of(&loops::EMPTY_LOOP),
1147         LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
1148         LintId::of(&loops::FOR_KV_MAP),
1149         LintId::of(&loops::FOR_LOOP_OVER_OPTION),
1150         LintId::of(&loops::FOR_LOOP_OVER_RESULT),
1151         LintId::of(&loops::ITER_NEXT_LOOP),
1152         LintId::of(&loops::MANUAL_MEMCPY),
1153         LintId::of(&loops::MUT_RANGE_BOUND),
1154         LintId::of(&loops::NEEDLESS_COLLECT),
1155         LintId::of(&loops::NEEDLESS_RANGE_LOOP),
1156         LintId::of(&loops::NEVER_LOOP),
1157         LintId::of(&loops::REVERSE_RANGE_LOOP),
1158         LintId::of(&loops::WHILE_IMMUTABLE_CONDITION),
1159         LintId::of(&loops::WHILE_LET_LOOP),
1160         LintId::of(&loops::WHILE_LET_ON_ITERATOR),
1161         LintId::of(&main_recursion::MAIN_RECURSION),
1162         LintId::of(&map_clone::MAP_CLONE),
1163         LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
1164         LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
1165         LintId::of(&matches::MATCH_AS_REF),
1166         LintId::of(&matches::MATCH_BOOL),
1167         LintId::of(&matches::MATCH_OVERLAPPING_ARM),
1168         LintId::of(&matches::MATCH_REF_PATS),
1169         LintId::of(&matches::MATCH_WILD_ERR_ARM),
1170         LintId::of(&matches::SINGLE_MATCH),
1171         LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
1172         LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
1173         LintId::of(&mem_replace::MEM_REPLACE_WITH_UNINIT),
1174         LintId::of(&methods::CHARS_LAST_CMP),
1175         LintId::of(&methods::CHARS_NEXT_CMP),
1176         LintId::of(&methods::CLONE_DOUBLE_REF),
1177         LintId::of(&methods::CLONE_ON_COPY),
1178         LintId::of(&methods::EXPECT_FUN_CALL),
1179         LintId::of(&methods::FILTER_NEXT),
1180         LintId::of(&methods::FLAT_MAP_IDENTITY),
1181         LintId::of(&methods::INEFFICIENT_TO_STRING),
1182         LintId::of(&methods::INTO_ITER_ON_REF),
1183         LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
1184         LintId::of(&methods::ITER_CLONED_COLLECT),
1185         LintId::of(&methods::ITER_NTH),
1186         LintId::of(&methods::ITER_SKIP_NEXT),
1187         LintId::of(&methods::MANUAL_SATURATING_ARITHMETIC),
1188         LintId::of(&methods::NEW_RET_NO_SELF),
1189         LintId::of(&methods::OK_EXPECT),
1190         LintId::of(&methods::OPTION_AND_THEN_SOME),
1191         LintId::of(&methods::OPTION_MAP_OR_NONE),
1192         LintId::of(&methods::OR_FUN_CALL),
1193         LintId::of(&methods::SEARCH_IS_SOME),
1194         LintId::of(&methods::SHOULD_IMPLEMENT_TRAIT),
1195         LintId::of(&methods::SINGLE_CHAR_PATTERN),
1196         LintId::of(&methods::STRING_EXTEND_CHARS),
1197         LintId::of(&methods::SUSPICIOUS_MAP),
1198         LintId::of(&methods::TEMPORARY_CSTRING_AS_PTR),
1199         LintId::of(&methods::UNINIT_ASSUMED_INIT),
1200         LintId::of(&methods::UNNECESSARY_FILTER_MAP),
1201         LintId::of(&methods::UNNECESSARY_FOLD),
1202         LintId::of(&methods::USELESS_ASREF),
1203         LintId::of(&methods::WRONG_SELF_CONVENTION),
1204         LintId::of(&methods::ZST_OFFSET),
1205         LintId::of(&minmax::MIN_MAX),
1206         LintId::of(&misc::CMP_NAN),
1207         LintId::of(&misc::CMP_OWNED),
1208         LintId::of(&misc::FLOAT_CMP),
1209         LintId::of(&misc::MODULO_ONE),
1210         LintId::of(&misc::SHORT_CIRCUIT_STATEMENT),
1211         LintId::of(&misc::TOPLEVEL_REF_ARG),
1212         LintId::of(&misc::ZERO_PTR),
1213         LintId::of(&misc_early::BUILTIN_TYPE_SHADOW),
1214         LintId::of(&misc_early::DOUBLE_NEG),
1215         LintId::of(&misc_early::DUPLICATE_UNDERSCORE_ARGUMENT),
1216         LintId::of(&misc_early::MIXED_CASE_HEX_LITERALS),
1217         LintId::of(&misc_early::REDUNDANT_CLOSURE_CALL),
1218         LintId::of(&misc_early::REDUNDANT_PATTERN),
1219         LintId::of(&misc_early::UNNEEDED_FIELD_PATTERN),
1220         LintId::of(&misc_early::UNNEEDED_WILDCARD_PATTERN),
1221         LintId::of(&misc_early::ZERO_PREFIXED_LITERAL),
1222         LintId::of(&mut_reference::UNNECESSARY_MUT_PASSED),
1223         LintId::of(&mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
1224         LintId::of(&mutex_atomic::MUTEX_ATOMIC),
1225         LintId::of(&needless_bool::BOOL_COMPARISON),
1226         LintId::of(&needless_bool::NEEDLESS_BOOL),
1227         LintId::of(&needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
1228         LintId::of(&needless_update::NEEDLESS_UPDATE),
1229         LintId::of(&neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
1230         LintId::of(&neg_multiply::NEG_MULTIPLY),
1231         LintId::of(&new_without_default::NEW_WITHOUT_DEFAULT),
1232         LintId::of(&no_effect::NO_EFFECT),
1233         LintId::of(&no_effect::UNNECESSARY_OPERATION),
1234         LintId::of(&non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
1235         LintId::of(&non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
1236         LintId::of(&non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
1237         LintId::of(&non_expressive_names::MANY_SINGLE_CHAR_NAMES),
1238         LintId::of(&ok_if_let::IF_LET_SOME_RESULT),
1239         LintId::of(&open_options::NONSENSICAL_OPEN_OPTIONS),
1240         LintId::of(&overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL),
1241         LintId::of(&panic_unimplemented::PANIC_PARAMS),
1242         LintId::of(&partialeq_ne_impl::PARTIALEQ_NE_IMPL),
1243         LintId::of(&precedence::PRECEDENCE),
1244         LintId::of(&ptr::CMP_NULL),
1245         LintId::of(&ptr::MUT_FROM_REF),
1246         LintId::of(&ptr::PTR_ARG),
1247         LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
1248         LintId::of(&question_mark::QUESTION_MARK),
1249         LintId::of(&ranges::RANGE_MINUS_ONE),
1250         LintId::of(&ranges::RANGE_PLUS_ONE),
1251         LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
1252         LintId::of(&redundant_clone::REDUNDANT_CLONE),
1253         LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
1254         LintId::of(&redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING),
1255         LintId::of(&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
1256         LintId::of(&reference::DEREF_ADDROF),
1257         LintId::of(&reference::REF_IN_DEREF),
1258         LintId::of(&regex::INVALID_REGEX),
1259         LintId::of(&regex::REGEX_MACRO),
1260         LintId::of(&regex::TRIVIAL_REGEX),
1261         LintId::of(&returns::LET_AND_RETURN),
1262         LintId::of(&returns::NEEDLESS_RETURN),
1263         LintId::of(&returns::UNUSED_UNIT),
1264         LintId::of(&serde_api::SERDE_API_MISUSE),
1265         LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
1266         LintId::of(&strings::STRING_LIT_AS_BYTES),
1267         LintId::of(&suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1268         LintId::of(&suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1269         LintId::of(&swap::ALMOST_SWAPPED),
1270         LintId::of(&swap::MANUAL_SWAP),
1271         LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
1272         LintId::of(&temporary_assignment::TEMPORARY_ASSIGNMENT),
1273         LintId::of(&to_digit_is_some::TO_DIGIT_IS_SOME),
1274         LintId::of(&transmute::CROSSPOINTER_TRANSMUTE),
1275         LintId::of(&transmute::TRANSMUTE_BYTES_TO_STR),
1276         LintId::of(&transmute::TRANSMUTE_INT_TO_BOOL),
1277         LintId::of(&transmute::TRANSMUTE_INT_TO_CHAR),
1278         LintId::of(&transmute::TRANSMUTE_INT_TO_FLOAT),
1279         LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
1280         LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
1281         LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
1282         LintId::of(&transmute::USELESS_TRANSMUTE),
1283         LintId::of(&transmute::WRONG_TRANSMUTE),
1284         LintId::of(&transmuting_null::TRANSMUTING_NULL),
1285         LintId::of(&trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF),
1286         LintId::of(&try_err::TRY_ERR),
1287         LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
1288         LintId::of(&types::BORROWED_BOX),
1289         LintId::of(&types::BOX_VEC),
1290         LintId::of(&types::CAST_PTR_ALIGNMENT),
1291         LintId::of(&types::CAST_REF_TO_MUT),
1292         LintId::of(&types::CHAR_LIT_AS_U8),
1293         LintId::of(&types::FN_TO_NUMERIC_CAST),
1294         LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
1295         LintId::of(&types::IMPLICIT_HASHER),
1296         LintId::of(&types::LET_UNIT_VALUE),
1297         LintId::of(&types::OPTION_OPTION),
1298         LintId::of(&types::TYPE_COMPLEXITY),
1299         LintId::of(&types::UNIT_ARG),
1300         LintId::of(&types::UNIT_CMP),
1301         LintId::of(&types::UNNECESSARY_CAST),
1302         LintId::of(&types::VEC_BOX),
1303         LintId::of(&unicode::ZERO_WIDTH_SPACE),
1304         LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
1305         LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
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),
1316     ]);
1317
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(&regex::REGEX_MACRO),
1393         LintId::of(&regex::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),
1412     ]);
1413
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(&unwrap::UNNECESSARY_UNWRAP),
1486         LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
1487     ]);
1488
1489     store.register_group(true, "clippy::correctness", Some("clippy_correctness"), vec![
1490         LintId::of(&approx_const::APPROX_CONSTANT),
1491         LintId::of(&attrs::DEPRECATED_SEMVER),
1492         LintId::of(&attrs::USELESS_ATTRIBUTE),
1493         LintId::of(&bit_mask::BAD_BIT_MASK),
1494         LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
1495         LintId::of(&booleans::LOGIC_BUG),
1496         LintId::of(&copies::IFS_SAME_COND),
1497         LintId::of(&copies::IF_SAME_THEN_ELSE),
1498         LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1499         LintId::of(&drop_bounds::DROP_BOUNDS),
1500         LintId::of(&drop_forget_ref::DROP_COPY),
1501         LintId::of(&drop_forget_ref::DROP_REF),
1502         LintId::of(&drop_forget_ref::FORGET_COPY),
1503         LintId::of(&drop_forget_ref::FORGET_REF),
1504         LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
1505         LintId::of(&eq_op::EQ_OP),
1506         LintId::of(&erasing_op::ERASING_OP),
1507         LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
1508         LintId::of(&functions::NOT_UNSAFE_PTR_ARG_DEREF),
1509         LintId::of(&indexing_slicing::OUT_OF_BOUNDS_INDEXING),
1510         LintId::of(&infinite_iter::INFINITE_ITER),
1511         LintId::of(&inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
1512         LintId::of(&inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
1513         LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1514         LintId::of(&loops::FOR_LOOP_OVER_OPTION),
1515         LintId::of(&loops::FOR_LOOP_OVER_RESULT),
1516         LintId::of(&loops::ITER_NEXT_LOOP),
1517         LintId::of(&loops::NEVER_LOOP),
1518         LintId::of(&loops::REVERSE_RANGE_LOOP),
1519         LintId::of(&loops::WHILE_IMMUTABLE_CONDITION),
1520         LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
1521         LintId::of(&mem_replace::MEM_REPLACE_WITH_UNINIT),
1522         LintId::of(&methods::CLONE_DOUBLE_REF),
1523         LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
1524         LintId::of(&methods::TEMPORARY_CSTRING_AS_PTR),
1525         LintId::of(&methods::UNINIT_ASSUMED_INIT),
1526         LintId::of(&methods::ZST_OFFSET),
1527         LintId::of(&minmax::MIN_MAX),
1528         LintId::of(&misc::CMP_NAN),
1529         LintId::of(&misc::FLOAT_CMP),
1530         LintId::of(&misc::MODULO_ONE),
1531         LintId::of(&mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
1532         LintId::of(&non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
1533         LintId::of(&non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
1534         LintId::of(&open_options::NONSENSICAL_OPEN_OPTIONS),
1535         LintId::of(&ptr::MUT_FROM_REF),
1536         LintId::of(&regex::INVALID_REGEX),
1537         LintId::of(&serde_api::SERDE_API_MISUSE),
1538         LintId::of(&suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1539         LintId::of(&suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1540         LintId::of(&swap::ALMOST_SWAPPED),
1541         LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
1542         LintId::of(&transmute::WRONG_TRANSMUTE),
1543         LintId::of(&transmuting_null::TRANSMUTING_NULL),
1544         LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
1545         LintId::of(&types::CAST_PTR_ALIGNMENT),
1546         LintId::of(&types::CAST_REF_TO_MUT),
1547         LintId::of(&types::UNIT_CMP),
1548         LintId::of(&unicode::ZERO_WIDTH_SPACE),
1549         LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
1550         LintId::of(&unwrap::PANICKING_UNWRAP),
1551     ]);
1552
1553     store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
1554         LintId::of(&bytecount::NAIVE_BYTECOUNT),
1555         LintId::of(&entry::MAP_ENTRY),
1556         LintId::of(&escape::BOXED_LOCAL),
1557         LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
1558         LintId::of(&loops::MANUAL_MEMCPY),
1559         LintId::of(&loops::NEEDLESS_COLLECT),
1560         LintId::of(&methods::EXPECT_FUN_CALL),
1561         LintId::of(&methods::INEFFICIENT_TO_STRING),
1562         LintId::of(&methods::ITER_NTH),
1563         LintId::of(&methods::OR_FUN_CALL),
1564         LintId::of(&methods::SINGLE_CHAR_PATTERN),
1565         LintId::of(&misc::CMP_OWNED),
1566         LintId::of(&mutex_atomic::MUTEX_ATOMIC),
1567         LintId::of(&redundant_clone::REDUNDANT_CLONE),
1568         LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
1569         LintId::of(&trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF),
1570         LintId::of(&types::BOX_VEC),
1571         LintId::of(&vec::USELESS_VEC),
1572     ]);
1573
1574     store.register_group(true, "clippy::cargo", Some("clippy_cargo"), vec![
1575         LintId::of(&cargo_common_metadata::CARGO_COMMON_METADATA),
1576         LintId::of(&multiple_crate_versions::MULTIPLE_CRATE_VERSIONS),
1577         LintId::of(&wildcard_dependencies::WILDCARD_DEPENDENCIES),
1578     ]);
1579
1580     store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
1581         LintId::of(&attrs::EMPTY_LINE_AFTER_OUTER_ATTR),
1582         LintId::of(&fallible_impl_from::FALLIBLE_IMPL_FROM),
1583         LintId::of(&missing_const_for_fn::MISSING_CONST_FOR_FN),
1584         LintId::of(&mul_add::MANUAL_MUL_ADD),
1585         LintId::of(&mutex_atomic::MUTEX_INTEGER),
1586         LintId::of(&needless_borrow::NEEDLESS_BORROW),
1587         LintId::of(&path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),
1588         LintId::of(&transmute::TRANSMUTE_FLOAT_TO_INT),
1589         LintId::of(&use_self::USE_SELF),
1590     ]);
1591 }
1592
1593 #[rustfmt::skip]
1594 fn register_removed_non_tool_lints(store: &mut rustc::lint::LintStore) {
1595     store.register_removed(
1596         "should_assert_eq",
1597         "`assert!()` will be more flexible with RFC 2011",
1598     );
1599     store.register_removed(
1600         "extend_from_slice",
1601         "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
1602     );
1603     store.register_removed(
1604         "range_step_by_zero",
1605         "`iterator.step_by(0)` panics nowadays",
1606     );
1607     store.register_removed(
1608         "unstable_as_slice",
1609         "`Vec::as_slice` has been stabilized in 1.7",
1610     );
1611     store.register_removed(
1612         "unstable_as_mut_slice",
1613         "`Vec::as_mut_slice` has been stabilized in 1.7",
1614     );
1615     store.register_removed(
1616         "str_to_string",
1617         "using `str::to_string` is common even today and specialization will likely happen soon",
1618     );
1619     store.register_removed(
1620         "string_to_string",
1621         "using `string::to_string` is common even today and specialization will likely happen soon",
1622     );
1623     store.register_removed(
1624         "misaligned_transmute",
1625         "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
1626     );
1627     store.register_removed(
1628         "assign_ops",
1629         "using compound assignment operators (e.g., `+=`) is harmless",
1630     );
1631     store.register_removed(
1632         "if_let_redundant_pattern_matching",
1633         "this lint has been changed to redundant_pattern_matching",
1634     );
1635     store.register_removed(
1636         "unsafe_vector_initialization",
1637         "the replacement suggested by this lint had substantially different behavior",
1638     );
1639 }
1640
1641 /// Register renamed lints.
1642 ///
1643 /// Used in `./src/driver.rs`.
1644 pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
1645     ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1646     ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
1647     ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
1648     ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
1649 }
1650
1651 // only exists to let the dogfood integration test works.
1652 // Don't run clippy as an executable directly
1653 #[allow(dead_code)]
1654 fn main() {
1655     panic!("Please use the cargo-clippy executable");
1656 }