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