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