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