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