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,
640 methods::MAP_FLATTEN,
641 methods::OPTION_MAP_UNWRAP_OR,
642 methods::OPTION_MAP_UNWRAP_OR_ELSE,
643 methods::RESULT_MAP_UNWRAP_OR_ELSE,
644 misc::USED_UNDERSCORE_BINDING,
645 misc_early::UNSEPARATED_LITERAL_SUFFIX,
647 needless_continue::NEEDLESS_CONTINUE,
648 needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
649 non_expressive_names::SIMILAR_NAMES,
650 replace_consts::REPLACE_CONSTS,
651 shadow::SHADOW_UNRELATED,
652 strings::STRING_ADD_ASSIGN,
653 types::CAST_POSSIBLE_TRUNCATION,
654 types::CAST_POSSIBLE_WRAP,
655 types::CAST_PRECISION_LOSS,
656 types::CAST_SIGN_LOSS,
657 types::INVALID_UPCAST_COMPARISONS,
659 unicode::NON_ASCII_LITERAL,
660 unicode::UNICODE_NOT_NFC,
664 reg.register_lint_group("clippy::internal", Some("clippy_internal"), vec![
665 utils::internal_lints::CLIPPY_LINTS_INTERNAL,
666 utils::internal_lints::COMPILER_LINT_FUNCTIONS,
667 utils::internal_lints::LINT_WITHOUT_LINT_PASS,
668 utils::internal_lints::OUTER_EXPN_INFO,
671 reg.register_lint_group("clippy::all", Some("clippy"), vec![
672 approx_const::APPROX_CONSTANT,
673 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
674 assign_ops::ASSIGN_OP_PATTERN,
675 assign_ops::MISREFACTORED_ASSIGN_OP,
676 attrs::DEPRECATED_CFG_ATTR,
677 attrs::DEPRECATED_SEMVER,
678 attrs::UNKNOWN_CLIPPY_LINTS,
679 attrs::USELESS_ATTRIBUTE,
680 bit_mask::BAD_BIT_MASK,
681 bit_mask::INEFFECTIVE_BIT_MASK,
682 bit_mask::VERBOSE_BIT_MASK,
683 blacklisted_name::BLACKLISTED_NAME,
684 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
685 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
687 booleans::NONMINIMAL_BOOL,
688 bytecount::NAIVE_BYTECOUNT,
689 cognitive_complexity::COGNITIVE_COMPLEXITY,
690 collapsible_if::COLLAPSIBLE_IF,
691 copies::IFS_SAME_COND,
692 copies::IF_SAME_THEN_ELSE,
693 derive::DERIVE_HASH_XOR_EQ,
694 double_comparison::DOUBLE_COMPARISONS,
695 double_parens::DOUBLE_PARENS,
696 drop_bounds::DROP_BOUNDS,
697 drop_forget_ref::DROP_COPY,
698 drop_forget_ref::DROP_REF,
699 drop_forget_ref::FORGET_COPY,
700 drop_forget_ref::FORGET_REF,
701 duration_subsec::DURATION_SUBSEC,
703 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
704 enum_variants::ENUM_VARIANT_NAMES,
705 enum_variants::MODULE_INCEPTION,
708 erasing_op::ERASING_OP,
710 eta_reduction::REDUNDANT_CLOSURE,
711 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
712 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
713 excessive_precision::EXCESSIVE_PRECISION,
714 explicit_write::EXPLICIT_WRITE,
715 format::USELESS_FORMAT,
716 formatting::POSSIBLE_MISSING_COMMA,
717 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
718 formatting::SUSPICIOUS_ELSE_FORMATTING,
719 functions::NOT_UNSAFE_PTR_ARG_DEREF,
720 functions::TOO_MANY_ARGUMENTS,
721 get_last_with_len::GET_LAST_WITH_LEN,
722 identity_conversion::IDENTITY_CONVERSION,
723 identity_op::IDENTITY_OP,
724 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
725 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
726 infinite_iter::INFINITE_ITER,
727 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
728 int_plus_one::INT_PLUS_ONE,
729 invalid_ref::INVALID_REF,
730 large_enum_variant::LARGE_ENUM_VARIANT,
731 len_zero::LEN_WITHOUT_IS_EMPTY,
733 let_if_seq::USELESS_LET_IF_SEQ,
734 lifetimes::EXTRA_UNUSED_LIFETIMES,
735 lifetimes::NEEDLESS_LIFETIMES,
736 literal_representation::INCONSISTENT_DIGIT_GROUPING,
737 literal_representation::MISTYPED_LITERAL_SUFFIXES,
738 literal_representation::UNREADABLE_LITERAL,
740 loops::EXPLICIT_COUNTER_LOOP,
742 loops::FOR_LOOP_OVER_OPTION,
743 loops::FOR_LOOP_OVER_RESULT,
744 loops::ITER_NEXT_LOOP,
745 loops::MANUAL_MEMCPY,
746 loops::MUT_RANGE_BOUND,
747 loops::NEEDLESS_COLLECT,
748 loops::NEEDLESS_RANGE_LOOP,
750 loops::REVERSE_RANGE_LOOP,
751 loops::UNUSED_COLLECT,
752 loops::WHILE_IMMUTABLE_CONDITION,
753 loops::WHILE_LET_LOOP,
754 loops::WHILE_LET_ON_ITERATOR,
755 map_clone::MAP_CLONE,
756 map_unit_fn::OPTION_MAP_UNIT_FN,
757 map_unit_fn::RESULT_MAP_UNIT_FN,
758 matches::MATCH_AS_REF,
760 matches::MATCH_OVERLAPPING_ARM,
761 matches::MATCH_REF_PATS,
762 matches::MATCH_WILD_ERR_ARM,
763 matches::SINGLE_MATCH,
764 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
765 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
766 methods::CHARS_LAST_CMP,
767 methods::CHARS_NEXT_CMP,
768 methods::CLONE_DOUBLE_REF,
769 methods::CLONE_ON_COPY,
770 methods::EXPECT_FUN_CALL,
771 methods::FILTER_NEXT,
772 methods::INTO_ITER_ON_ARRAY,
773 methods::INTO_ITER_ON_REF,
774 methods::ITER_CLONED_COLLECT,
776 methods::ITER_SKIP_NEXT,
777 methods::NEW_RET_NO_SELF,
779 methods::OPTION_MAP_OR_NONE,
780 methods::OR_FUN_CALL,
781 methods::SEARCH_IS_SOME,
782 methods::SHOULD_IMPLEMENT_TRAIT,
783 methods::SINGLE_CHAR_PATTERN,
784 methods::STRING_EXTEND_CHARS,
785 methods::TEMPORARY_CSTRING_AS_PTR,
786 methods::UNNECESSARY_FILTER_MAP,
787 methods::UNNECESSARY_FOLD,
788 methods::USELESS_ASREF,
789 methods::WRONG_SELF_CONVENTION,
795 misc::REDUNDANT_PATTERN,
796 misc::SHORT_CIRCUIT_STATEMENT,
797 misc::TOPLEVEL_REF_ARG,
799 misc_early::BUILTIN_TYPE_SHADOW,
800 misc_early::DOUBLE_NEG,
801 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
802 misc_early::MIXED_CASE_HEX_LITERALS,
803 misc_early::REDUNDANT_CLOSURE_CALL,
804 misc_early::UNNEEDED_FIELD_PATTERN,
805 misc_early::ZERO_PREFIXED_LITERAL,
806 mut_reference::UNNECESSARY_MUT_PASSED,
807 mutex_atomic::MUTEX_ATOMIC,
808 needless_bool::BOOL_COMPARISON,
809 needless_bool::NEEDLESS_BOOL,
810 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
811 needless_update::NEEDLESS_UPDATE,
812 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
813 neg_multiply::NEG_MULTIPLY,
814 new_without_default::NEW_WITHOUT_DEFAULT,
815 no_effect::NO_EFFECT,
816 no_effect::UNNECESSARY_OPERATION,
817 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
818 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
819 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
820 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
821 ok_if_let::IF_LET_SOME_RESULT,
822 open_options::NONSENSICAL_OPEN_OPTIONS,
823 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
824 panic_unimplemented::PANIC_PARAMS,
825 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
826 precedence::PRECEDENCE,
830 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
831 question_mark::QUESTION_MARK,
832 ranges::ITERATOR_STEP_BY_ZERO,
833 ranges::RANGE_MINUS_ONE,
834 ranges::RANGE_PLUS_ONE,
835 ranges::RANGE_ZIP_WITH_LEN,
836 redundant_field_names::REDUNDANT_FIELD_NAMES,
837 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
838 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
839 reference::DEREF_ADDROF,
840 reference::REF_IN_DEREF,
841 regex::INVALID_REGEX,
843 regex::TRIVIAL_REGEX,
844 returns::LET_AND_RETURN,
845 returns::NEEDLESS_RETURN,
846 returns::UNUSED_UNIT,
847 serde_api::SERDE_API_MISUSE,
848 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
849 strings::STRING_LIT_AS_BYTES,
850 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
851 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
852 swap::ALMOST_SWAPPED,
854 temporary_assignment::TEMPORARY_ASSIGNMENT,
855 transmute::CROSSPOINTER_TRANSMUTE,
856 transmute::TRANSMUTE_BYTES_TO_STR,
857 transmute::TRANSMUTE_INT_TO_BOOL,
858 transmute::TRANSMUTE_INT_TO_CHAR,
859 transmute::TRANSMUTE_INT_TO_FLOAT,
860 transmute::TRANSMUTE_PTR_TO_PTR,
861 transmute::TRANSMUTE_PTR_TO_REF,
862 transmute::USELESS_TRANSMUTE,
863 transmute::WRONG_TRANSMUTE,
864 transmuting_null::TRANSMUTING_NULL,
865 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
867 types::ABSURD_EXTREME_COMPARISONS,
870 types::CAST_LOSSLESS,
871 types::CAST_PTR_ALIGNMENT,
872 types::CAST_REF_TO_MUT,
873 types::CHAR_LIT_AS_U8,
874 types::FN_TO_NUMERIC_CAST,
875 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
876 types::IMPLICIT_HASHER,
877 types::LET_UNIT_VALUE,
878 types::OPTION_OPTION,
879 types::TYPE_COMPLEXITY,
882 types::UNNECESSARY_CAST,
884 unicode::ZERO_WIDTH_SPACE,
885 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
886 unused_io_amount::UNUSED_IO_AMOUNT,
887 unused_label::UNUSED_LABEL,
889 write::PRINTLN_EMPTY_STRING,
890 write::PRINT_LITERAL,
891 write::PRINT_WITH_NEWLINE,
892 write::WRITELN_EMPTY_STRING,
893 write::WRITE_LITERAL,
894 write::WRITE_WITH_NEWLINE,
895 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
898 reg.register_lint_group("clippy::style", Some("clippy_style"), vec![
899 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
900 assign_ops::ASSIGN_OP_PATTERN,
901 attrs::UNKNOWN_CLIPPY_LINTS,
902 bit_mask::VERBOSE_BIT_MASK,
903 blacklisted_name::BLACKLISTED_NAME,
904 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
905 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
906 collapsible_if::COLLAPSIBLE_IF,
907 enum_variants::ENUM_VARIANT_NAMES,
908 enum_variants::MODULE_INCEPTION,
910 eta_reduction::REDUNDANT_CLOSURE,
911 excessive_precision::EXCESSIVE_PRECISION,
912 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
913 formatting::SUSPICIOUS_ELSE_FORMATTING,
914 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
915 len_zero::LEN_WITHOUT_IS_EMPTY,
917 let_if_seq::USELESS_LET_IF_SEQ,
918 literal_representation::INCONSISTENT_DIGIT_GROUPING,
919 literal_representation::UNREADABLE_LITERAL,
922 loops::NEEDLESS_RANGE_LOOP,
923 loops::WHILE_LET_ON_ITERATOR,
924 map_clone::MAP_CLONE,
926 matches::MATCH_OVERLAPPING_ARM,
927 matches::MATCH_REF_PATS,
928 matches::MATCH_WILD_ERR_ARM,
929 matches::SINGLE_MATCH,
930 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
931 methods::CHARS_LAST_CMP,
932 methods::INTO_ITER_ON_REF,
933 methods::ITER_CLONED_COLLECT,
934 methods::ITER_SKIP_NEXT,
935 methods::NEW_RET_NO_SELF,
937 methods::OPTION_MAP_OR_NONE,
938 methods::SHOULD_IMPLEMENT_TRAIT,
939 methods::STRING_EXTEND_CHARS,
940 methods::UNNECESSARY_FOLD,
941 methods::WRONG_SELF_CONVENTION,
942 misc::REDUNDANT_PATTERN,
943 misc::TOPLEVEL_REF_ARG,
945 misc_early::BUILTIN_TYPE_SHADOW,
946 misc_early::DOUBLE_NEG,
947 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
948 misc_early::MIXED_CASE_HEX_LITERALS,
949 misc_early::UNNEEDED_FIELD_PATTERN,
950 mut_reference::UNNECESSARY_MUT_PASSED,
951 neg_multiply::NEG_MULTIPLY,
952 new_without_default::NEW_WITHOUT_DEFAULT,
953 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
954 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
955 ok_if_let::IF_LET_SOME_RESULT,
956 panic_unimplemented::PANIC_PARAMS,
959 question_mark::QUESTION_MARK,
960 redundant_field_names::REDUNDANT_FIELD_NAMES,
961 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
962 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
964 regex::TRIVIAL_REGEX,
965 returns::LET_AND_RETURN,
966 returns::NEEDLESS_RETURN,
967 returns::UNUSED_UNIT,
968 strings::STRING_LIT_AS_BYTES,
970 types::FN_TO_NUMERIC_CAST,
971 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
972 types::IMPLICIT_HASHER,
973 types::LET_UNIT_VALUE,
974 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
975 write::PRINTLN_EMPTY_STRING,
976 write::PRINT_LITERAL,
977 write::PRINT_WITH_NEWLINE,
978 write::WRITELN_EMPTY_STRING,
979 write::WRITE_LITERAL,
980 write::WRITE_WITH_NEWLINE,
983 reg.register_lint_group("clippy::complexity", Some("clippy_complexity"), vec![
984 assign_ops::MISREFACTORED_ASSIGN_OP,
985 attrs::DEPRECATED_CFG_ATTR,
986 booleans::NONMINIMAL_BOOL,
987 cognitive_complexity::COGNITIVE_COMPLEXITY,
988 double_comparison::DOUBLE_COMPARISONS,
989 double_parens::DOUBLE_PARENS,
990 duration_subsec::DURATION_SUBSEC,
991 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
992 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
993 explicit_write::EXPLICIT_WRITE,
994 format::USELESS_FORMAT,
995 functions::TOO_MANY_ARGUMENTS,
996 get_last_with_len::GET_LAST_WITH_LEN,
997 identity_conversion::IDENTITY_CONVERSION,
998 identity_op::IDENTITY_OP,
999 int_plus_one::INT_PLUS_ONE,
1000 lifetimes::EXTRA_UNUSED_LIFETIMES,
1001 lifetimes::NEEDLESS_LIFETIMES,
1002 loops::EXPLICIT_COUNTER_LOOP,
1003 loops::MUT_RANGE_BOUND,
1004 loops::WHILE_LET_LOOP,
1005 map_unit_fn::OPTION_MAP_UNIT_FN,
1006 map_unit_fn::RESULT_MAP_UNIT_FN,
1007 matches::MATCH_AS_REF,
1008 methods::CHARS_NEXT_CMP,
1009 methods::CLONE_ON_COPY,
1010 methods::FILTER_NEXT,
1011 methods::SEARCH_IS_SOME,
1012 methods::UNNECESSARY_FILTER_MAP,
1013 methods::USELESS_ASREF,
1014 misc::SHORT_CIRCUIT_STATEMENT,
1015 misc_early::REDUNDANT_CLOSURE_CALL,
1016 misc_early::ZERO_PREFIXED_LITERAL,
1017 needless_bool::BOOL_COMPARISON,
1018 needless_bool::NEEDLESS_BOOL,
1019 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
1020 needless_update::NEEDLESS_UPDATE,
1021 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
1022 no_effect::NO_EFFECT,
1023 no_effect::UNNECESSARY_OPERATION,
1024 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
1025 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
1026 precedence::PRECEDENCE,
1027 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
1028 ranges::RANGE_MINUS_ONE,
1029 ranges::RANGE_PLUS_ONE,
1030 ranges::RANGE_ZIP_WITH_LEN,
1031 reference::DEREF_ADDROF,
1032 reference::REF_IN_DEREF,
1034 temporary_assignment::TEMPORARY_ASSIGNMENT,
1035 transmute::CROSSPOINTER_TRANSMUTE,
1036 transmute::TRANSMUTE_BYTES_TO_STR,
1037 transmute::TRANSMUTE_INT_TO_BOOL,
1038 transmute::TRANSMUTE_INT_TO_CHAR,
1039 transmute::TRANSMUTE_INT_TO_FLOAT,
1040 transmute::TRANSMUTE_PTR_TO_PTR,
1041 transmute::TRANSMUTE_PTR_TO_REF,
1042 transmute::USELESS_TRANSMUTE,
1043 types::BORROWED_BOX,
1044 types::CAST_LOSSLESS,
1045 types::CHAR_LIT_AS_U8,
1046 types::OPTION_OPTION,
1047 types::TYPE_COMPLEXITY,
1049 types::UNNECESSARY_CAST,
1051 unused_label::UNUSED_LABEL,
1052 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
1055 reg.register_lint_group("clippy::correctness", Some("clippy_correctness"), vec![
1056 approx_const::APPROX_CONSTANT,
1057 attrs::DEPRECATED_SEMVER,
1058 attrs::USELESS_ATTRIBUTE,
1059 bit_mask::BAD_BIT_MASK,
1060 bit_mask::INEFFECTIVE_BIT_MASK,
1061 booleans::LOGIC_BUG,
1062 copies::IFS_SAME_COND,
1063 copies::IF_SAME_THEN_ELSE,
1064 derive::DERIVE_HASH_XOR_EQ,
1065 drop_bounds::DROP_BOUNDS,
1066 drop_forget_ref::DROP_COPY,
1067 drop_forget_ref::DROP_REF,
1068 drop_forget_ref::FORGET_COPY,
1069 drop_forget_ref::FORGET_REF,
1070 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
1072 erasing_op::ERASING_OP,
1073 formatting::POSSIBLE_MISSING_COMMA,
1074 functions::NOT_UNSAFE_PTR_ARG_DEREF,
1075 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
1076 infinite_iter::INFINITE_ITER,
1077 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
1078 invalid_ref::INVALID_REF,
1079 literal_representation::MISTYPED_LITERAL_SUFFIXES,
1080 loops::FOR_LOOP_OVER_OPTION,
1081 loops::FOR_LOOP_OVER_RESULT,
1082 loops::ITER_NEXT_LOOP,
1084 loops::REVERSE_RANGE_LOOP,
1085 loops::WHILE_IMMUTABLE_CONDITION,
1086 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
1087 methods::CLONE_DOUBLE_REF,
1088 methods::INTO_ITER_ON_ARRAY,
1089 methods::TEMPORARY_CSTRING_AS_PTR,
1094 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
1095 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
1096 open_options::NONSENSICAL_OPEN_OPTIONS,
1098 ranges::ITERATOR_STEP_BY_ZERO,
1099 regex::INVALID_REGEX,
1100 serde_api::SERDE_API_MISUSE,
1101 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
1102 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
1103 swap::ALMOST_SWAPPED,
1104 transmute::WRONG_TRANSMUTE,
1105 transmuting_null::TRANSMUTING_NULL,
1106 types::ABSURD_EXTREME_COMPARISONS,
1107 types::CAST_PTR_ALIGNMENT,
1108 types::CAST_REF_TO_MUT,
1110 unicode::ZERO_WIDTH_SPACE,
1111 unused_io_amount::UNUSED_IO_AMOUNT,
1114 reg.register_lint_group("clippy::perf", Some("clippy_perf"), vec![
1115 bytecount::NAIVE_BYTECOUNT,
1117 escape::BOXED_LOCAL,
1118 large_enum_variant::LARGE_ENUM_VARIANT,
1119 loops::MANUAL_MEMCPY,
1120 loops::NEEDLESS_COLLECT,
1121 loops::UNUSED_COLLECT,
1122 methods::EXPECT_FUN_CALL,
1124 methods::OR_FUN_CALL,
1125 methods::SINGLE_CHAR_PATTERN,
1127 mutex_atomic::MUTEX_ATOMIC,
1128 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
1129 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
1134 reg.register_lint_group("clippy::cargo", Some("clippy_cargo"), vec![
1135 cargo_common_metadata::CARGO_COMMON_METADATA,
1136 multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
1137 wildcard_dependencies::WILDCARD_DEPENDENCIES,
1140 reg.register_lint_group("clippy::nursery", Some("clippy_nursery"), vec![
1141 attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
1142 fallible_impl_from::FALLIBLE_IMPL_FROM,
1143 missing_const_for_fn::MISSING_CONST_FOR_FN,
1144 mutex_atomic::MUTEX_INTEGER,
1145 needless_borrow::NEEDLESS_BORROW,
1146 path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
1147 redundant_clone::REDUNDANT_CLONE,
1148 unwrap::PANICKING_UNWRAP,
1149 unwrap::UNNECESSARY_UNWRAP,
1153 /// Register renamed lints.
1155 /// Used in `./src/driver.rs`.
1156 pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
1157 ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1158 ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
1159 ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
1160 ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
1163 // only exists to let the dogfood integration test works.
1164 // Don't run clippy as an executable directly
1167 panic!("Please use the cargo-clippy executable");