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