]> git.lizzy.rs Git - rust.git/blob - clippy_lints/src/lib.rs
rustup https://github.com/rust-lang/rust/pull/57726
[rust.git] / clippy_lints / src / lib.rs
1 // error-pattern:cargo-clippy
2
3 #![feature(box_syntax)]
4 #![feature(rustc_private)]
5 #![feature(slice_patterns)]
6 #![feature(stmt_expr_attributes)]
7 #![feature(range_contains)]
8 #![feature(str_escape)]
9 #![allow(clippy::missing_docs_in_private_items)]
10 #![recursion_limit = "256"]
11 #![warn(rust_2018_idioms, trivial_casts, trivial_numeric_casts)]
12 #![feature(crate_visibility_modifier)]
13 #![feature(try_from)]
14
15 // FIXME: switch to something more ergonomic here, once available.
16 // (currently there is no way to opt into sysroot crates w/o `extern crate`)
17 #[allow(unused_extern_crates)]
18 extern crate fmt_macros;
19 #[allow(unused_extern_crates)]
20 extern crate rustc;
21 #[allow(unused_extern_crates)]
22 extern crate rustc_data_structures;
23 #[allow(unused_extern_crates)]
24 extern crate rustc_errors;
25 #[allow(unused_extern_crates)]
26 extern crate rustc_plugin;
27 #[allow(unused_extern_crates)]
28 extern crate rustc_target;
29 #[allow(unused_extern_crates)]
30 extern crate rustc_typeck;
31 #[allow(unused_extern_crates)]
32 extern crate syntax;
33 #[allow(unused_extern_crates)]
34 extern crate syntax_pos;
35
36 use toml;
37
38 // Currently, categories "style", "correctness", "complexity" and "perf" are enabled by default,
39 // as said in the README.md of this repository. If this changes, please update README.md.
40 #[macro_export]
41 macro_rules! declare_clippy_lint {
42     { pub $name:tt, style, $description:tt } => {
43         declare_tool_lint! { pub clippy::$name, Warn, $description, report_in_external_macro: true }
44     };
45     { pub $name:tt, correctness, $description:tt } => {
46         declare_tool_lint! { pub clippy::$name, Deny, $description, report_in_external_macro: true }
47     };
48     { pub $name:tt, complexity, $description:tt } => {
49         declare_tool_lint! { pub clippy::$name, Warn, $description, report_in_external_macro: true }
50     };
51     { pub $name:tt, perf, $description:tt } => {
52         declare_tool_lint! { pub clippy::$name, Warn, $description, report_in_external_macro: true }
53     };
54     { pub $name:tt, pedantic, $description:tt } => {
55         declare_tool_lint! { pub clippy::$name, Allow, $description, report_in_external_macro: true }
56     };
57     { pub $name:tt, restriction, $description:tt } => {
58         declare_tool_lint! { pub clippy::$name, Allow, $description, report_in_external_macro: true }
59     };
60     { pub $name:tt, cargo, $description:tt } => {
61         declare_tool_lint! { pub clippy::$name, Allow, $description, report_in_external_macro: true }
62     };
63     { pub $name:tt, nursery, $description:tt } => {
64         declare_tool_lint! { pub clippy::$name, Allow, $description, report_in_external_macro: true }
65     };
66     { pub $name:tt, internal, $description:tt } => {
67         declare_tool_lint! { pub clippy::$name, Allow, $description, report_in_external_macro: true }
68     };
69     { pub $name:tt, internal_warn, $description:tt } => {
70         declare_tool_lint! { pub clippy::$name, Warn, $description, report_in_external_macro: true }
71     };
72 }
73
74 mod consts;
75 #[macro_use]
76 mod utils;
77
78 // begin lints modules, do not remove this comment, it’s used in `update_lints`
79 pub mod approx_const;
80 pub mod arithmetic;
81 pub mod assertions_on_constants;
82 pub mod assign_ops;
83 pub mod attrs;
84 pub mod bit_mask;
85 pub mod blacklisted_name;
86 pub mod block_in_if_condition;
87 pub mod booleans;
88 pub mod bytecount;
89 pub mod cargo_common_metadata;
90 pub mod collapsible_if;
91 pub mod const_static_lifetime;
92 pub mod copies;
93 pub mod copy_iterator;
94 pub mod cyclomatic_complexity;
95 pub mod default_trait_access;
96 pub mod derive;
97 pub mod doc;
98 pub mod double_comparison;
99 pub mod double_parens;
100 pub mod drop_forget_ref;
101 pub mod duration_subsec;
102 pub mod else_if_without_else;
103 pub mod empty_enum;
104 pub mod entry;
105 pub mod enum_clike;
106 pub mod enum_glob_use;
107 pub mod enum_variants;
108 pub mod eq_op;
109 pub mod erasing_op;
110 pub mod escape;
111 pub mod eta_reduction;
112 pub mod eval_order_dependence;
113 pub mod excessive_precision;
114 pub mod explicit_write;
115 pub mod fallible_impl_from;
116 pub mod format;
117 pub mod formatting;
118 pub mod functions;
119 pub mod identity_conversion;
120 pub mod identity_op;
121 pub mod if_not_else;
122 pub mod implicit_return;
123 pub mod indexing_slicing;
124 pub mod infallible_destructuring_match;
125 pub mod infinite_iter;
126 pub mod inherent_impl;
127 pub mod inline_fn_without_body;
128 pub mod int_plus_one;
129 pub mod invalid_ref;
130 pub mod items_after_statements;
131 pub mod large_enum_variant;
132 pub mod len_zero;
133 pub mod let_if_seq;
134 pub mod lifetimes;
135 pub mod literal_representation;
136 pub mod loops;
137 pub mod map_clone;
138 pub mod map_unit_fn;
139 pub mod matches;
140 pub mod mem_discriminant;
141 pub mod mem_forget;
142 pub mod mem_replace;
143 pub mod methods;
144 pub mod minmax;
145 pub mod misc;
146 pub mod misc_early;
147 pub mod missing_doc;
148 pub mod missing_inline;
149 pub mod multiple_crate_versions;
150 pub mod mut_mut;
151 pub mod mut_reference;
152 pub mod mutex_atomic;
153 pub mod needless_bool;
154 pub mod needless_borrow;
155 pub mod needless_borrowed_ref;
156 pub mod needless_continue;
157 pub mod needless_pass_by_value;
158 pub mod needless_update;
159 pub mod neg_cmp_op_on_partial_ord;
160 pub mod neg_multiply;
161 pub mod new_without_default;
162 pub mod no_effect;
163 pub mod non_copy_const;
164 pub mod non_expressive_names;
165 pub mod ok_if_let;
166 pub mod open_options;
167 pub mod overflow_check_conditional;
168 pub mod panic_unimplemented;
169 pub mod partialeq_ne_impl;
170 pub mod precedence;
171 pub mod ptr;
172 pub mod ptr_offset_with_cast;
173 pub mod question_mark;
174 pub mod ranges;
175 pub mod redundant_clone;
176 pub mod redundant_field_names;
177 pub mod redundant_pattern_matching;
178 pub mod reference;
179 pub mod regex;
180 pub mod replace_consts;
181 pub mod returns;
182 pub mod serde_api;
183 pub mod shadow;
184 pub mod slow_vector_initialization;
185 pub mod strings;
186 pub mod suspicious_trait_impl;
187 pub mod swap;
188 pub mod temporary_assignment;
189 pub mod transmute;
190 pub mod trivially_copy_pass_by_ref;
191 pub mod types;
192 pub mod unicode;
193 pub mod unsafe_removed_from_name;
194 pub mod unused_io_amount;
195 pub mod unused_label;
196 pub mod unwrap;
197 pub mod use_self;
198 pub mod vec;
199 pub mod wildcard_dependencies;
200 pub mod write;
201 pub mod zero_div_zero;
202 // end lints modules, do not remove this comment, it’s used in `update_lints`
203
204 pub use crate::utils::conf::Conf;
205
206 mod reexport {
207     crate use syntax::ast::{Name, NodeId};
208 }
209
210 pub fn register_pre_expansion_lints(
211     session: &rustc::session::Session,
212     store: &mut rustc::lint::LintStore,
213     conf: &Conf,
214 ) {
215     store.register_pre_expansion_pass(Some(session), true, false, box write::Pass);
216     store.register_pre_expansion_pass(
217         Some(session),
218         true,
219         false,
220         box redundant_field_names::RedundantFieldNames,
221     );
222     store.register_pre_expansion_pass(
223         Some(session),
224         true,
225         false,
226         box non_expressive_names::NonExpressiveNames {
227             single_char_binding_names_threshold: conf.single_char_binding_names_threshold,
228         },
229     );
230     store.register_pre_expansion_pass(Some(session), true, false, box attrs::CfgAttrPass);
231 }
232
233 pub fn read_conf(reg: &rustc_plugin::Registry<'_>) -> Conf {
234     match utils::conf::file_from_args(reg.args()) {
235         Ok(file_name) => {
236             // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
237             // do not require the file to exist
238             let file_name = if let Some(file_name) = file_name {
239                 Some(file_name)
240             } else {
241                 match utils::conf::lookup_conf_file() {
242                     Ok(path) => path,
243                     Err(error) => {
244                         reg.sess
245                             .struct_err(&format!("error finding Clippy's configuration file: {}", error))
246                             .emit();
247                         None
248                     },
249                 }
250             };
251
252             let file_name = file_name.map(|file_name| {
253                 if file_name.is_relative() {
254                     reg.sess
255                         .local_crate_source_file
256                         .as_ref()
257                         .and_then(|file| std::path::Path::new(&file).parent().map(std::path::Path::to_path_buf))
258                         .unwrap_or_default()
259                         .join(file_name)
260                 } else {
261                     file_name
262                 }
263             });
264
265             let (conf, errors) = utils::conf::read(file_name.as_ref().map(|p| p.as_ref()));
266
267             // all conf errors are non-fatal, we just use the default conf in case of error
268             for error in errors {
269                 reg.sess
270                     .struct_err(&format!(
271                         "error reading Clippy's configuration file `{}`: {}",
272                         file_name.as_ref().and_then(|p| p.to_str()).unwrap_or(""),
273                         error
274                     ))
275                     .emit();
276             }
277
278             conf
279         },
280         Err((err, span)) => {
281             reg.sess
282                 .struct_span_err(span, err)
283                 .span_note(span, "Clippy will use default configuration")
284                 .emit();
285             toml::from_str("").expect("we never error on empty config files")
286         },
287     }
288 }
289
290 #[rustfmt::skip]
291 pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
292     let mut store = reg.sess.lint_store.borrow_mut();
293     // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
294     store.register_removed(
295         "should_assert_eq",
296         "`assert!()` will be more flexible with RFC 2011",
297     );
298     store.register_removed(
299         "extend_from_slice",
300         "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
301     );
302     store.register_removed(
303         "range_step_by_zero",
304         "`iterator.step_by(0)` panics nowadays",
305     );
306     store.register_removed(
307         "unstable_as_slice",
308         "`Vec::as_slice` has been stabilized in 1.7",
309     );
310     store.register_removed(
311         "unstable_as_mut_slice",
312         "`Vec::as_mut_slice` has been stabilized in 1.7",
313     );
314     store.register_removed(
315         "str_to_string",
316         "using `str::to_string` is common even today and specialization will likely happen soon",
317     );
318     store.register_removed(
319         "string_to_string",
320         "using `string::to_string` is common even today and specialization will likely happen soon",
321     );
322     store.register_removed(
323         "misaligned_transmute",
324         "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
325     );
326     store.register_removed(
327         "assign_ops",
328         "using compound assignment operators (e.g. `+=`) is harmless",
329     );
330     store.register_removed(
331         "if_let_redundant_pattern_matching",
332         "this lint has been changed to redundant_pattern_matching",
333     );
334     store.register_removed(
335         "unsafe_vector_initialization",
336         "the replacement suggested by this lint had substantially different behavior",
337     );
338     // end deprecated lints, do not remove this comment, it’s used in `update_lints`
339
340     reg.register_late_lint_pass(box serde_api::Serde);
341     reg.register_early_lint_pass(box utils::internal_lints::Clippy);
342     reg.register_late_lint_pass(box utils::internal_lints::CompilerLintFunctions::new());
343     reg.register_early_lint_pass(box utils::internal_lints::DefaultHashTypes::default());
344     reg.register_late_lint_pass(box utils::internal_lints::LintWithoutLintPass::default());
345     reg.register_late_lint_pass(box utils::inspector::Pass);
346     reg.register_late_lint_pass(box utils::author::Pass);
347     reg.register_late_lint_pass(box types::TypePass);
348     reg.register_late_lint_pass(box booleans::NonminimalBool);
349     reg.register_late_lint_pass(box eq_op::EqOp);
350     reg.register_early_lint_pass(box enum_variants::EnumVariantNames::new(conf.enum_variant_name_threshold));
351     reg.register_late_lint_pass(box enum_glob_use::EnumGlobUse);
352     reg.register_late_lint_pass(box enum_clike::UnportableVariant);
353     reg.register_late_lint_pass(box excessive_precision::ExcessivePrecision);
354     reg.register_late_lint_pass(box bit_mask::BitMask::new(conf.verbose_bit_mask_threshold));
355     reg.register_late_lint_pass(box ptr::PointerPass);
356     reg.register_late_lint_pass(box needless_bool::NeedlessBool);
357     reg.register_late_lint_pass(box needless_bool::BoolComparison);
358     reg.register_late_lint_pass(box approx_const::Pass);
359     reg.register_late_lint_pass(box misc::Pass);
360     reg.register_early_lint_pass(box precedence::Precedence);
361     reg.register_early_lint_pass(box needless_continue::NeedlessContinue);
362     reg.register_late_lint_pass(box eta_reduction::EtaPass);
363     reg.register_late_lint_pass(box identity_op::IdentityOp);
364     reg.register_late_lint_pass(box erasing_op::ErasingOp);
365     reg.register_early_lint_pass(box items_after_statements::ItemsAfterStatements);
366     reg.register_late_lint_pass(box mut_mut::MutMut);
367     reg.register_late_lint_pass(box mut_reference::UnnecessaryMutPassed);
368     reg.register_late_lint_pass(box len_zero::LenZero);
369     reg.register_late_lint_pass(box attrs::AttrPass);
370     reg.register_early_lint_pass(box collapsible_if::CollapsibleIf);
371     reg.register_late_lint_pass(box block_in_if_condition::BlockInIfCondition);
372     reg.register_late_lint_pass(box unicode::Unicode);
373     reg.register_late_lint_pass(box strings::StringAdd);
374     reg.register_early_lint_pass(box returns::ReturnPass);
375     reg.register_late_lint_pass(box implicit_return::Pass);
376     reg.register_late_lint_pass(box methods::Pass);
377     reg.register_late_lint_pass(box map_clone::Pass);
378     reg.register_late_lint_pass(box shadow::Pass);
379     reg.register_late_lint_pass(box types::LetPass);
380     reg.register_late_lint_pass(box types::UnitCmp);
381     reg.register_late_lint_pass(box loops::Pass);
382     reg.register_late_lint_pass(box lifetimes::LifetimePass);
383     reg.register_late_lint_pass(box entry::HashMapLint);
384     reg.register_late_lint_pass(box ranges::Pass);
385     reg.register_late_lint_pass(box types::CastPass);
386     reg.register_late_lint_pass(box types::TypeComplexityPass::new(conf.type_complexity_threshold));
387     reg.register_late_lint_pass(box matches::MatchPass);
388     reg.register_late_lint_pass(box minmax::MinMaxPass);
389     reg.register_late_lint_pass(box open_options::NonSensical);
390     reg.register_late_lint_pass(box zero_div_zero::Pass);
391     reg.register_late_lint_pass(box mutex_atomic::MutexAtomic);
392     reg.register_late_lint_pass(box needless_update::Pass);
393     reg.register_late_lint_pass(box needless_borrow::NeedlessBorrow::default());
394     reg.register_late_lint_pass(box needless_borrowed_ref::NeedlessBorrowedRef);
395     reg.register_late_lint_pass(box no_effect::Pass);
396     reg.register_late_lint_pass(box temporary_assignment::Pass);
397     reg.register_late_lint_pass(box transmute::Transmute);
398     reg.register_late_lint_pass(
399         box cyclomatic_complexity::CyclomaticComplexity::new(conf.cyclomatic_complexity_threshold)
400     );
401     reg.register_late_lint_pass(box escape::Pass{too_large_for_stack: conf.too_large_for_stack});
402     reg.register_early_lint_pass(box misc_early::MiscEarly);
403     reg.register_late_lint_pass(box panic_unimplemented::Pass);
404     reg.register_late_lint_pass(box strings::StringLitAsBytes);
405     reg.register_late_lint_pass(box derive::Derive);
406     reg.register_late_lint_pass(box types::CharLitAsU8);
407     reg.register_late_lint_pass(box vec::Pass);
408     reg.register_late_lint_pass(box drop_forget_ref::Pass);
409     reg.register_late_lint_pass(box empty_enum::EmptyEnum);
410     reg.register_late_lint_pass(box types::AbsurdExtremeComparisons);
411     reg.register_late_lint_pass(box types::InvalidUpcastComparisons);
412     reg.register_late_lint_pass(box regex::Pass::default());
413     reg.register_late_lint_pass(box copies::CopyAndPaste);
414     reg.register_late_lint_pass(box copy_iterator::CopyIterator);
415     reg.register_late_lint_pass(box format::Pass);
416     reg.register_early_lint_pass(box formatting::Formatting);
417     reg.register_late_lint_pass(box swap::Swap);
418     reg.register_early_lint_pass(box if_not_else::IfNotElse);
419     reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse);
420     reg.register_early_lint_pass(box int_plus_one::IntPlusOne);
421     reg.register_late_lint_pass(box overflow_check_conditional::OverflowCheckConditional);
422     reg.register_late_lint_pass(box unused_label::UnusedLabel);
423     reg.register_late_lint_pass(box new_without_default::NewWithoutDefault::default());
424     reg.register_late_lint_pass(box blacklisted_name::BlackListedName::new(
425             conf.blacklisted_names.iter().cloned().collect()
426     ));
427     reg.register_late_lint_pass(box functions::Functions::new(conf.too_many_arguments_threshold));
428     reg.register_early_lint_pass(box doc::Doc::new(conf.doc_valid_idents.iter().cloned().collect()));
429     reg.register_late_lint_pass(box neg_multiply::NegMultiply);
430     reg.register_early_lint_pass(box unsafe_removed_from_name::UnsafeNameRemoval);
431     reg.register_late_lint_pass(box mem_discriminant::MemDiscriminant);
432     reg.register_late_lint_pass(box mem_forget::MemForget);
433     reg.register_late_lint_pass(box mem_replace::MemReplace);
434     reg.register_late_lint_pass(box arithmetic::Arithmetic::default());
435     reg.register_late_lint_pass(box assign_ops::AssignOps);
436     reg.register_late_lint_pass(box let_if_seq::LetIfSeq);
437     reg.register_late_lint_pass(box eval_order_dependence::EvalOrderDependence);
438     reg.register_late_lint_pass(box missing_doc::MissingDoc::new());
439     reg.register_late_lint_pass(box missing_inline::MissingInline);
440     reg.register_late_lint_pass(box ok_if_let::Pass);
441     reg.register_late_lint_pass(box redundant_pattern_matching::Pass);
442     reg.register_late_lint_pass(box partialeq_ne_impl::Pass);
443     reg.register_early_lint_pass(box reference::Pass);
444     reg.register_early_lint_pass(box reference::DerefPass);
445     reg.register_early_lint_pass(box double_parens::DoubleParens);
446     reg.register_late_lint_pass(box unused_io_amount::UnusedIoAmount);
447     reg.register_late_lint_pass(box large_enum_variant::LargeEnumVariant::new(conf.enum_variant_size_threshold));
448     reg.register_late_lint_pass(box explicit_write::Pass);
449     reg.register_late_lint_pass(box needless_pass_by_value::NeedlessPassByValue);
450     reg.register_late_lint_pass(box trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
451             conf.trivial_copy_size_limit,
452             &reg.sess.target,
453     ));
454     reg.register_early_lint_pass(box literal_representation::LiteralDigitGrouping);
455     reg.register_early_lint_pass(box literal_representation::LiteralRepresentation::new(
456             conf.literal_representation_threshold
457     ));
458     reg.register_late_lint_pass(box use_self::UseSelf);
459     reg.register_late_lint_pass(box bytecount::ByteCount);
460     reg.register_late_lint_pass(box infinite_iter::Pass);
461     reg.register_late_lint_pass(box inline_fn_without_body::Pass);
462     reg.register_late_lint_pass(box invalid_ref::InvalidRef);
463     reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
464     reg.register_late_lint_pass(box types::ImplicitHasher);
465     reg.register_early_lint_pass(box const_static_lifetime::StaticConst);
466     reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom);
467     reg.register_late_lint_pass(box replace_consts::ReplaceConsts);
468     reg.register_late_lint_pass(box types::UnitArg);
469     reg.register_late_lint_pass(box double_comparison::Pass);
470     reg.register_late_lint_pass(box question_mark::Pass);
471     reg.register_late_lint_pass(box suspicious_trait_impl::SuspiciousImpl);
472     reg.register_early_lint_pass(box cargo_common_metadata::Pass);
473     reg.register_early_lint_pass(box multiple_crate_versions::Pass);
474     reg.register_early_lint_pass(box wildcard_dependencies::Pass);
475     reg.register_late_lint_pass(box map_unit_fn::Pass);
476     reg.register_late_lint_pass(box infallible_destructuring_match::Pass);
477     reg.register_late_lint_pass(box inherent_impl::Pass::default());
478     reg.register_late_lint_pass(box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
479     reg.register_late_lint_pass(box unwrap::Pass);
480     reg.register_late_lint_pass(box duration_subsec::DurationSubsec);
481     reg.register_late_lint_pass(box default_trait_access::DefaultTraitAccess);
482     reg.register_late_lint_pass(box indexing_slicing::IndexingSlicing);
483     reg.register_late_lint_pass(box non_copy_const::NonCopyConst);
484     reg.register_late_lint_pass(box ptr_offset_with_cast::Pass);
485     reg.register_late_lint_pass(box redundant_clone::RedundantClone);
486     reg.register_late_lint_pass(box slow_vector_initialization::Pass);
487     reg.register_late_lint_pass(box types::RefToMut);
488     reg.register_late_lint_pass(box assertions_on_constants::AssertionsOnConstants);
489
490     reg.register_lint_group("clippy::restriction", Some("clippy_restriction"), vec![
491         arithmetic::FLOAT_ARITHMETIC,
492         arithmetic::INTEGER_ARITHMETIC,
493         else_if_without_else::ELSE_IF_WITHOUT_ELSE,
494         implicit_return::IMPLICIT_RETURN,
495         indexing_slicing::INDEXING_SLICING,
496         inherent_impl::MULTIPLE_INHERENT_IMPL,
497         literal_representation::DECIMAL_LITERAL_REPRESENTATION,
498         mem_forget::MEM_FORGET,
499         methods::CLONE_ON_REF_PTR,
500         methods::OPTION_UNWRAP_USED,
501         methods::RESULT_UNWRAP_USED,
502         methods::WRONG_PUB_SELF_CONVENTION,
503         misc::FLOAT_CMP_CONST,
504         missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
505         missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
506         panic_unimplemented::UNIMPLEMENTED,
507         shadow::SHADOW_REUSE,
508         shadow::SHADOW_SAME,
509         strings::STRING_ADD,
510         write::PRINT_STDOUT,
511         write::USE_DEBUG,
512     ]);
513
514     reg.register_lint_group("clippy::pedantic", Some("clippy_pedantic"), vec![
515         attrs::INLINE_ALWAYS,
516         copies::MATCH_SAME_ARMS,
517         copy_iterator::COPY_ITERATOR,
518         default_trait_access::DEFAULT_TRAIT_ACCESS,
519         derive::EXPL_IMPL_CLONE_ON_COPY,
520         doc::DOC_MARKDOWN,
521         empty_enum::EMPTY_ENUM,
522         enum_glob_use::ENUM_GLOB_USE,
523         enum_variants::MODULE_NAME_REPETITIONS,
524         enum_variants::PUB_ENUM_VARIANT_NAMES,
525         if_not_else::IF_NOT_ELSE,
526         infinite_iter::MAYBE_INFINITE_ITER,
527         items_after_statements::ITEMS_AFTER_STATEMENTS,
528         literal_representation::LARGE_DIGIT_GROUPS,
529         loops::EXPLICIT_INTO_ITER_LOOP,
530         loops::EXPLICIT_ITER_LOOP,
531         matches::SINGLE_MATCH_ELSE,
532         methods::FILTER_MAP,
533         methods::MAP_FLATTEN,
534         methods::OPTION_MAP_UNWRAP_OR,
535         methods::OPTION_MAP_UNWRAP_OR_ELSE,
536         methods::RESULT_MAP_UNWRAP_OR_ELSE,
537         misc::USED_UNDERSCORE_BINDING,
538         misc_early::UNSEPARATED_LITERAL_SUFFIX,
539         mut_mut::MUT_MUT,
540         needless_continue::NEEDLESS_CONTINUE,
541         needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
542         non_expressive_names::SIMILAR_NAMES,
543         replace_consts::REPLACE_CONSTS,
544         shadow::SHADOW_UNRELATED,
545         strings::STRING_ADD_ASSIGN,
546         types::CAST_POSSIBLE_TRUNCATION,
547         types::CAST_POSSIBLE_WRAP,
548         types::CAST_PRECISION_LOSS,
549         types::CAST_SIGN_LOSS,
550         types::INVALID_UPCAST_COMPARISONS,
551         types::LINKEDLIST,
552         unicode::NON_ASCII_LITERAL,
553         unicode::UNICODE_NOT_NFC,
554         use_self::USE_SELF,
555     ]);
556
557     reg.register_lint_group("clippy::internal", Some("clippy_internal"), vec![
558         utils::internal_lints::CLIPPY_LINTS_INTERNAL,
559         utils::internal_lints::COMPILER_LINT_FUNCTIONS,
560         utils::internal_lints::DEFAULT_HASH_TYPES,
561         utils::internal_lints::LINT_WITHOUT_LINT_PASS,
562     ]);
563
564     reg.register_lint_group("clippy::all", Some("clippy"), vec![
565         approx_const::APPROX_CONSTANT,
566         assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
567         assign_ops::ASSIGN_OP_PATTERN,
568         assign_ops::MISREFACTORED_ASSIGN_OP,
569         attrs::DEPRECATED_CFG_ATTR,
570         attrs::DEPRECATED_SEMVER,
571         attrs::UNKNOWN_CLIPPY_LINTS,
572         attrs::USELESS_ATTRIBUTE,
573         bit_mask::BAD_BIT_MASK,
574         bit_mask::INEFFECTIVE_BIT_MASK,
575         bit_mask::VERBOSE_BIT_MASK,
576         blacklisted_name::BLACKLISTED_NAME,
577         block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
578         block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
579         booleans::LOGIC_BUG,
580         booleans::NONMINIMAL_BOOL,
581         bytecount::NAIVE_BYTECOUNT,
582         collapsible_if::COLLAPSIBLE_IF,
583         const_static_lifetime::CONST_STATIC_LIFETIME,
584         copies::IFS_SAME_COND,
585         copies::IF_SAME_THEN_ELSE,
586         cyclomatic_complexity::CYCLOMATIC_COMPLEXITY,
587         derive::DERIVE_HASH_XOR_EQ,
588         double_comparison::DOUBLE_COMPARISONS,
589         double_parens::DOUBLE_PARENS,
590         drop_forget_ref::DROP_COPY,
591         drop_forget_ref::DROP_REF,
592         drop_forget_ref::FORGET_COPY,
593         drop_forget_ref::FORGET_REF,
594         duration_subsec::DURATION_SUBSEC,
595         entry::MAP_ENTRY,
596         enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
597         enum_variants::ENUM_VARIANT_NAMES,
598         enum_variants::MODULE_INCEPTION,
599         eq_op::EQ_OP,
600         eq_op::OP_REF,
601         erasing_op::ERASING_OP,
602         escape::BOXED_LOCAL,
603         eta_reduction::REDUNDANT_CLOSURE,
604         eval_order_dependence::DIVERGING_SUB_EXPRESSION,
605         eval_order_dependence::EVAL_ORDER_DEPENDENCE,
606         excessive_precision::EXCESSIVE_PRECISION,
607         explicit_write::EXPLICIT_WRITE,
608         format::USELESS_FORMAT,
609         formatting::POSSIBLE_MISSING_COMMA,
610         formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
611         formatting::SUSPICIOUS_ELSE_FORMATTING,
612         functions::NOT_UNSAFE_PTR_ARG_DEREF,
613         functions::TOO_MANY_ARGUMENTS,
614         identity_conversion::IDENTITY_CONVERSION,
615         identity_op::IDENTITY_OP,
616         indexing_slicing::OUT_OF_BOUNDS_INDEXING,
617         infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
618         infinite_iter::INFINITE_ITER,
619         inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
620         int_plus_one::INT_PLUS_ONE,
621         invalid_ref::INVALID_REF,
622         large_enum_variant::LARGE_ENUM_VARIANT,
623         len_zero::LEN_WITHOUT_IS_EMPTY,
624         len_zero::LEN_ZERO,
625         let_if_seq::USELESS_LET_IF_SEQ,
626         lifetimes::EXTRA_UNUSED_LIFETIMES,
627         lifetimes::NEEDLESS_LIFETIMES,
628         literal_representation::INCONSISTENT_DIGIT_GROUPING,
629         literal_representation::MISTYPED_LITERAL_SUFFIXES,
630         literal_representation::UNREADABLE_LITERAL,
631         loops::EMPTY_LOOP,
632         loops::EXPLICIT_COUNTER_LOOP,
633         loops::FOR_KV_MAP,
634         loops::FOR_LOOP_OVER_OPTION,
635         loops::FOR_LOOP_OVER_RESULT,
636         loops::ITER_NEXT_LOOP,
637         loops::MANUAL_MEMCPY,
638         loops::MUT_RANGE_BOUND,
639         loops::NEEDLESS_COLLECT,
640         loops::NEEDLESS_RANGE_LOOP,
641         loops::NEVER_LOOP,
642         loops::REVERSE_RANGE_LOOP,
643         loops::UNUSED_COLLECT,
644         loops::WHILE_IMMUTABLE_CONDITION,
645         loops::WHILE_LET_LOOP,
646         loops::WHILE_LET_ON_ITERATOR,
647         map_clone::MAP_CLONE,
648         map_unit_fn::OPTION_MAP_UNIT_FN,
649         map_unit_fn::RESULT_MAP_UNIT_FN,
650         matches::MATCH_AS_REF,
651         matches::MATCH_BOOL,
652         matches::MATCH_OVERLAPPING_ARM,
653         matches::MATCH_REF_PATS,
654         matches::MATCH_WILD_ERR_ARM,
655         matches::SINGLE_MATCH,
656         mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
657         mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
658         methods::CHARS_LAST_CMP,
659         methods::CHARS_NEXT_CMP,
660         methods::CLONE_DOUBLE_REF,
661         methods::CLONE_ON_COPY,
662         methods::EXPECT_FUN_CALL,
663         methods::FILTER_NEXT,
664         methods::GET_UNWRAP,
665         methods::INTO_ITER_ON_ARRAY,
666         methods::INTO_ITER_ON_REF,
667         methods::ITER_CLONED_COLLECT,
668         methods::ITER_NTH,
669         methods::ITER_SKIP_NEXT,
670         methods::NEW_RET_NO_SELF,
671         methods::OK_EXPECT,
672         methods::OPTION_MAP_OR_NONE,
673         methods::OR_FUN_CALL,
674         methods::SEARCH_IS_SOME,
675         methods::SHOULD_IMPLEMENT_TRAIT,
676         methods::SINGLE_CHAR_PATTERN,
677         methods::STRING_EXTEND_CHARS,
678         methods::TEMPORARY_CSTRING_AS_PTR,
679         methods::UNNECESSARY_FILTER_MAP,
680         methods::UNNECESSARY_FOLD,
681         methods::USELESS_ASREF,
682         methods::WRONG_SELF_CONVENTION,
683         minmax::MIN_MAX,
684         misc::CMP_NAN,
685         misc::CMP_OWNED,
686         misc::FLOAT_CMP,
687         misc::MODULO_ONE,
688         misc::REDUNDANT_PATTERN,
689         misc::SHORT_CIRCUIT_STATEMENT,
690         misc::TOPLEVEL_REF_ARG,
691         misc::ZERO_PTR,
692         misc_early::BUILTIN_TYPE_SHADOW,
693         misc_early::DOUBLE_NEG,
694         misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
695         misc_early::MIXED_CASE_HEX_LITERALS,
696         misc_early::REDUNDANT_CLOSURE_CALL,
697         misc_early::UNNEEDED_FIELD_PATTERN,
698         misc_early::ZERO_PREFIXED_LITERAL,
699         mut_reference::UNNECESSARY_MUT_PASSED,
700         mutex_atomic::MUTEX_ATOMIC,
701         needless_bool::BOOL_COMPARISON,
702         needless_bool::NEEDLESS_BOOL,
703         needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
704         needless_update::NEEDLESS_UPDATE,
705         neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
706         neg_multiply::NEG_MULTIPLY,
707         new_without_default::NEW_WITHOUT_DEFAULT,
708         no_effect::NO_EFFECT,
709         no_effect::UNNECESSARY_OPERATION,
710         non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
711         non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
712         non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
713         non_expressive_names::MANY_SINGLE_CHAR_NAMES,
714         ok_if_let::IF_LET_SOME_RESULT,
715         open_options::NONSENSICAL_OPEN_OPTIONS,
716         overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
717         panic_unimplemented::PANIC_PARAMS,
718         partialeq_ne_impl::PARTIALEQ_NE_IMPL,
719         precedence::PRECEDENCE,
720         ptr::CMP_NULL,
721         ptr::MUT_FROM_REF,
722         ptr::PTR_ARG,
723         ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
724         question_mark::QUESTION_MARK,
725         ranges::ITERATOR_STEP_BY_ZERO,
726         ranges::RANGE_MINUS_ONE,
727         ranges::RANGE_PLUS_ONE,
728         ranges::RANGE_ZIP_WITH_LEN,
729         redundant_field_names::REDUNDANT_FIELD_NAMES,
730         redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
731         reference::DEREF_ADDROF,
732         reference::REF_IN_DEREF,
733         regex::INVALID_REGEX,
734         regex::REGEX_MACRO,
735         regex::TRIVIAL_REGEX,
736         returns::LET_AND_RETURN,
737         returns::NEEDLESS_RETURN,
738         returns::UNUSED_UNIT,
739         serde_api::SERDE_API_MISUSE,
740         slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
741         strings::STRING_LIT_AS_BYTES,
742         suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
743         suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
744         swap::ALMOST_SWAPPED,
745         swap::MANUAL_SWAP,
746         temporary_assignment::TEMPORARY_ASSIGNMENT,
747         transmute::CROSSPOINTER_TRANSMUTE,
748         transmute::TRANSMUTE_BYTES_TO_STR,
749         transmute::TRANSMUTE_INT_TO_BOOL,
750         transmute::TRANSMUTE_INT_TO_CHAR,
751         transmute::TRANSMUTE_INT_TO_FLOAT,
752         transmute::TRANSMUTE_PTR_TO_PTR,
753         transmute::TRANSMUTE_PTR_TO_REF,
754         transmute::USELESS_TRANSMUTE,
755         transmute::WRONG_TRANSMUTE,
756         trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
757         types::ABSURD_EXTREME_COMPARISONS,
758         types::BORROWED_BOX,
759         types::BOX_VEC,
760         types::CAST_LOSSLESS,
761         types::CAST_PTR_ALIGNMENT,
762         types::CAST_REF_TO_MUT,
763         types::CHAR_LIT_AS_U8,
764         types::FN_TO_NUMERIC_CAST,
765         types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
766         types::IMPLICIT_HASHER,
767         types::LET_UNIT_VALUE,
768         types::OPTION_OPTION,
769         types::TYPE_COMPLEXITY,
770         types::UNIT_ARG,
771         types::UNIT_CMP,
772         types::UNNECESSARY_CAST,
773         types::VEC_BOX,
774         unicode::ZERO_WIDTH_SPACE,
775         unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
776         unused_io_amount::UNUSED_IO_AMOUNT,
777         unused_label::UNUSED_LABEL,
778         vec::USELESS_VEC,
779         write::PRINTLN_EMPTY_STRING,
780         write::PRINT_LITERAL,
781         write::PRINT_WITH_NEWLINE,
782         write::WRITELN_EMPTY_STRING,
783         write::WRITE_LITERAL,
784         write::WRITE_WITH_NEWLINE,
785         zero_div_zero::ZERO_DIVIDED_BY_ZERO,
786     ]);
787
788     reg.register_lint_group("clippy::style", Some("clippy_style"), vec![
789         assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
790         assign_ops::ASSIGN_OP_PATTERN,
791         attrs::UNKNOWN_CLIPPY_LINTS,
792         bit_mask::VERBOSE_BIT_MASK,
793         blacklisted_name::BLACKLISTED_NAME,
794         block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
795         block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
796         collapsible_if::COLLAPSIBLE_IF,
797         const_static_lifetime::CONST_STATIC_LIFETIME,
798         enum_variants::ENUM_VARIANT_NAMES,
799         enum_variants::MODULE_INCEPTION,
800         eq_op::OP_REF,
801         eta_reduction::REDUNDANT_CLOSURE,
802         excessive_precision::EXCESSIVE_PRECISION,
803         formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
804         formatting::SUSPICIOUS_ELSE_FORMATTING,
805         infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
806         len_zero::LEN_WITHOUT_IS_EMPTY,
807         len_zero::LEN_ZERO,
808         let_if_seq::USELESS_LET_IF_SEQ,
809         literal_representation::INCONSISTENT_DIGIT_GROUPING,
810         literal_representation::UNREADABLE_LITERAL,
811         loops::EMPTY_LOOP,
812         loops::FOR_KV_MAP,
813         loops::NEEDLESS_RANGE_LOOP,
814         loops::WHILE_LET_ON_ITERATOR,
815         map_clone::MAP_CLONE,
816         matches::MATCH_BOOL,
817         matches::MATCH_OVERLAPPING_ARM,
818         matches::MATCH_REF_PATS,
819         matches::MATCH_WILD_ERR_ARM,
820         matches::SINGLE_MATCH,
821         mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
822         methods::CHARS_LAST_CMP,
823         methods::GET_UNWRAP,
824         methods::INTO_ITER_ON_REF,
825         methods::ITER_CLONED_COLLECT,
826         methods::ITER_SKIP_NEXT,
827         methods::NEW_RET_NO_SELF,
828         methods::OK_EXPECT,
829         methods::OPTION_MAP_OR_NONE,
830         methods::SHOULD_IMPLEMENT_TRAIT,
831         methods::STRING_EXTEND_CHARS,
832         methods::UNNECESSARY_FOLD,
833         methods::WRONG_SELF_CONVENTION,
834         misc::REDUNDANT_PATTERN,
835         misc::TOPLEVEL_REF_ARG,
836         misc::ZERO_PTR,
837         misc_early::BUILTIN_TYPE_SHADOW,
838         misc_early::DOUBLE_NEG,
839         misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
840         misc_early::MIXED_CASE_HEX_LITERALS,
841         misc_early::UNNEEDED_FIELD_PATTERN,
842         mut_reference::UNNECESSARY_MUT_PASSED,
843         neg_multiply::NEG_MULTIPLY,
844         new_without_default::NEW_WITHOUT_DEFAULT,
845         non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
846         non_expressive_names::MANY_SINGLE_CHAR_NAMES,
847         ok_if_let::IF_LET_SOME_RESULT,
848         panic_unimplemented::PANIC_PARAMS,
849         ptr::CMP_NULL,
850         ptr::PTR_ARG,
851         question_mark::QUESTION_MARK,
852         redundant_field_names::REDUNDANT_FIELD_NAMES,
853         redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
854         regex::REGEX_MACRO,
855         regex::TRIVIAL_REGEX,
856         returns::LET_AND_RETURN,
857         returns::NEEDLESS_RETURN,
858         returns::UNUSED_UNIT,
859         strings::STRING_LIT_AS_BYTES,
860         types::FN_TO_NUMERIC_CAST,
861         types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
862         types::IMPLICIT_HASHER,
863         types::LET_UNIT_VALUE,
864         unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
865         write::PRINTLN_EMPTY_STRING,
866         write::PRINT_LITERAL,
867         write::PRINT_WITH_NEWLINE,
868         write::WRITELN_EMPTY_STRING,
869         write::WRITE_LITERAL,
870         write::WRITE_WITH_NEWLINE,
871     ]);
872
873     reg.register_lint_group("clippy::complexity", Some("clippy_complexity"), vec![
874         assign_ops::MISREFACTORED_ASSIGN_OP,
875         attrs::DEPRECATED_CFG_ATTR,
876         booleans::NONMINIMAL_BOOL,
877         cyclomatic_complexity::CYCLOMATIC_COMPLEXITY,
878         double_comparison::DOUBLE_COMPARISONS,
879         double_parens::DOUBLE_PARENS,
880         duration_subsec::DURATION_SUBSEC,
881         eval_order_dependence::DIVERGING_SUB_EXPRESSION,
882         eval_order_dependence::EVAL_ORDER_DEPENDENCE,
883         explicit_write::EXPLICIT_WRITE,
884         format::USELESS_FORMAT,
885         functions::TOO_MANY_ARGUMENTS,
886         identity_conversion::IDENTITY_CONVERSION,
887         identity_op::IDENTITY_OP,
888         int_plus_one::INT_PLUS_ONE,
889         lifetimes::EXTRA_UNUSED_LIFETIMES,
890         lifetimes::NEEDLESS_LIFETIMES,
891         loops::EXPLICIT_COUNTER_LOOP,
892         loops::MUT_RANGE_BOUND,
893         loops::WHILE_LET_LOOP,
894         map_unit_fn::OPTION_MAP_UNIT_FN,
895         map_unit_fn::RESULT_MAP_UNIT_FN,
896         matches::MATCH_AS_REF,
897         methods::CHARS_NEXT_CMP,
898         methods::CLONE_ON_COPY,
899         methods::FILTER_NEXT,
900         methods::SEARCH_IS_SOME,
901         methods::UNNECESSARY_FILTER_MAP,
902         methods::USELESS_ASREF,
903         misc::SHORT_CIRCUIT_STATEMENT,
904         misc_early::REDUNDANT_CLOSURE_CALL,
905         misc_early::ZERO_PREFIXED_LITERAL,
906         needless_bool::BOOL_COMPARISON,
907         needless_bool::NEEDLESS_BOOL,
908         needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
909         needless_update::NEEDLESS_UPDATE,
910         neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
911         no_effect::NO_EFFECT,
912         no_effect::UNNECESSARY_OPERATION,
913         overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
914         partialeq_ne_impl::PARTIALEQ_NE_IMPL,
915         precedence::PRECEDENCE,
916         ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
917         ranges::RANGE_MINUS_ONE,
918         ranges::RANGE_PLUS_ONE,
919         ranges::RANGE_ZIP_WITH_LEN,
920         reference::DEREF_ADDROF,
921         reference::REF_IN_DEREF,
922         swap::MANUAL_SWAP,
923         temporary_assignment::TEMPORARY_ASSIGNMENT,
924         transmute::CROSSPOINTER_TRANSMUTE,
925         transmute::TRANSMUTE_BYTES_TO_STR,
926         transmute::TRANSMUTE_INT_TO_BOOL,
927         transmute::TRANSMUTE_INT_TO_CHAR,
928         transmute::TRANSMUTE_INT_TO_FLOAT,
929         transmute::TRANSMUTE_PTR_TO_PTR,
930         transmute::TRANSMUTE_PTR_TO_REF,
931         transmute::USELESS_TRANSMUTE,
932         types::BORROWED_BOX,
933         types::CAST_LOSSLESS,
934         types::CHAR_LIT_AS_U8,
935         types::OPTION_OPTION,
936         types::TYPE_COMPLEXITY,
937         types::UNIT_ARG,
938         types::UNNECESSARY_CAST,
939         types::VEC_BOX,
940         unused_label::UNUSED_LABEL,
941         zero_div_zero::ZERO_DIVIDED_BY_ZERO,
942     ]);
943
944     reg.register_lint_group("clippy::correctness", Some("clippy_correctness"), vec![
945         approx_const::APPROX_CONSTANT,
946         attrs::DEPRECATED_SEMVER,
947         attrs::USELESS_ATTRIBUTE,
948         bit_mask::BAD_BIT_MASK,
949         bit_mask::INEFFECTIVE_BIT_MASK,
950         booleans::LOGIC_BUG,
951         copies::IFS_SAME_COND,
952         copies::IF_SAME_THEN_ELSE,
953         derive::DERIVE_HASH_XOR_EQ,
954         drop_forget_ref::DROP_COPY,
955         drop_forget_ref::DROP_REF,
956         drop_forget_ref::FORGET_COPY,
957         drop_forget_ref::FORGET_REF,
958         enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
959         eq_op::EQ_OP,
960         erasing_op::ERASING_OP,
961         formatting::POSSIBLE_MISSING_COMMA,
962         functions::NOT_UNSAFE_PTR_ARG_DEREF,
963         indexing_slicing::OUT_OF_BOUNDS_INDEXING,
964         infinite_iter::INFINITE_ITER,
965         inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
966         invalid_ref::INVALID_REF,
967         literal_representation::MISTYPED_LITERAL_SUFFIXES,
968         loops::FOR_LOOP_OVER_OPTION,
969         loops::FOR_LOOP_OVER_RESULT,
970         loops::ITER_NEXT_LOOP,
971         loops::NEVER_LOOP,
972         loops::REVERSE_RANGE_LOOP,
973         loops::WHILE_IMMUTABLE_CONDITION,
974         mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
975         methods::CLONE_DOUBLE_REF,
976         methods::INTO_ITER_ON_ARRAY,
977         methods::TEMPORARY_CSTRING_AS_PTR,
978         minmax::MIN_MAX,
979         misc::CMP_NAN,
980         misc::FLOAT_CMP,
981         misc::MODULO_ONE,
982         non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
983         non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
984         open_options::NONSENSICAL_OPEN_OPTIONS,
985         ptr::MUT_FROM_REF,
986         ranges::ITERATOR_STEP_BY_ZERO,
987         regex::INVALID_REGEX,
988         serde_api::SERDE_API_MISUSE,
989         suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
990         suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
991         swap::ALMOST_SWAPPED,
992         transmute::WRONG_TRANSMUTE,
993         types::ABSURD_EXTREME_COMPARISONS,
994         types::CAST_PTR_ALIGNMENT,
995         types::CAST_REF_TO_MUT,
996         types::UNIT_CMP,
997         unicode::ZERO_WIDTH_SPACE,
998         unused_io_amount::UNUSED_IO_AMOUNT,
999     ]);
1000
1001     reg.register_lint_group("clippy::perf", Some("clippy_perf"), vec![
1002         bytecount::NAIVE_BYTECOUNT,
1003         entry::MAP_ENTRY,
1004         escape::BOXED_LOCAL,
1005         large_enum_variant::LARGE_ENUM_VARIANT,
1006         loops::MANUAL_MEMCPY,
1007         loops::NEEDLESS_COLLECT,
1008         loops::UNUSED_COLLECT,
1009         methods::EXPECT_FUN_CALL,
1010         methods::ITER_NTH,
1011         methods::OR_FUN_CALL,
1012         methods::SINGLE_CHAR_PATTERN,
1013         misc::CMP_OWNED,
1014         mutex_atomic::MUTEX_ATOMIC,
1015         slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
1016         trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
1017         types::BOX_VEC,
1018         vec::USELESS_VEC,
1019     ]);
1020
1021     reg.register_lint_group("clippy::cargo", Some("clippy_cargo"), vec![
1022         cargo_common_metadata::CARGO_COMMON_METADATA,
1023         multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
1024         wildcard_dependencies::WILDCARD_DEPENDENCIES,
1025     ]);
1026
1027     reg.register_lint_group("clippy::nursery", Some("clippy_nursery"), vec![
1028         attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
1029         fallible_impl_from::FALLIBLE_IMPL_FROM,
1030         mutex_atomic::MUTEX_INTEGER,
1031         needless_borrow::NEEDLESS_BORROW,
1032         redundant_clone::REDUNDANT_CLONE,
1033         unwrap::PANICKING_UNWRAP,
1034         unwrap::UNNECESSARY_UNWRAP,
1035     ]);
1036 }
1037
1038 pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
1039     ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1040     ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
1041 }
1042
1043 // only exists to let the dogfood integration test works.
1044 // Don't run clippy as an executable directly
1045 #[allow(dead_code)]
1046 fn main() {
1047     panic!("Please use the cargo-clippy executable");
1048 }