1 // error-pattern:cargo-clippy
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(rustc::internal)]
12 #![feature(crate_visibility_modifier)]
13 #![feature(concat_idents)]
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)]
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)]
35 #[allow(unused_extern_crates)]
36 extern crate syntax_pos;
40 /// Macro used to declare a Clippy lint.
42 /// Every lint declaration consists of 4 parts:
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.
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
58 /// # #![feature(rustc_private)]
59 /// # #[allow(unused_extern_crates)]
60 /// # extern crate rustc;
62 /// # use clippy_lints::declare_clippy_lint;
63 /// use rustc::declare_tool_lint;
65 /// declare_clippy_lint! {
66 /// /// **What it does:** Checks for ... (describe what the lint matches).
68 /// /// **Why is this bad?** Supply the reason for linting the code.
70 /// /// **Known problems:** None. (Or describe where it could go wrong.)
76 /// /// Insert a short example of code that triggers the lint
79 /// /// Insert a short example of improved code that doesn't trigger the lint
86 /// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
88 macro_rules! declare_clippy_lint {
89 { $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
91 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
94 { $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
96 $(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
99 { $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
101 pub clippy::$name, Warn, $description, report_in_external_macro: true
104 { $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
106 pub clippy::$name, Warn, $description, report_in_external_macro: true
109 { $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
111 pub clippy::$name, Allow, $description, report_in_external_macro: true
114 { $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
116 pub clippy::$name, Allow, $description, report_in_external_macro: true
119 { $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
121 pub clippy::$name, Allow, $description, report_in_external_macro: true
124 { $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
126 pub clippy::$name, Allow, $description, report_in_external_macro: true
129 { $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
131 pub clippy::$name, Allow, $description, report_in_external_macro: true
134 { $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
136 pub clippy::$name, Warn, $description, report_in_external_macro: true
145 // begin lints modules, do not remove this comment, it’s used in `update_lints`
146 pub mod approx_const;
148 pub mod assertions_on_constants;
152 pub mod blacklisted_name;
153 pub mod block_in_if_condition;
156 pub mod cargo_common_metadata;
157 pub mod checked_conversions;
158 pub mod cognitive_complexity;
159 pub mod collapsible_if;
161 pub mod copy_iterator;
163 pub mod default_trait_access;
166 pub mod double_comparison;
167 pub mod double_parens;
169 pub mod drop_forget_ref;
170 pub mod duration_subsec;
171 pub mod else_if_without_else;
175 pub mod enum_glob_use;
176 pub mod enum_variants;
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;
188 pub mod get_last_with_len;
189 pub mod identity_conversion;
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;
201 pub mod items_after_statements;
202 pub mod large_enum_variant;
206 pub mod literal_representation;
211 pub mod mem_discriminant;
218 pub mod missing_const_for_fn;
220 pub mod missing_inline;
221 pub mod multiple_crate_versions;
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;
235 pub mod non_copy_const;
236 pub mod non_expressive_names;
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;
245 pub mod ptr_offset_with_cast;
246 pub mod question_mark;
248 pub mod redundant_clone;
249 pub mod redundant_field_names;
250 pub mod redundant_pattern_matching;
251 pub mod redundant_static_lifetimes;
254 pub mod replace_consts;
258 pub mod slow_vector_initialization;
260 pub mod suspicious_trait_impl;
262 pub mod temporary_assignment;
264 pub mod transmuting_null;
265 pub mod trivially_copy_pass_by_ref;
269 pub mod unsafe_removed_from_name;
270 pub mod unused_io_amount;
271 pub mod unused_label;
275 pub mod wildcard_dependencies;
277 pub mod zero_div_zero;
278 // end lints modules, do not remove this comment, it’s used in `update_lints`
280 pub use crate::utils::conf::Conf;
283 crate use syntax::ast::Name;
286 /// Register all pre expansion lints
288 /// Pre-expansion lints run before any macro expansion has happened.
290 /// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
291 /// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
293 /// Used in `./src/driver.rs`.
294 pub fn register_pre_expansion_lints(
295 session: &rustc::session::Session,
296 store: &mut rustc::lint::LintStore,
299 store.register_pre_expansion_pass(Some(session), true, false, box write::Write);
300 store.register_pre_expansion_pass(
304 box redundant_field_names::RedundantFieldNames,
306 store.register_pre_expansion_pass(
310 box non_expressive_names::NonExpressiveNames {
311 single_char_binding_names_threshold: conf.single_char_binding_names_threshold,
314 store.register_pre_expansion_pass(Some(session), true, false, box attrs::DeprecatedCfgAttribute);
315 store.register_pre_expansion_pass(Some(session), true, false, box dbg_macro::DbgMacro);
319 pub fn read_conf(reg: &rustc_plugin::Registry<'_>) -> Conf {
320 match utils::conf::file_from_args(reg.args()) {
322 // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
323 // do not require the file to exist
324 let file_name = if let Some(file_name) = file_name {
327 match utils::conf::lookup_conf_file() {
331 .struct_err(&format!("error finding Clippy's configuration file: {}", error))
338 let file_name = file_name.map(|file_name| {
339 if file_name.is_relative() {
341 .local_crate_source_file
343 .and_then(|file| std::path::Path::new(&file).parent().map(std::path::Path::to_path_buf))
351 let (conf, errors) = utils::conf::read(file_name.as_ref().map(std::convert::AsRef::as_ref));
353 // all conf errors are non-fatal, we just use the default conf in case of error
354 for error in errors {
356 .struct_err(&format!(
357 "error reading Clippy's configuration file `{}`: {}",
358 file_name.as_ref().and_then(|p| p.to_str()).unwrap_or(""),
366 Err((err, span)) => {
368 .struct_span_err(span, err)
369 .span_note(span, "Clippy will use default configuration")
371 toml::from_str("").expect("we never error on empty config files")
376 /// Register all lints and lint groups with the rustc plugin registry
378 /// Used in `./src/driver.rs`.
379 #[allow(clippy::too_many_lines)]
381 pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
382 let mut store = reg.sess.lint_store.borrow_mut();
383 // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
384 store.register_removed(
386 "`assert!()` will be more flexible with RFC 2011",
388 store.register_removed(
390 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
392 store.register_removed(
393 "range_step_by_zero",
394 "`iterator.step_by(0)` panics nowadays",
396 store.register_removed(
398 "`Vec::as_slice` has been stabilized in 1.7",
400 store.register_removed(
401 "unstable_as_mut_slice",
402 "`Vec::as_mut_slice` has been stabilized in 1.7",
404 store.register_removed(
406 "using `str::to_string` is common even today and specialization will likely happen soon",
408 store.register_removed(
410 "using `string::to_string` is common even today and specialization will likely happen soon",
412 store.register_removed(
413 "misaligned_transmute",
414 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
416 store.register_removed(
418 "using compound assignment operators (e.g., `+=`) is harmless",
420 store.register_removed(
421 "if_let_redundant_pattern_matching",
422 "this lint has been changed to redundant_pattern_matching",
424 store.register_removed(
425 "unsafe_vector_initialization",
426 "the replacement suggested by this lint had substantially different behavior",
428 // end deprecated lints, do not remove this comment, it’s used in `update_lints`
430 reg.register_late_lint_pass(box serde_api::SerdeAPI);
431 reg.register_early_lint_pass(box utils::internal_lints::ClippyLintsInternal);
432 reg.register_late_lint_pass(box utils::internal_lints::CompilerLintFunctions::new());
433 reg.register_late_lint_pass(box utils::internal_lints::LintWithoutLintPass::default());
434 reg.register_late_lint_pass(box utils::internal_lints::OuterExpnInfoPass);
435 reg.register_late_lint_pass(box utils::inspector::DeepCodeInspector);
436 reg.register_late_lint_pass(box utils::author::Author);
437 reg.register_late_lint_pass(box types::Types);
438 reg.register_late_lint_pass(box booleans::NonminimalBool);
439 reg.register_late_lint_pass(box eq_op::EqOp);
440 reg.register_early_lint_pass(box enum_variants::EnumVariantNames::new(conf.enum_variant_name_threshold));
441 reg.register_late_lint_pass(box enum_glob_use::EnumGlobUse);
442 reg.register_late_lint_pass(box enum_clike::UnportableVariant);
443 reg.register_late_lint_pass(box excessive_precision::ExcessivePrecision);
444 reg.register_late_lint_pass(box bit_mask::BitMask::new(conf.verbose_bit_mask_threshold));
445 reg.register_late_lint_pass(box ptr::Ptr);
446 reg.register_late_lint_pass(box needless_bool::NeedlessBool);
447 reg.register_late_lint_pass(box needless_bool::BoolComparison);
448 reg.register_late_lint_pass(box approx_const::ApproxConstant);
449 reg.register_late_lint_pass(box misc::MiscLints);
450 reg.register_early_lint_pass(box precedence::Precedence);
451 reg.register_early_lint_pass(box needless_continue::NeedlessContinue);
452 reg.register_late_lint_pass(box eta_reduction::EtaReduction);
453 reg.register_late_lint_pass(box identity_op::IdentityOp);
454 reg.register_late_lint_pass(box erasing_op::ErasingOp);
455 reg.register_early_lint_pass(box items_after_statements::ItemsAfterStatements);
456 reg.register_late_lint_pass(box mut_mut::MutMut);
457 reg.register_late_lint_pass(box mut_reference::UnnecessaryMutPassed);
458 reg.register_late_lint_pass(box len_zero::LenZero);
459 reg.register_late_lint_pass(box attrs::Attributes);
460 reg.register_early_lint_pass(box collapsible_if::CollapsibleIf);
461 reg.register_late_lint_pass(box block_in_if_condition::BlockInIfCondition);
462 reg.register_late_lint_pass(box unicode::Unicode);
463 reg.register_late_lint_pass(box strings::StringAdd);
464 reg.register_early_lint_pass(box returns::Return);
465 reg.register_late_lint_pass(box implicit_return::ImplicitReturn);
466 reg.register_late_lint_pass(box methods::Methods);
467 reg.register_late_lint_pass(box map_clone::MapClone);
468 reg.register_late_lint_pass(box shadow::Shadow);
469 reg.register_late_lint_pass(box types::LetUnitValue);
470 reg.register_late_lint_pass(box types::UnitCmp);
471 reg.register_late_lint_pass(box loops::Loops);
472 reg.register_late_lint_pass(box lifetimes::Lifetimes);
473 reg.register_late_lint_pass(box entry::HashMapPass);
474 reg.register_late_lint_pass(box ranges::Ranges);
475 reg.register_late_lint_pass(box types::Casts);
476 reg.register_late_lint_pass(box types::TypeComplexity::new(conf.type_complexity_threshold));
477 reg.register_late_lint_pass(box matches::Matches);
478 reg.register_late_lint_pass(box minmax::MinMaxPass);
479 reg.register_late_lint_pass(box open_options::OpenOptions);
480 reg.register_late_lint_pass(box zero_div_zero::ZeroDiv);
481 reg.register_late_lint_pass(box mutex_atomic::Mutex);
482 reg.register_late_lint_pass(box needless_update::NeedlessUpdate);
483 reg.register_late_lint_pass(box needless_borrow::NeedlessBorrow::default());
484 reg.register_late_lint_pass(box needless_borrowed_ref::NeedlessBorrowedRef);
485 reg.register_late_lint_pass(box no_effect::NoEffect);
486 reg.register_late_lint_pass(box temporary_assignment::TemporaryAssignment);
487 reg.register_late_lint_pass(box transmute::Transmute);
488 reg.register_late_lint_pass(
489 box cognitive_complexity::CognitiveComplexity::new(conf.cognitive_complexity_threshold)
491 reg.register_late_lint_pass(box escape::BoxedLocal{too_large_for_stack: conf.too_large_for_stack});
492 reg.register_early_lint_pass(box misc_early::MiscEarlyLints);
493 reg.register_late_lint_pass(box panic_unimplemented::PanicUnimplemented);
494 reg.register_late_lint_pass(box strings::StringLitAsBytes);
495 reg.register_late_lint_pass(box derive::Derive);
496 reg.register_late_lint_pass(box types::CharLitAsU8);
497 reg.register_late_lint_pass(box vec::UselessVec);
498 reg.register_late_lint_pass(box drop_bounds::DropBounds);
499 reg.register_late_lint_pass(box get_last_with_len::GetLastWithLen);
500 reg.register_late_lint_pass(box drop_forget_ref::DropForgetRef);
501 reg.register_late_lint_pass(box empty_enum::EmptyEnum);
502 reg.register_late_lint_pass(box types::AbsurdExtremeComparisons);
503 reg.register_late_lint_pass(box types::InvalidUpcastComparisons);
504 reg.register_late_lint_pass(box regex::Regex::default());
505 reg.register_late_lint_pass(box copies::CopyAndPaste);
506 reg.register_late_lint_pass(box copy_iterator::CopyIterator);
507 reg.register_late_lint_pass(box format::UselessFormat);
508 reg.register_early_lint_pass(box formatting::Formatting);
509 reg.register_late_lint_pass(box swap::Swap);
510 reg.register_early_lint_pass(box if_not_else::IfNotElse);
511 reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse);
512 reg.register_early_lint_pass(box int_plus_one::IntPlusOne);
513 reg.register_late_lint_pass(box overflow_check_conditional::OverflowCheckConditional);
514 reg.register_late_lint_pass(box unused_label::UnusedLabel);
515 reg.register_late_lint_pass(box new_without_default::NewWithoutDefault::default());
516 reg.register_late_lint_pass(box blacklisted_name::BlacklistedName::new(
517 conf.blacklisted_names.iter().cloned().collect()
519 reg.register_late_lint_pass(box functions::Functions::new(conf.too_many_arguments_threshold, conf.too_many_lines_threshold));
520 reg.register_early_lint_pass(box doc::DocMarkdown::new(conf.doc_valid_idents.iter().cloned().collect()));
521 reg.register_late_lint_pass(box neg_multiply::NegMultiply);
522 reg.register_early_lint_pass(box unsafe_removed_from_name::UnsafeNameRemoval);
523 reg.register_late_lint_pass(box mem_discriminant::MemDiscriminant);
524 reg.register_late_lint_pass(box mem_forget::MemForget);
525 reg.register_late_lint_pass(box mem_replace::MemReplace);
526 reg.register_late_lint_pass(box arithmetic::Arithmetic::default());
527 reg.register_late_lint_pass(box assign_ops::AssignOps);
528 reg.register_late_lint_pass(box let_if_seq::LetIfSeq);
529 reg.register_late_lint_pass(box eval_order_dependence::EvalOrderDependence);
530 reg.register_late_lint_pass(box missing_doc::MissingDoc::new());
531 reg.register_late_lint_pass(box missing_inline::MissingInline);
532 reg.register_late_lint_pass(box ok_if_let::OkIfLet);
533 reg.register_late_lint_pass(box redundant_pattern_matching::RedundantPatternMatching);
534 reg.register_late_lint_pass(box partialeq_ne_impl::PartialEqNeImpl);
535 reg.register_early_lint_pass(box reference::DerefAddrOf);
536 reg.register_early_lint_pass(box reference::RefInDeref);
537 reg.register_early_lint_pass(box double_parens::DoubleParens);
538 reg.register_late_lint_pass(box unused_io_amount::UnusedIoAmount);
539 reg.register_late_lint_pass(box large_enum_variant::LargeEnumVariant::new(conf.enum_variant_size_threshold));
540 reg.register_late_lint_pass(box explicit_write::ExplicitWrite);
541 reg.register_late_lint_pass(box needless_pass_by_value::NeedlessPassByValue);
542 reg.register_late_lint_pass(box trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
543 conf.trivial_copy_size_limit,
546 reg.register_early_lint_pass(box literal_representation::LiteralDigitGrouping);
547 reg.register_early_lint_pass(box literal_representation::DecimalLiteralRepresentation::new(
548 conf.literal_representation_threshold
550 reg.register_late_lint_pass(box try_err::TryErr);
551 reg.register_late_lint_pass(box use_self::UseSelf);
552 reg.register_late_lint_pass(box bytecount::ByteCount);
553 reg.register_late_lint_pass(box infinite_iter::InfiniteIter);
554 reg.register_late_lint_pass(box inline_fn_without_body::InlineFnWithoutBody);
555 reg.register_late_lint_pass(box invalid_ref::InvalidRef);
556 reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
557 reg.register_late_lint_pass(box types::ImplicitHasher);
558 reg.register_early_lint_pass(box redundant_static_lifetimes::RedundantStaticLifetimes);
559 reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom);
560 reg.register_late_lint_pass(box replace_consts::ReplaceConsts);
561 reg.register_late_lint_pass(box types::UnitArg);
562 reg.register_late_lint_pass(box double_comparison::DoubleComparisons);
563 reg.register_late_lint_pass(box question_mark::QuestionMark);
564 reg.register_late_lint_pass(box suspicious_trait_impl::SuspiciousImpl);
565 reg.register_early_lint_pass(box cargo_common_metadata::CargoCommonMetadata);
566 reg.register_early_lint_pass(box multiple_crate_versions::MultipleCrateVersions);
567 reg.register_early_lint_pass(box wildcard_dependencies::WildcardDependencies);
568 reg.register_late_lint_pass(box map_unit_fn::MapUnit);
569 reg.register_late_lint_pass(box infallible_destructuring_match::InfallibleDestructingMatch);
570 reg.register_late_lint_pass(box inherent_impl::MultipleInherentImpl::default());
571 reg.register_late_lint_pass(box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
572 reg.register_late_lint_pass(box unwrap::Unwrap);
573 reg.register_late_lint_pass(box duration_subsec::DurationSubsec);
574 reg.register_late_lint_pass(box default_trait_access::DefaultTraitAccess);
575 reg.register_late_lint_pass(box indexing_slicing::IndexingSlicing);
576 reg.register_late_lint_pass(box non_copy_const::NonCopyConst);
577 reg.register_late_lint_pass(box ptr_offset_with_cast::PtrOffsetWithCast);
578 reg.register_late_lint_pass(box redundant_clone::RedundantClone);
579 reg.register_late_lint_pass(box slow_vector_initialization::SlowVectorInit);
580 reg.register_late_lint_pass(box types::RefToMut);
581 reg.register_late_lint_pass(box assertions_on_constants::AssertionsOnConstants);
582 reg.register_late_lint_pass(box missing_const_for_fn::MissingConstForFn);
583 reg.register_late_lint_pass(box transmuting_null::TransmutingNull);
584 reg.register_late_lint_pass(box path_buf_push_overwrite::PathBufPushOverwrite);
585 reg.register_late_lint_pass(box checked_conversions::CheckedConversions);
586 reg.register_late_lint_pass(box integer_division::IntegerDivision);
588 reg.register_lint_group("clippy::restriction", Some("clippy_restriction"), vec![
589 arithmetic::FLOAT_ARITHMETIC,
590 arithmetic::INTEGER_ARITHMETIC,
591 dbg_macro::DBG_MACRO,
592 else_if_without_else::ELSE_IF_WITHOUT_ELSE,
593 implicit_return::IMPLICIT_RETURN,
594 indexing_slicing::INDEXING_SLICING,
595 inherent_impl::MULTIPLE_INHERENT_IMPL,
596 integer_division::INTEGER_DIVISION,
597 literal_representation::DECIMAL_LITERAL_REPRESENTATION,
598 matches::WILDCARD_ENUM_MATCH_ARM,
599 mem_forget::MEM_FORGET,
600 methods::CLONE_ON_REF_PTR,
602 methods::OPTION_UNWRAP_USED,
603 methods::RESULT_UNWRAP_USED,
604 methods::WRONG_PUB_SELF_CONVENTION,
605 misc::FLOAT_CMP_CONST,
606 missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
607 missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
608 panic_unimplemented::UNIMPLEMENTED,
609 shadow::SHADOW_REUSE,
616 reg.register_lint_group("clippy::pedantic", Some("clippy_pedantic"), vec![
617 attrs::INLINE_ALWAYS,
618 checked_conversions::CHECKED_CONVERSIONS,
619 copies::MATCH_SAME_ARMS,
620 copy_iterator::COPY_ITERATOR,
621 default_trait_access::DEFAULT_TRAIT_ACCESS,
622 derive::EXPL_IMPL_CLONE_ON_COPY,
624 empty_enum::EMPTY_ENUM,
625 enum_glob_use::ENUM_GLOB_USE,
626 enum_variants::MODULE_NAME_REPETITIONS,
627 enum_variants::PUB_ENUM_VARIANT_NAMES,
628 eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
629 functions::TOO_MANY_LINES,
630 if_not_else::IF_NOT_ELSE,
631 infinite_iter::MAYBE_INFINITE_ITER,
632 items_after_statements::ITEMS_AFTER_STATEMENTS,
633 literal_representation::LARGE_DIGIT_GROUPS,
634 loops::EXPLICIT_INTO_ITER_LOOP,
635 loops::EXPLICIT_ITER_LOOP,
636 matches::SINGLE_MATCH_ELSE,
638 methods::FILTER_MAP_NEXT,
641 methods::MAP_FLATTEN,
642 methods::OPTION_MAP_UNWRAP_OR,
643 methods::OPTION_MAP_UNWRAP_OR_ELSE,
644 methods::RESULT_MAP_UNWRAP_OR_ELSE,
645 misc::USED_UNDERSCORE_BINDING,
646 misc_early::UNSEPARATED_LITERAL_SUFFIX,
648 needless_continue::NEEDLESS_CONTINUE,
649 needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
650 non_expressive_names::SIMILAR_NAMES,
651 replace_consts::REPLACE_CONSTS,
652 shadow::SHADOW_UNRELATED,
653 strings::STRING_ADD_ASSIGN,
654 types::CAST_POSSIBLE_TRUNCATION,
655 types::CAST_POSSIBLE_WRAP,
656 types::CAST_PRECISION_LOSS,
657 types::CAST_SIGN_LOSS,
658 types::INVALID_UPCAST_COMPARISONS,
660 unicode::NON_ASCII_LITERAL,
661 unicode::UNICODE_NOT_NFC,
665 reg.register_lint_group("clippy::internal", Some("clippy_internal"), vec![
666 utils::internal_lints::CLIPPY_LINTS_INTERNAL,
667 utils::internal_lints::COMPILER_LINT_FUNCTIONS,
668 utils::internal_lints::LINT_WITHOUT_LINT_PASS,
669 utils::internal_lints::OUTER_EXPN_INFO,
672 reg.register_lint_group("clippy::all", Some("clippy"), vec![
673 approx_const::APPROX_CONSTANT,
674 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
675 assign_ops::ASSIGN_OP_PATTERN,
676 assign_ops::MISREFACTORED_ASSIGN_OP,
677 attrs::DEPRECATED_CFG_ATTR,
678 attrs::DEPRECATED_SEMVER,
679 attrs::UNKNOWN_CLIPPY_LINTS,
680 attrs::USELESS_ATTRIBUTE,
681 bit_mask::BAD_BIT_MASK,
682 bit_mask::INEFFECTIVE_BIT_MASK,
683 bit_mask::VERBOSE_BIT_MASK,
684 blacklisted_name::BLACKLISTED_NAME,
685 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
686 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
688 booleans::NONMINIMAL_BOOL,
689 bytecount::NAIVE_BYTECOUNT,
690 cognitive_complexity::COGNITIVE_COMPLEXITY,
691 collapsible_if::COLLAPSIBLE_IF,
692 copies::IFS_SAME_COND,
693 copies::IF_SAME_THEN_ELSE,
694 derive::DERIVE_HASH_XOR_EQ,
695 double_comparison::DOUBLE_COMPARISONS,
696 double_parens::DOUBLE_PARENS,
697 drop_bounds::DROP_BOUNDS,
698 drop_forget_ref::DROP_COPY,
699 drop_forget_ref::DROP_REF,
700 drop_forget_ref::FORGET_COPY,
701 drop_forget_ref::FORGET_REF,
702 duration_subsec::DURATION_SUBSEC,
704 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
705 enum_variants::ENUM_VARIANT_NAMES,
706 enum_variants::MODULE_INCEPTION,
709 erasing_op::ERASING_OP,
711 eta_reduction::REDUNDANT_CLOSURE,
712 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
713 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
714 excessive_precision::EXCESSIVE_PRECISION,
715 explicit_write::EXPLICIT_WRITE,
716 format::USELESS_FORMAT,
717 formatting::POSSIBLE_MISSING_COMMA,
718 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
719 formatting::SUSPICIOUS_ELSE_FORMATTING,
720 functions::NOT_UNSAFE_PTR_ARG_DEREF,
721 functions::TOO_MANY_ARGUMENTS,
722 get_last_with_len::GET_LAST_WITH_LEN,
723 identity_conversion::IDENTITY_CONVERSION,
724 identity_op::IDENTITY_OP,
725 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
726 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
727 infinite_iter::INFINITE_ITER,
728 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
729 int_plus_one::INT_PLUS_ONE,
730 invalid_ref::INVALID_REF,
731 large_enum_variant::LARGE_ENUM_VARIANT,
732 len_zero::LEN_WITHOUT_IS_EMPTY,
734 let_if_seq::USELESS_LET_IF_SEQ,
735 lifetimes::EXTRA_UNUSED_LIFETIMES,
736 lifetimes::NEEDLESS_LIFETIMES,
737 literal_representation::INCONSISTENT_DIGIT_GROUPING,
738 literal_representation::MISTYPED_LITERAL_SUFFIXES,
739 literal_representation::UNREADABLE_LITERAL,
741 loops::EXPLICIT_COUNTER_LOOP,
743 loops::FOR_LOOP_OVER_OPTION,
744 loops::FOR_LOOP_OVER_RESULT,
745 loops::ITER_NEXT_LOOP,
746 loops::MANUAL_MEMCPY,
747 loops::MUT_RANGE_BOUND,
748 loops::NEEDLESS_COLLECT,
749 loops::NEEDLESS_RANGE_LOOP,
751 loops::REVERSE_RANGE_LOOP,
752 loops::UNUSED_COLLECT,
753 loops::WHILE_IMMUTABLE_CONDITION,
754 loops::WHILE_LET_LOOP,
755 loops::WHILE_LET_ON_ITERATOR,
756 map_clone::MAP_CLONE,
757 map_unit_fn::OPTION_MAP_UNIT_FN,
758 map_unit_fn::RESULT_MAP_UNIT_FN,
759 matches::MATCH_AS_REF,
761 matches::MATCH_OVERLAPPING_ARM,
762 matches::MATCH_REF_PATS,
763 matches::MATCH_WILD_ERR_ARM,
764 matches::SINGLE_MATCH,
765 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
766 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
767 methods::CHARS_LAST_CMP,
768 methods::CHARS_NEXT_CMP,
769 methods::CLONE_DOUBLE_REF,
770 methods::CLONE_ON_COPY,
771 methods::EXPECT_FUN_CALL,
772 methods::FILTER_NEXT,
773 methods::INTO_ITER_ON_ARRAY,
774 methods::INTO_ITER_ON_REF,
775 methods::ITER_CLONED_COLLECT,
777 methods::ITER_SKIP_NEXT,
778 methods::NEW_RET_NO_SELF,
780 methods::OPTION_MAP_OR_NONE,
781 methods::OR_FUN_CALL,
782 methods::SEARCH_IS_SOME,
783 methods::SHOULD_IMPLEMENT_TRAIT,
784 methods::SINGLE_CHAR_PATTERN,
785 methods::STRING_EXTEND_CHARS,
786 methods::TEMPORARY_CSTRING_AS_PTR,
787 methods::UNNECESSARY_FILTER_MAP,
788 methods::UNNECESSARY_FOLD,
789 methods::USELESS_ASREF,
790 methods::WRONG_SELF_CONVENTION,
796 misc::REDUNDANT_PATTERN,
797 misc::SHORT_CIRCUIT_STATEMENT,
798 misc::TOPLEVEL_REF_ARG,
800 misc_early::BUILTIN_TYPE_SHADOW,
801 misc_early::DOUBLE_NEG,
802 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
803 misc_early::MIXED_CASE_HEX_LITERALS,
804 misc_early::REDUNDANT_CLOSURE_CALL,
805 misc_early::UNNEEDED_FIELD_PATTERN,
806 misc_early::ZERO_PREFIXED_LITERAL,
807 mut_reference::UNNECESSARY_MUT_PASSED,
808 mutex_atomic::MUTEX_ATOMIC,
809 needless_bool::BOOL_COMPARISON,
810 needless_bool::NEEDLESS_BOOL,
811 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
812 needless_update::NEEDLESS_UPDATE,
813 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
814 neg_multiply::NEG_MULTIPLY,
815 new_without_default::NEW_WITHOUT_DEFAULT,
816 no_effect::NO_EFFECT,
817 no_effect::UNNECESSARY_OPERATION,
818 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
819 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
820 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
821 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
822 ok_if_let::IF_LET_SOME_RESULT,
823 open_options::NONSENSICAL_OPEN_OPTIONS,
824 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
825 panic_unimplemented::PANIC_PARAMS,
826 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
827 precedence::PRECEDENCE,
831 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
832 question_mark::QUESTION_MARK,
833 ranges::ITERATOR_STEP_BY_ZERO,
834 ranges::RANGE_MINUS_ONE,
835 ranges::RANGE_PLUS_ONE,
836 ranges::RANGE_ZIP_WITH_LEN,
837 redundant_field_names::REDUNDANT_FIELD_NAMES,
838 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
839 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
840 reference::DEREF_ADDROF,
841 reference::REF_IN_DEREF,
842 regex::INVALID_REGEX,
844 regex::TRIVIAL_REGEX,
845 returns::LET_AND_RETURN,
846 returns::NEEDLESS_RETURN,
847 returns::UNUSED_UNIT,
848 serde_api::SERDE_API_MISUSE,
849 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
850 strings::STRING_LIT_AS_BYTES,
851 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
852 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
853 swap::ALMOST_SWAPPED,
855 temporary_assignment::TEMPORARY_ASSIGNMENT,
856 transmute::CROSSPOINTER_TRANSMUTE,
857 transmute::TRANSMUTE_BYTES_TO_STR,
858 transmute::TRANSMUTE_INT_TO_BOOL,
859 transmute::TRANSMUTE_INT_TO_CHAR,
860 transmute::TRANSMUTE_INT_TO_FLOAT,
861 transmute::TRANSMUTE_PTR_TO_PTR,
862 transmute::TRANSMUTE_PTR_TO_REF,
863 transmute::USELESS_TRANSMUTE,
864 transmute::WRONG_TRANSMUTE,
865 transmuting_null::TRANSMUTING_NULL,
866 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
868 types::ABSURD_EXTREME_COMPARISONS,
871 types::CAST_LOSSLESS,
872 types::CAST_PTR_ALIGNMENT,
873 types::CAST_REF_TO_MUT,
874 types::CHAR_LIT_AS_U8,
875 types::FN_TO_NUMERIC_CAST,
876 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
877 types::IMPLICIT_HASHER,
878 types::LET_UNIT_VALUE,
879 types::OPTION_OPTION,
880 types::TYPE_COMPLEXITY,
883 types::UNNECESSARY_CAST,
885 unicode::ZERO_WIDTH_SPACE,
886 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
887 unused_io_amount::UNUSED_IO_AMOUNT,
888 unused_label::UNUSED_LABEL,
890 write::PRINTLN_EMPTY_STRING,
891 write::PRINT_LITERAL,
892 write::PRINT_WITH_NEWLINE,
893 write::WRITELN_EMPTY_STRING,
894 write::WRITE_LITERAL,
895 write::WRITE_WITH_NEWLINE,
896 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
899 reg.register_lint_group("clippy::style", Some("clippy_style"), vec![
900 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
901 assign_ops::ASSIGN_OP_PATTERN,
902 attrs::UNKNOWN_CLIPPY_LINTS,
903 bit_mask::VERBOSE_BIT_MASK,
904 blacklisted_name::BLACKLISTED_NAME,
905 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
906 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
907 collapsible_if::COLLAPSIBLE_IF,
908 enum_variants::ENUM_VARIANT_NAMES,
909 enum_variants::MODULE_INCEPTION,
911 eta_reduction::REDUNDANT_CLOSURE,
912 excessive_precision::EXCESSIVE_PRECISION,
913 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
914 formatting::SUSPICIOUS_ELSE_FORMATTING,
915 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
916 len_zero::LEN_WITHOUT_IS_EMPTY,
918 let_if_seq::USELESS_LET_IF_SEQ,
919 literal_representation::INCONSISTENT_DIGIT_GROUPING,
920 literal_representation::UNREADABLE_LITERAL,
923 loops::NEEDLESS_RANGE_LOOP,
924 loops::WHILE_LET_ON_ITERATOR,
925 map_clone::MAP_CLONE,
927 matches::MATCH_OVERLAPPING_ARM,
928 matches::MATCH_REF_PATS,
929 matches::MATCH_WILD_ERR_ARM,
930 matches::SINGLE_MATCH,
931 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
932 methods::CHARS_LAST_CMP,
933 methods::INTO_ITER_ON_REF,
934 methods::ITER_CLONED_COLLECT,
935 methods::ITER_SKIP_NEXT,
936 methods::NEW_RET_NO_SELF,
938 methods::OPTION_MAP_OR_NONE,
939 methods::SHOULD_IMPLEMENT_TRAIT,
940 methods::STRING_EXTEND_CHARS,
941 methods::UNNECESSARY_FOLD,
942 methods::WRONG_SELF_CONVENTION,
943 misc::REDUNDANT_PATTERN,
944 misc::TOPLEVEL_REF_ARG,
946 misc_early::BUILTIN_TYPE_SHADOW,
947 misc_early::DOUBLE_NEG,
948 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
949 misc_early::MIXED_CASE_HEX_LITERALS,
950 misc_early::UNNEEDED_FIELD_PATTERN,
951 mut_reference::UNNECESSARY_MUT_PASSED,
952 neg_multiply::NEG_MULTIPLY,
953 new_without_default::NEW_WITHOUT_DEFAULT,
954 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
955 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
956 ok_if_let::IF_LET_SOME_RESULT,
957 panic_unimplemented::PANIC_PARAMS,
960 question_mark::QUESTION_MARK,
961 redundant_field_names::REDUNDANT_FIELD_NAMES,
962 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
963 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
965 regex::TRIVIAL_REGEX,
966 returns::LET_AND_RETURN,
967 returns::NEEDLESS_RETURN,
968 returns::UNUSED_UNIT,
969 strings::STRING_LIT_AS_BYTES,
971 types::FN_TO_NUMERIC_CAST,
972 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
973 types::IMPLICIT_HASHER,
974 types::LET_UNIT_VALUE,
975 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
976 write::PRINTLN_EMPTY_STRING,
977 write::PRINT_LITERAL,
978 write::PRINT_WITH_NEWLINE,
979 write::WRITELN_EMPTY_STRING,
980 write::WRITE_LITERAL,
981 write::WRITE_WITH_NEWLINE,
984 reg.register_lint_group("clippy::complexity", Some("clippy_complexity"), vec![
985 assign_ops::MISREFACTORED_ASSIGN_OP,
986 attrs::DEPRECATED_CFG_ATTR,
987 booleans::NONMINIMAL_BOOL,
988 cognitive_complexity::COGNITIVE_COMPLEXITY,
989 double_comparison::DOUBLE_COMPARISONS,
990 double_parens::DOUBLE_PARENS,
991 duration_subsec::DURATION_SUBSEC,
992 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
993 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
994 explicit_write::EXPLICIT_WRITE,
995 format::USELESS_FORMAT,
996 functions::TOO_MANY_ARGUMENTS,
997 get_last_with_len::GET_LAST_WITH_LEN,
998 identity_conversion::IDENTITY_CONVERSION,
999 identity_op::IDENTITY_OP,
1000 int_plus_one::INT_PLUS_ONE,
1001 lifetimes::EXTRA_UNUSED_LIFETIMES,
1002 lifetimes::NEEDLESS_LIFETIMES,
1003 loops::EXPLICIT_COUNTER_LOOP,
1004 loops::MUT_RANGE_BOUND,
1005 loops::WHILE_LET_LOOP,
1006 map_unit_fn::OPTION_MAP_UNIT_FN,
1007 map_unit_fn::RESULT_MAP_UNIT_FN,
1008 matches::MATCH_AS_REF,
1009 methods::CHARS_NEXT_CMP,
1010 methods::CLONE_ON_COPY,
1011 methods::FILTER_NEXT,
1012 methods::SEARCH_IS_SOME,
1013 methods::UNNECESSARY_FILTER_MAP,
1014 methods::USELESS_ASREF,
1015 misc::SHORT_CIRCUIT_STATEMENT,
1016 misc_early::REDUNDANT_CLOSURE_CALL,
1017 misc_early::ZERO_PREFIXED_LITERAL,
1018 needless_bool::BOOL_COMPARISON,
1019 needless_bool::NEEDLESS_BOOL,
1020 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
1021 needless_update::NEEDLESS_UPDATE,
1022 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
1023 no_effect::NO_EFFECT,
1024 no_effect::UNNECESSARY_OPERATION,
1025 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
1026 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
1027 precedence::PRECEDENCE,
1028 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
1029 ranges::RANGE_MINUS_ONE,
1030 ranges::RANGE_PLUS_ONE,
1031 ranges::RANGE_ZIP_WITH_LEN,
1032 reference::DEREF_ADDROF,
1033 reference::REF_IN_DEREF,
1035 temporary_assignment::TEMPORARY_ASSIGNMENT,
1036 transmute::CROSSPOINTER_TRANSMUTE,
1037 transmute::TRANSMUTE_BYTES_TO_STR,
1038 transmute::TRANSMUTE_INT_TO_BOOL,
1039 transmute::TRANSMUTE_INT_TO_CHAR,
1040 transmute::TRANSMUTE_INT_TO_FLOAT,
1041 transmute::TRANSMUTE_PTR_TO_PTR,
1042 transmute::TRANSMUTE_PTR_TO_REF,
1043 transmute::USELESS_TRANSMUTE,
1044 types::BORROWED_BOX,
1045 types::CAST_LOSSLESS,
1046 types::CHAR_LIT_AS_U8,
1047 types::OPTION_OPTION,
1048 types::TYPE_COMPLEXITY,
1050 types::UNNECESSARY_CAST,
1052 unused_label::UNUSED_LABEL,
1053 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
1056 reg.register_lint_group("clippy::correctness", Some("clippy_correctness"), vec![
1057 approx_const::APPROX_CONSTANT,
1058 attrs::DEPRECATED_SEMVER,
1059 attrs::USELESS_ATTRIBUTE,
1060 bit_mask::BAD_BIT_MASK,
1061 bit_mask::INEFFECTIVE_BIT_MASK,
1062 booleans::LOGIC_BUG,
1063 copies::IFS_SAME_COND,
1064 copies::IF_SAME_THEN_ELSE,
1065 derive::DERIVE_HASH_XOR_EQ,
1066 drop_bounds::DROP_BOUNDS,
1067 drop_forget_ref::DROP_COPY,
1068 drop_forget_ref::DROP_REF,
1069 drop_forget_ref::FORGET_COPY,
1070 drop_forget_ref::FORGET_REF,
1071 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
1073 erasing_op::ERASING_OP,
1074 formatting::POSSIBLE_MISSING_COMMA,
1075 functions::NOT_UNSAFE_PTR_ARG_DEREF,
1076 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
1077 infinite_iter::INFINITE_ITER,
1078 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
1079 invalid_ref::INVALID_REF,
1080 literal_representation::MISTYPED_LITERAL_SUFFIXES,
1081 loops::FOR_LOOP_OVER_OPTION,
1082 loops::FOR_LOOP_OVER_RESULT,
1083 loops::ITER_NEXT_LOOP,
1085 loops::REVERSE_RANGE_LOOP,
1086 loops::WHILE_IMMUTABLE_CONDITION,
1087 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
1088 methods::CLONE_DOUBLE_REF,
1089 methods::INTO_ITER_ON_ARRAY,
1090 methods::TEMPORARY_CSTRING_AS_PTR,
1095 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
1096 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
1097 open_options::NONSENSICAL_OPEN_OPTIONS,
1099 ranges::ITERATOR_STEP_BY_ZERO,
1100 regex::INVALID_REGEX,
1101 serde_api::SERDE_API_MISUSE,
1102 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
1103 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
1104 swap::ALMOST_SWAPPED,
1105 transmute::WRONG_TRANSMUTE,
1106 transmuting_null::TRANSMUTING_NULL,
1107 types::ABSURD_EXTREME_COMPARISONS,
1108 types::CAST_PTR_ALIGNMENT,
1109 types::CAST_REF_TO_MUT,
1111 unicode::ZERO_WIDTH_SPACE,
1112 unused_io_amount::UNUSED_IO_AMOUNT,
1115 reg.register_lint_group("clippy::perf", Some("clippy_perf"), vec![
1116 bytecount::NAIVE_BYTECOUNT,
1118 escape::BOXED_LOCAL,
1119 large_enum_variant::LARGE_ENUM_VARIANT,
1120 loops::MANUAL_MEMCPY,
1121 loops::NEEDLESS_COLLECT,
1122 loops::UNUSED_COLLECT,
1123 methods::EXPECT_FUN_CALL,
1125 methods::OR_FUN_CALL,
1126 methods::SINGLE_CHAR_PATTERN,
1128 mutex_atomic::MUTEX_ATOMIC,
1129 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
1130 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
1135 reg.register_lint_group("clippy::cargo", Some("clippy_cargo"), vec![
1136 cargo_common_metadata::CARGO_COMMON_METADATA,
1137 multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
1138 wildcard_dependencies::WILDCARD_DEPENDENCIES,
1141 reg.register_lint_group("clippy::nursery", Some("clippy_nursery"), vec![
1142 attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
1143 fallible_impl_from::FALLIBLE_IMPL_FROM,
1144 missing_const_for_fn::MISSING_CONST_FOR_FN,
1145 mutex_atomic::MUTEX_INTEGER,
1146 needless_borrow::NEEDLESS_BORROW,
1147 path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
1148 redundant_clone::REDUNDANT_CLONE,
1149 unwrap::PANICKING_UNWRAP,
1150 unwrap::UNNECESSARY_UNWRAP,
1154 /// Register renamed lints.
1156 /// Used in `./src/driver.rs`.
1157 pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
1158 ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1159 ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
1160 ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
1161 ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
1164 // only exists to let the dogfood integration test works.
1165 // Don't run clippy as an executable directly
1168 panic!("Please use the cargo-clippy executable");