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