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