1 // error-pattern:cargo-clippy
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, clippy::must_use_candidate)]
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)]
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)]
23 #[allow(unused_extern_crates)]
24 extern crate rustc_data_structures;
25 #[allow(unused_extern_crates)]
26 extern crate rustc_driver;
27 #[allow(unused_extern_crates)]
28 extern crate rustc_errors;
29 #[allow(unused_extern_crates)]
30 extern crate rustc_index;
31 #[allow(unused_extern_crates)]
32 extern crate rustc_mir;
33 #[allow(unused_extern_crates)]
34 extern crate rustc_target;
35 #[allow(unused_extern_crates)]
36 extern crate rustc_typeck;
37 #[allow(unused_extern_crates)]
39 #[allow(unused_extern_crates)]
40 extern crate syntax_expand;
41 #[allow(unused_extern_crates)]
42 extern crate syntax_pos;
46 /// Macro used to declare a Clippy lint.
48 /// Every lint declaration consists of 4 parts:
50 /// 1. The documentation, which is used for the website
51 /// 2. The `LINT_NAME`. See [lint naming][lint_naming] on lint naming conventions.
52 /// 3. The `lint_level`, which is a mapping from *one* of our lint groups to `Allow`, `Warn` or
53 /// `Deny`. The lint level here has nothing to do with what lint groups the lint is a part of.
54 /// 4. The `description` that contains a short explanation on what's wrong with code where the
55 /// lint is triggered.
57 /// Currently the categories `style`, `correctness`, `complexity` and `perf` are enabled by default.
58 /// As said in the README.md of this repository, if the lint level mapping changes, please update
64 /// # #![feature(rustc_private)]
65 /// # #[allow(unused_extern_crates)]
66 /// # extern crate rustc;
68 /// # use clippy_lints::declare_clippy_lint;
69 /// use rustc::declare_tool_lint;
71 /// declare_clippy_lint! {
72 /// /// **What it does:** Checks for ... (describe what the lint matches).
74 /// /// **Why is this bad?** Supply the reason for linting the code.
76 /// /// **Known problems:** None. (Or describe where it could go wrong.)
82 /// /// Insert a short example of code that triggers the lint
85 /// /// Insert a short example of improved code that doesn't trigger the lint
92 /// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
94 macro_rules! declare_clippy_lint {
95 { $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
97 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
100 { $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
102 $(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
105 { $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
107 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
110 { $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
112 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
115 { $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
117 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
120 { $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
122 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
125 { $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
127 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
130 { $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
132 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
135 { $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
137 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
140 { $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
142 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
151 // begin lints modules, do not remove this comment, it’s used in `update_lints`
152 pub mod approx_const;
154 pub mod assertions_on_constants;
158 pub mod blacklisted_name;
159 pub mod block_in_if_condition;
162 pub mod cargo_common_metadata;
163 pub mod checked_conversions;
164 pub mod cognitive_complexity;
165 pub mod collapsible_if;
166 pub mod comparison_chain;
168 pub mod copy_iterator;
170 pub mod default_trait_access;
173 pub mod double_comparison;
174 pub mod double_parens;
176 pub mod drop_forget_ref;
177 pub mod duration_subsec;
178 pub mod else_if_without_else;
182 pub mod enum_glob_use;
183 pub mod enum_variants;
187 pub mod eta_reduction;
188 pub mod eval_order_dependence;
189 pub mod excessive_precision;
190 pub mod explicit_write;
191 pub mod fallible_impl_from;
195 pub mod get_last_with_len;
196 pub mod identity_conversion;
199 pub mod implicit_return;
200 pub mod indexing_slicing;
201 pub mod infallible_destructuring_match;
202 pub mod infinite_iter;
203 pub mod inherent_impl;
204 pub mod inherent_to_string;
205 pub mod inline_fn_without_body;
206 pub mod int_plus_one;
207 pub mod integer_division;
208 pub mod items_after_statements;
209 pub mod large_enum_variant;
213 pub mod literal_representation;
215 pub mod main_recursion;
219 pub mod mem_discriminant;
226 pub mod missing_const_for_fn;
228 pub mod missing_inline;
230 pub mod multiple_crate_versions;
232 pub mod mut_reference;
233 pub mod mutex_atomic;
234 pub mod needless_bool;
235 pub mod needless_borrow;
236 pub mod needless_borrowed_ref;
237 pub mod needless_continue;
238 pub mod needless_pass_by_value;
239 pub mod needless_update;
240 pub mod neg_cmp_op_on_partial_ord;
241 pub mod neg_multiply;
242 pub mod new_without_default;
244 pub mod non_copy_const;
245 pub mod non_expressive_names;
247 pub mod open_options;
248 pub mod overflow_check_conditional;
249 pub mod panic_unimplemented;
250 pub mod partialeq_ne_impl;
251 pub mod path_buf_push_overwrite;
254 pub mod ptr_offset_with_cast;
255 pub mod question_mark;
257 pub mod redundant_clone;
258 pub mod redundant_field_names;
259 pub mod redundant_pattern_matching;
260 pub mod redundant_static_lifetimes;
263 pub mod replace_consts;
267 pub mod slow_vector_initialization;
269 pub mod suspicious_trait_impl;
271 pub mod temporary_assignment;
272 pub mod trait_bounds;
274 pub mod transmuting_null;
275 pub mod trivially_copy_pass_by_ref;
279 pub mod unsafe_removed_from_name;
280 pub mod unused_io_amount;
281 pub mod unused_label;
286 pub mod wildcard_dependencies;
288 pub mod zero_div_zero;
289 // end lints modules, do not remove this comment, it’s used in `update_lints`
291 pub use crate::utils::conf::Conf;
294 crate use syntax::ast::Name;
297 /// Register all pre expansion lints
299 /// Pre-expansion lints run before any macro expansion has happened.
301 /// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
302 /// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
304 /// Used in `./src/driver.rs`.
305 pub fn register_pre_expansion_lints(
306 session: &rustc::session::Session,
307 store: &mut rustc::lint::LintStore,
310 store.register_pre_expansion_pass(Some(session), true, false, box write::Write);
311 store.register_pre_expansion_pass(
315 box redundant_field_names::RedundantFieldNames,
317 store.register_pre_expansion_pass(
321 box non_expressive_names::NonExpressiveNames {
322 single_char_binding_names_threshold: conf.single_char_binding_names_threshold,
325 store.register_pre_expansion_pass(Some(session), true, false, box attrs::DeprecatedCfgAttribute);
326 store.register_pre_expansion_pass(Some(session), true, false, box dbg_macro::DbgMacro);
330 pub fn read_conf(reg: &rustc_driver::plugin::Registry<'_>) -> Conf {
331 match utils::conf::file_from_args(reg.args()) {
333 // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
334 // do not require the file to exist
335 let file_name = if let Some(file_name) = file_name {
338 match utils::conf::lookup_conf_file() {
342 .struct_err(&format!("error finding Clippy's configuration file: {}", error))
349 let file_name = file_name.map(|file_name| {
350 if file_name.is_relative() {
352 .local_crate_source_file
354 .and_then(|file| std::path::Path::new(&file).parent().map(std::path::Path::to_path_buf))
362 let (conf, errors) = utils::conf::read(file_name.as_ref().map(std::convert::AsRef::as_ref));
364 // all conf errors are non-fatal, we just use the default conf in case of error
365 for error in errors {
367 .struct_err(&format!(
368 "error reading Clippy's configuration file `{}`: {}",
369 file_name.as_ref().and_then(|p| p.to_str()).unwrap_or(""),
377 Err((err, span)) => {
379 .struct_span_err(span, err)
380 .span_note(span, "Clippy will use default configuration")
382 toml::from_str("").expect("we never error on empty config files")
387 /// Register all lints and lint groups with the rustc plugin registry
389 /// Used in `./src/driver.rs`.
390 #[allow(clippy::too_many_lines)]
392 pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Conf) {
393 let mut store = reg.sess.lint_store.borrow_mut();
394 register_removed_non_tool_lints(&mut store);
396 // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
397 store.register_removed(
398 "clippy::should_assert_eq",
399 "`assert!()` will be more flexible with RFC 2011",
401 store.register_removed(
402 "clippy::extend_from_slice",
403 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
405 store.register_removed(
406 "clippy::range_step_by_zero",
407 "`iterator.step_by(0)` panics nowadays",
409 store.register_removed(
410 "clippy::unstable_as_slice",
411 "`Vec::as_slice` has been stabilized in 1.7",
413 store.register_removed(
414 "clippy::unstable_as_mut_slice",
415 "`Vec::as_mut_slice` has been stabilized in 1.7",
417 store.register_removed(
418 "clippy::str_to_string",
419 "using `str::to_string` is common even today and specialization will likely happen soon",
421 store.register_removed(
422 "clippy::string_to_string",
423 "using `string::to_string` is common even today and specialization will likely happen soon",
425 store.register_removed(
426 "clippy::misaligned_transmute",
427 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
429 store.register_removed(
430 "clippy::assign_ops",
431 "using compound assignment operators (e.g., `+=`) is harmless",
433 store.register_removed(
434 "clippy::if_let_redundant_pattern_matching",
435 "this lint has been changed to redundant_pattern_matching",
437 store.register_removed(
438 "clippy::unsafe_vector_initialization",
439 "the replacement suggested by this lint had substantially different behavior",
441 store.register_removed(
442 "clippy::invalid_ref",
443 "superseded by rustc lint `invalid_value`",
445 store.register_removed(
446 "clippy::unused_collect",
447 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint",
449 // end deprecated lints, do not remove this comment, it’s used in `update_lints`
451 reg.register_late_lint_pass(box serde_api::SerdeAPI);
452 reg.register_early_lint_pass(box utils::internal_lints::ClippyLintsInternal);
453 reg.register_late_lint_pass(box utils::internal_lints::CompilerLintFunctions::new());
454 reg.register_late_lint_pass(box utils::internal_lints::LintWithoutLintPass::default());
455 reg.register_late_lint_pass(box utils::internal_lints::OuterExpnDataPass);
456 reg.register_late_lint_pass(box utils::inspector::DeepCodeInspector);
457 reg.register_late_lint_pass(box utils::author::Author);
458 reg.register_late_lint_pass(box types::Types);
459 reg.register_late_lint_pass(box booleans::NonminimalBool);
460 reg.register_late_lint_pass(box eq_op::EqOp);
461 reg.register_early_lint_pass(box enum_variants::EnumVariantNames::new(conf.enum_variant_name_threshold));
462 reg.register_late_lint_pass(box enum_glob_use::EnumGlobUse);
463 reg.register_late_lint_pass(box enum_clike::UnportableVariant);
464 reg.register_late_lint_pass(box excessive_precision::ExcessivePrecision);
465 reg.register_late_lint_pass(box bit_mask::BitMask::new(conf.verbose_bit_mask_threshold));
466 reg.register_late_lint_pass(box ptr::Ptr);
467 reg.register_late_lint_pass(box needless_bool::NeedlessBool);
468 reg.register_late_lint_pass(box needless_bool::BoolComparison);
469 reg.register_late_lint_pass(box approx_const::ApproxConstant);
470 reg.register_late_lint_pass(box misc::MiscLints);
471 reg.register_early_lint_pass(box precedence::Precedence);
472 reg.register_early_lint_pass(box needless_continue::NeedlessContinue);
473 reg.register_late_lint_pass(box eta_reduction::EtaReduction);
474 reg.register_late_lint_pass(box identity_op::IdentityOp);
475 reg.register_late_lint_pass(box erasing_op::ErasingOp);
476 reg.register_early_lint_pass(box items_after_statements::ItemsAfterStatements);
477 reg.register_late_lint_pass(box mut_mut::MutMut);
478 reg.register_late_lint_pass(box mut_reference::UnnecessaryMutPassed);
479 reg.register_late_lint_pass(box len_zero::LenZero);
480 reg.register_late_lint_pass(box attrs::Attributes);
481 reg.register_early_lint_pass(box collapsible_if::CollapsibleIf);
482 reg.register_late_lint_pass(box block_in_if_condition::BlockInIfCondition);
483 reg.register_late_lint_pass(box unicode::Unicode);
484 reg.register_late_lint_pass(box strings::StringAdd);
485 reg.register_early_lint_pass(box returns::Return);
486 reg.register_late_lint_pass(box implicit_return::ImplicitReturn);
487 reg.register_late_lint_pass(box methods::Methods);
488 reg.register_late_lint_pass(box map_clone::MapClone);
489 reg.register_late_lint_pass(box shadow::Shadow);
490 reg.register_late_lint_pass(box types::LetUnitValue);
491 reg.register_late_lint_pass(box types::UnitCmp);
492 reg.register_late_lint_pass(box loops::Loops);
493 reg.register_late_lint_pass(box main_recursion::MainRecursion::default());
494 reg.register_late_lint_pass(box lifetimes::Lifetimes);
495 reg.register_late_lint_pass(box entry::HashMapPass);
496 reg.register_late_lint_pass(box ranges::Ranges);
497 reg.register_late_lint_pass(box types::Casts);
498 reg.register_late_lint_pass(box types::TypeComplexity::new(conf.type_complexity_threshold));
499 reg.register_late_lint_pass(box matches::Matches);
500 reg.register_late_lint_pass(box minmax::MinMaxPass);
501 reg.register_late_lint_pass(box open_options::OpenOptions);
502 reg.register_late_lint_pass(box zero_div_zero::ZeroDiv);
503 reg.register_late_lint_pass(box mutex_atomic::Mutex);
504 reg.register_late_lint_pass(box needless_update::NeedlessUpdate);
505 reg.register_late_lint_pass(box needless_borrow::NeedlessBorrow::default());
506 reg.register_late_lint_pass(box needless_borrowed_ref::NeedlessBorrowedRef);
507 reg.register_late_lint_pass(box no_effect::NoEffect);
508 reg.register_late_lint_pass(box temporary_assignment::TemporaryAssignment);
509 reg.register_late_lint_pass(box transmute::Transmute);
510 reg.register_late_lint_pass(
511 box cognitive_complexity::CognitiveComplexity::new(conf.cognitive_complexity_threshold)
513 reg.register_late_lint_pass(box escape::BoxedLocal{too_large_for_stack: conf.too_large_for_stack});
514 reg.register_early_lint_pass(box misc_early::MiscEarlyLints);
515 reg.register_late_lint_pass(box panic_unimplemented::PanicUnimplemented);
516 reg.register_late_lint_pass(box strings::StringLitAsBytes);
517 reg.register_late_lint_pass(box derive::Derive);
518 reg.register_late_lint_pass(box types::CharLitAsU8);
519 reg.register_late_lint_pass(box vec::UselessVec);
520 reg.register_late_lint_pass(box drop_bounds::DropBounds);
521 reg.register_late_lint_pass(box get_last_with_len::GetLastWithLen);
522 reg.register_late_lint_pass(box drop_forget_ref::DropForgetRef);
523 reg.register_late_lint_pass(box empty_enum::EmptyEnum);
524 reg.register_late_lint_pass(box types::AbsurdExtremeComparisons);
525 reg.register_late_lint_pass(box types::InvalidUpcastComparisons);
526 reg.register_late_lint_pass(box regex::Regex::default());
527 reg.register_late_lint_pass(box copies::CopyAndPaste);
528 reg.register_late_lint_pass(box copy_iterator::CopyIterator);
529 reg.register_late_lint_pass(box format::UselessFormat);
530 reg.register_early_lint_pass(box formatting::Formatting);
531 reg.register_late_lint_pass(box swap::Swap);
532 reg.register_early_lint_pass(box if_not_else::IfNotElse);
533 reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse);
534 reg.register_early_lint_pass(box int_plus_one::IntPlusOne);
535 reg.register_late_lint_pass(box overflow_check_conditional::OverflowCheckConditional);
536 reg.register_late_lint_pass(box unused_label::UnusedLabel);
537 reg.register_late_lint_pass(box new_without_default::NewWithoutDefault::default());
538 reg.register_late_lint_pass(box blacklisted_name::BlacklistedName::new(
539 conf.blacklisted_names.iter().cloned().collect()
541 reg.register_late_lint_pass(box functions::Functions::new(conf.too_many_arguments_threshold, conf.too_many_lines_threshold));
542 reg.register_late_lint_pass(box doc::DocMarkdown::new(conf.doc_valid_idents.iter().cloned().collect()));
543 reg.register_late_lint_pass(box neg_multiply::NegMultiply);
544 reg.register_early_lint_pass(box unsafe_removed_from_name::UnsafeNameRemoval);
545 reg.register_late_lint_pass(box mem_discriminant::MemDiscriminant);
546 reg.register_late_lint_pass(box mem_forget::MemForget);
547 reg.register_late_lint_pass(box mem_replace::MemReplace);
548 reg.register_late_lint_pass(box arithmetic::Arithmetic::default());
549 reg.register_late_lint_pass(box assign_ops::AssignOps);
550 reg.register_late_lint_pass(box let_if_seq::LetIfSeq);
551 reg.register_late_lint_pass(box eval_order_dependence::EvalOrderDependence);
552 reg.register_late_lint_pass(box missing_doc::MissingDoc::new());
553 reg.register_late_lint_pass(box missing_inline::MissingInline);
554 reg.register_late_lint_pass(box ok_if_let::OkIfLet);
555 reg.register_late_lint_pass(box redundant_pattern_matching::RedundantPatternMatching);
556 reg.register_late_lint_pass(box partialeq_ne_impl::PartialEqNeImpl);
557 reg.register_early_lint_pass(box reference::DerefAddrOf);
558 reg.register_early_lint_pass(box reference::RefInDeref);
559 reg.register_early_lint_pass(box double_parens::DoubleParens);
560 reg.register_late_lint_pass(box unused_io_amount::UnusedIoAmount);
561 reg.register_late_lint_pass(box large_enum_variant::LargeEnumVariant::new(conf.enum_variant_size_threshold));
562 reg.register_late_lint_pass(box explicit_write::ExplicitWrite);
563 reg.register_late_lint_pass(box needless_pass_by_value::NeedlessPassByValue);
564 reg.register_late_lint_pass(box trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
565 conf.trivial_copy_size_limit,
568 reg.register_early_lint_pass(box literal_representation::LiteralDigitGrouping);
569 reg.register_early_lint_pass(box literal_representation::DecimalLiteralRepresentation::new(
570 conf.literal_representation_threshold
572 reg.register_late_lint_pass(box try_err::TryErr);
573 reg.register_late_lint_pass(box use_self::UseSelf);
574 reg.register_late_lint_pass(box bytecount::ByteCount);
575 reg.register_late_lint_pass(box infinite_iter::InfiniteIter);
576 reg.register_late_lint_pass(box inline_fn_without_body::InlineFnWithoutBody);
577 reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
578 reg.register_late_lint_pass(box types::ImplicitHasher);
579 reg.register_early_lint_pass(box redundant_static_lifetimes::RedundantStaticLifetimes);
580 reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom);
581 reg.register_late_lint_pass(box replace_consts::ReplaceConsts);
582 reg.register_late_lint_pass(box types::UnitArg);
583 reg.register_late_lint_pass(box double_comparison::DoubleComparisons);
584 reg.register_late_lint_pass(box question_mark::QuestionMark);
585 reg.register_late_lint_pass(box suspicious_trait_impl::SuspiciousImpl);
586 reg.register_early_lint_pass(box cargo_common_metadata::CargoCommonMetadata);
587 reg.register_early_lint_pass(box multiple_crate_versions::MultipleCrateVersions);
588 reg.register_early_lint_pass(box wildcard_dependencies::WildcardDependencies);
589 reg.register_late_lint_pass(box map_unit_fn::MapUnit);
590 reg.register_late_lint_pass(box infallible_destructuring_match::InfallibleDestructingMatch);
591 reg.register_late_lint_pass(box inherent_impl::MultipleInherentImpl::default());
592 reg.register_late_lint_pass(box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
593 reg.register_late_lint_pass(box unwrap::Unwrap);
594 reg.register_late_lint_pass(box duration_subsec::DurationSubsec);
595 reg.register_late_lint_pass(box default_trait_access::DefaultTraitAccess);
596 reg.register_late_lint_pass(box indexing_slicing::IndexingSlicing);
597 reg.register_late_lint_pass(box non_copy_const::NonCopyConst);
598 reg.register_late_lint_pass(box ptr_offset_with_cast::PtrOffsetWithCast);
599 reg.register_late_lint_pass(box redundant_clone::RedundantClone);
600 reg.register_late_lint_pass(box slow_vector_initialization::SlowVectorInit);
601 reg.register_late_lint_pass(box types::RefToMut);
602 reg.register_late_lint_pass(box assertions_on_constants::AssertionsOnConstants);
603 reg.register_late_lint_pass(box missing_const_for_fn::MissingConstForFn);
604 reg.register_late_lint_pass(box transmuting_null::TransmutingNull);
605 reg.register_late_lint_pass(box path_buf_push_overwrite::PathBufPushOverwrite);
606 reg.register_late_lint_pass(box checked_conversions::CheckedConversions);
607 reg.register_late_lint_pass(box integer_division::IntegerDivision);
608 reg.register_late_lint_pass(box inherent_to_string::InherentToString);
609 reg.register_late_lint_pass(box trait_bounds::TraitBounds);
610 reg.register_late_lint_pass(box comparison_chain::ComparisonChain);
611 reg.register_late_lint_pass(box mul_add::MulAddCheck);
612 reg.register_late_lint_pass(box unused_self::UnusedSelf);
614 reg.register_lint_group("clippy::restriction", Some("clippy_restriction"), vec![
615 arithmetic::FLOAT_ARITHMETIC,
616 arithmetic::INTEGER_ARITHMETIC,
617 dbg_macro::DBG_MACRO,
618 else_if_without_else::ELSE_IF_WITHOUT_ELSE,
619 implicit_return::IMPLICIT_RETURN,
620 indexing_slicing::INDEXING_SLICING,
621 inherent_impl::MULTIPLE_INHERENT_IMPL,
622 integer_division::INTEGER_DIVISION,
623 literal_representation::DECIMAL_LITERAL_REPRESENTATION,
624 matches::WILDCARD_ENUM_MATCH_ARM,
625 mem_forget::MEM_FORGET,
626 methods::CLONE_ON_REF_PTR,
628 methods::OPTION_UNWRAP_USED,
629 methods::RESULT_UNWRAP_USED,
630 methods::WRONG_PUB_SELF_CONVENTION,
631 misc::FLOAT_CMP_CONST,
632 missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
633 missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
634 panic_unimplemented::UNIMPLEMENTED,
635 shadow::SHADOW_REUSE,
642 reg.register_lint_group("clippy::pedantic", Some("clippy_pedantic"), vec![
643 attrs::INLINE_ALWAYS,
644 checked_conversions::CHECKED_CONVERSIONS,
645 copies::MATCH_SAME_ARMS,
646 copy_iterator::COPY_ITERATOR,
647 default_trait_access::DEFAULT_TRAIT_ACCESS,
648 derive::EXPL_IMPL_CLONE_ON_COPY,
650 empty_enum::EMPTY_ENUM,
651 enum_glob_use::ENUM_GLOB_USE,
652 enum_variants::MODULE_NAME_REPETITIONS,
653 enum_variants::PUB_ENUM_VARIANT_NAMES,
654 eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
655 functions::MUST_USE_CANDIDATE,
656 functions::TOO_MANY_LINES,
657 if_not_else::IF_NOT_ELSE,
658 infinite_iter::MAYBE_INFINITE_ITER,
659 items_after_statements::ITEMS_AFTER_STATEMENTS,
660 literal_representation::LARGE_DIGIT_GROUPS,
661 loops::EXPLICIT_INTO_ITER_LOOP,
662 loops::EXPLICIT_ITER_LOOP,
663 matches::SINGLE_MATCH_ELSE,
665 methods::FILTER_MAP_NEXT,
667 methods::MAP_FLATTEN,
668 methods::OPTION_MAP_UNWRAP_OR,
669 methods::OPTION_MAP_UNWRAP_OR_ELSE,
670 methods::RESULT_MAP_UNWRAP_OR_ELSE,
671 misc::USED_UNDERSCORE_BINDING,
672 misc_early::UNSEPARATED_LITERAL_SUFFIX,
674 needless_continue::NEEDLESS_CONTINUE,
675 needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
676 non_expressive_names::SIMILAR_NAMES,
677 replace_consts::REPLACE_CONSTS,
678 shadow::SHADOW_UNRELATED,
679 strings::STRING_ADD_ASSIGN,
680 trait_bounds::TYPE_REPETITION_IN_BOUNDS,
681 types::CAST_LOSSLESS,
682 types::CAST_POSSIBLE_TRUNCATION,
683 types::CAST_POSSIBLE_WRAP,
684 types::CAST_PRECISION_LOSS,
685 types::CAST_SIGN_LOSS,
686 types::INVALID_UPCAST_COMPARISONS,
688 unicode::NON_ASCII_LITERAL,
689 unicode::UNICODE_NOT_NFC,
690 unused_self::UNUSED_SELF,
694 reg.register_lint_group("clippy::internal", Some("clippy_internal"), vec![
695 utils::internal_lints::CLIPPY_LINTS_INTERNAL,
696 utils::internal_lints::COMPILER_LINT_FUNCTIONS,
697 utils::internal_lints::LINT_WITHOUT_LINT_PASS,
698 utils::internal_lints::OUTER_EXPN_EXPN_DATA,
701 reg.register_lint_group("clippy::all", Some("clippy"), vec![
702 approx_const::APPROX_CONSTANT,
703 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
704 assign_ops::ASSIGN_OP_PATTERN,
705 assign_ops::MISREFACTORED_ASSIGN_OP,
706 attrs::DEPRECATED_CFG_ATTR,
707 attrs::DEPRECATED_SEMVER,
708 attrs::UNKNOWN_CLIPPY_LINTS,
709 attrs::USELESS_ATTRIBUTE,
710 bit_mask::BAD_BIT_MASK,
711 bit_mask::INEFFECTIVE_BIT_MASK,
712 bit_mask::VERBOSE_BIT_MASK,
713 blacklisted_name::BLACKLISTED_NAME,
714 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
715 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
717 booleans::NONMINIMAL_BOOL,
718 bytecount::NAIVE_BYTECOUNT,
719 cognitive_complexity::COGNITIVE_COMPLEXITY,
720 collapsible_if::COLLAPSIBLE_IF,
721 comparison_chain::COMPARISON_CHAIN,
722 copies::IFS_SAME_COND,
723 copies::IF_SAME_THEN_ELSE,
724 derive::DERIVE_HASH_XOR_EQ,
725 doc::MISSING_SAFETY_DOC,
726 doc::NEEDLESS_DOCTEST_MAIN,
727 double_comparison::DOUBLE_COMPARISONS,
728 double_parens::DOUBLE_PARENS,
729 drop_bounds::DROP_BOUNDS,
730 drop_forget_ref::DROP_COPY,
731 drop_forget_ref::DROP_REF,
732 drop_forget_ref::FORGET_COPY,
733 drop_forget_ref::FORGET_REF,
734 duration_subsec::DURATION_SUBSEC,
736 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
737 enum_variants::ENUM_VARIANT_NAMES,
738 enum_variants::MODULE_INCEPTION,
741 erasing_op::ERASING_OP,
743 eta_reduction::REDUNDANT_CLOSURE,
744 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
745 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
746 excessive_precision::EXCESSIVE_PRECISION,
747 explicit_write::EXPLICIT_WRITE,
748 format::USELESS_FORMAT,
749 formatting::POSSIBLE_MISSING_COMMA,
750 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
751 formatting::SUSPICIOUS_ELSE_FORMATTING,
752 formatting::SUSPICIOUS_UNARY_OP_FORMATTING,
753 functions::DOUBLE_MUST_USE,
754 functions::MUST_USE_UNIT,
755 functions::NOT_UNSAFE_PTR_ARG_DEREF,
756 functions::TOO_MANY_ARGUMENTS,
757 get_last_with_len::GET_LAST_WITH_LEN,
758 identity_conversion::IDENTITY_CONVERSION,
759 identity_op::IDENTITY_OP,
760 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
761 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
762 infinite_iter::INFINITE_ITER,
763 inherent_to_string::INHERENT_TO_STRING,
764 inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
765 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
766 int_plus_one::INT_PLUS_ONE,
767 large_enum_variant::LARGE_ENUM_VARIANT,
768 len_zero::LEN_WITHOUT_IS_EMPTY,
770 let_if_seq::USELESS_LET_IF_SEQ,
771 lifetimes::EXTRA_UNUSED_LIFETIMES,
772 lifetimes::NEEDLESS_LIFETIMES,
773 literal_representation::INCONSISTENT_DIGIT_GROUPING,
774 literal_representation::MISTYPED_LITERAL_SUFFIXES,
775 literal_representation::UNREADABLE_LITERAL,
777 loops::EXPLICIT_COUNTER_LOOP,
779 loops::FOR_LOOP_OVER_OPTION,
780 loops::FOR_LOOP_OVER_RESULT,
781 loops::ITER_NEXT_LOOP,
782 loops::MANUAL_MEMCPY,
783 loops::MUT_RANGE_BOUND,
784 loops::NEEDLESS_COLLECT,
785 loops::NEEDLESS_RANGE_LOOP,
787 loops::REVERSE_RANGE_LOOP,
788 loops::WHILE_IMMUTABLE_CONDITION,
789 loops::WHILE_LET_LOOP,
790 loops::WHILE_LET_ON_ITERATOR,
791 main_recursion::MAIN_RECURSION,
792 map_clone::MAP_CLONE,
793 map_unit_fn::OPTION_MAP_UNIT_FN,
794 map_unit_fn::RESULT_MAP_UNIT_FN,
795 matches::MATCH_AS_REF,
797 matches::MATCH_OVERLAPPING_ARM,
798 matches::MATCH_REF_PATS,
799 matches::MATCH_WILD_ERR_ARM,
800 matches::SINGLE_MATCH,
801 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
802 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
803 mem_replace::MEM_REPLACE_WITH_UNINIT,
804 methods::CHARS_LAST_CMP,
805 methods::CHARS_NEXT_CMP,
806 methods::CLONE_DOUBLE_REF,
807 methods::CLONE_ON_COPY,
808 methods::EXPECT_FUN_CALL,
809 methods::FILTER_NEXT,
810 methods::FLAT_MAP_IDENTITY,
811 methods::INEFFICIENT_TO_STRING,
812 methods::INTO_ITER_ON_ARRAY,
813 methods::INTO_ITER_ON_REF,
814 methods::ITER_CLONED_COLLECT,
816 methods::ITER_SKIP_NEXT,
817 methods::MANUAL_SATURATING_ARITHMETIC,
818 methods::NEW_RET_NO_SELF,
820 methods::OPTION_AND_THEN_SOME,
821 methods::OPTION_MAP_OR_NONE,
822 methods::OR_FUN_CALL,
823 methods::SEARCH_IS_SOME,
824 methods::SHOULD_IMPLEMENT_TRAIT,
825 methods::SINGLE_CHAR_PATTERN,
826 methods::STRING_EXTEND_CHARS,
827 methods::SUSPICIOUS_MAP,
828 methods::TEMPORARY_CSTRING_AS_PTR,
829 methods::UNINIT_ASSUMED_INIT,
830 methods::UNNECESSARY_FILTER_MAP,
831 methods::UNNECESSARY_FOLD,
832 methods::USELESS_ASREF,
833 methods::WRONG_SELF_CONVENTION,
839 misc::SHORT_CIRCUIT_STATEMENT,
840 misc::TOPLEVEL_REF_ARG,
842 misc_early::BUILTIN_TYPE_SHADOW,
843 misc_early::DOUBLE_NEG,
844 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
845 misc_early::MIXED_CASE_HEX_LITERALS,
846 misc_early::REDUNDANT_CLOSURE_CALL,
847 misc_early::REDUNDANT_PATTERN,
848 misc_early::UNNEEDED_FIELD_PATTERN,
849 misc_early::UNNEEDED_WILDCARD_PATTERN,
850 misc_early::ZERO_PREFIXED_LITERAL,
851 mul_add::MANUAL_MUL_ADD,
852 mut_reference::UNNECESSARY_MUT_PASSED,
853 mutex_atomic::MUTEX_ATOMIC,
854 needless_bool::BOOL_COMPARISON,
855 needless_bool::NEEDLESS_BOOL,
856 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
857 needless_update::NEEDLESS_UPDATE,
858 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
859 neg_multiply::NEG_MULTIPLY,
860 new_without_default::NEW_WITHOUT_DEFAULT,
861 no_effect::NO_EFFECT,
862 no_effect::UNNECESSARY_OPERATION,
863 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
864 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
865 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
866 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
867 ok_if_let::IF_LET_SOME_RESULT,
868 open_options::NONSENSICAL_OPEN_OPTIONS,
869 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
870 panic_unimplemented::PANIC_PARAMS,
871 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
872 precedence::PRECEDENCE,
876 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
877 question_mark::QUESTION_MARK,
878 ranges::ITERATOR_STEP_BY_ZERO,
879 ranges::RANGE_MINUS_ONE,
880 ranges::RANGE_PLUS_ONE,
881 ranges::RANGE_ZIP_WITH_LEN,
882 redundant_clone::REDUNDANT_CLONE,
883 redundant_field_names::REDUNDANT_FIELD_NAMES,
884 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
885 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
886 reference::DEREF_ADDROF,
887 reference::REF_IN_DEREF,
888 regex::INVALID_REGEX,
890 regex::TRIVIAL_REGEX,
891 returns::LET_AND_RETURN,
892 returns::NEEDLESS_RETURN,
893 returns::UNUSED_UNIT,
894 serde_api::SERDE_API_MISUSE,
895 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
896 strings::STRING_LIT_AS_BYTES,
897 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
898 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
899 swap::ALMOST_SWAPPED,
901 temporary_assignment::TEMPORARY_ASSIGNMENT,
902 transmute::CROSSPOINTER_TRANSMUTE,
903 transmute::TRANSMUTE_BYTES_TO_STR,
904 transmute::TRANSMUTE_INT_TO_BOOL,
905 transmute::TRANSMUTE_INT_TO_CHAR,
906 transmute::TRANSMUTE_INT_TO_FLOAT,
907 transmute::TRANSMUTE_PTR_TO_PTR,
908 transmute::TRANSMUTE_PTR_TO_REF,
909 transmute::UNSOUND_COLLECTION_TRANSMUTE,
910 transmute::USELESS_TRANSMUTE,
911 transmute::WRONG_TRANSMUTE,
912 transmuting_null::TRANSMUTING_NULL,
913 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
915 types::ABSURD_EXTREME_COMPARISONS,
918 types::CAST_PTR_ALIGNMENT,
919 types::CAST_REF_TO_MUT,
920 types::CHAR_LIT_AS_U8,
921 types::FN_TO_NUMERIC_CAST,
922 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
923 types::IMPLICIT_HASHER,
924 types::LET_UNIT_VALUE,
925 types::OPTION_OPTION,
926 types::TYPE_COMPLEXITY,
929 types::UNNECESSARY_CAST,
931 unicode::ZERO_WIDTH_SPACE,
932 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
933 unused_io_amount::UNUSED_IO_AMOUNT,
934 unused_label::UNUSED_LABEL,
935 unwrap::PANICKING_UNWRAP,
936 unwrap::UNNECESSARY_UNWRAP,
938 write::PRINTLN_EMPTY_STRING,
939 write::PRINT_LITERAL,
940 write::PRINT_WITH_NEWLINE,
941 write::WRITELN_EMPTY_STRING,
942 write::WRITE_LITERAL,
943 write::WRITE_WITH_NEWLINE,
944 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
947 reg.register_lint_group("clippy::style", Some("clippy_style"), vec![
948 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
949 assign_ops::ASSIGN_OP_PATTERN,
950 attrs::UNKNOWN_CLIPPY_LINTS,
951 bit_mask::VERBOSE_BIT_MASK,
952 blacklisted_name::BLACKLISTED_NAME,
953 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
954 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
955 collapsible_if::COLLAPSIBLE_IF,
956 comparison_chain::COMPARISON_CHAIN,
957 doc::MISSING_SAFETY_DOC,
958 doc::NEEDLESS_DOCTEST_MAIN,
959 enum_variants::ENUM_VARIANT_NAMES,
960 enum_variants::MODULE_INCEPTION,
962 eta_reduction::REDUNDANT_CLOSURE,
963 excessive_precision::EXCESSIVE_PRECISION,
964 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
965 formatting::SUSPICIOUS_ELSE_FORMATTING,
966 formatting::SUSPICIOUS_UNARY_OP_FORMATTING,
967 functions::DOUBLE_MUST_USE,
968 functions::MUST_USE_UNIT,
969 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
970 inherent_to_string::INHERENT_TO_STRING,
971 len_zero::LEN_WITHOUT_IS_EMPTY,
973 let_if_seq::USELESS_LET_IF_SEQ,
974 literal_representation::INCONSISTENT_DIGIT_GROUPING,
975 literal_representation::UNREADABLE_LITERAL,
978 loops::NEEDLESS_RANGE_LOOP,
979 loops::WHILE_LET_ON_ITERATOR,
980 main_recursion::MAIN_RECURSION,
981 map_clone::MAP_CLONE,
983 matches::MATCH_OVERLAPPING_ARM,
984 matches::MATCH_REF_PATS,
985 matches::MATCH_WILD_ERR_ARM,
986 matches::SINGLE_MATCH,
987 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
988 methods::CHARS_LAST_CMP,
989 methods::INTO_ITER_ON_REF,
990 methods::ITER_CLONED_COLLECT,
991 methods::ITER_SKIP_NEXT,
992 methods::MANUAL_SATURATING_ARITHMETIC,
993 methods::NEW_RET_NO_SELF,
995 methods::OPTION_MAP_OR_NONE,
996 methods::SHOULD_IMPLEMENT_TRAIT,
997 methods::STRING_EXTEND_CHARS,
998 methods::UNNECESSARY_FOLD,
999 methods::WRONG_SELF_CONVENTION,
1000 misc::TOPLEVEL_REF_ARG,
1002 misc_early::BUILTIN_TYPE_SHADOW,
1003 misc_early::DOUBLE_NEG,
1004 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
1005 misc_early::MIXED_CASE_HEX_LITERALS,
1006 misc_early::REDUNDANT_PATTERN,
1007 misc_early::UNNEEDED_FIELD_PATTERN,
1008 mut_reference::UNNECESSARY_MUT_PASSED,
1009 neg_multiply::NEG_MULTIPLY,
1010 new_without_default::NEW_WITHOUT_DEFAULT,
1011 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
1012 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
1013 ok_if_let::IF_LET_SOME_RESULT,
1014 panic_unimplemented::PANIC_PARAMS,
1017 question_mark::QUESTION_MARK,
1018 redundant_field_names::REDUNDANT_FIELD_NAMES,
1019 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
1020 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
1022 regex::TRIVIAL_REGEX,
1023 returns::LET_AND_RETURN,
1024 returns::NEEDLESS_RETURN,
1025 returns::UNUSED_UNIT,
1026 strings::STRING_LIT_AS_BYTES,
1028 types::FN_TO_NUMERIC_CAST,
1029 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
1030 types::IMPLICIT_HASHER,
1031 types::LET_UNIT_VALUE,
1032 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
1033 write::PRINTLN_EMPTY_STRING,
1034 write::PRINT_LITERAL,
1035 write::PRINT_WITH_NEWLINE,
1036 write::WRITELN_EMPTY_STRING,
1037 write::WRITE_LITERAL,
1038 write::WRITE_WITH_NEWLINE,
1041 reg.register_lint_group("clippy::complexity", Some("clippy_complexity"), vec![
1042 assign_ops::MISREFACTORED_ASSIGN_OP,
1043 attrs::DEPRECATED_CFG_ATTR,
1044 booleans::NONMINIMAL_BOOL,
1045 cognitive_complexity::COGNITIVE_COMPLEXITY,
1046 double_comparison::DOUBLE_COMPARISONS,
1047 double_parens::DOUBLE_PARENS,
1048 duration_subsec::DURATION_SUBSEC,
1049 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
1050 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
1051 explicit_write::EXPLICIT_WRITE,
1052 format::USELESS_FORMAT,
1053 functions::TOO_MANY_ARGUMENTS,
1054 get_last_with_len::GET_LAST_WITH_LEN,
1055 identity_conversion::IDENTITY_CONVERSION,
1056 identity_op::IDENTITY_OP,
1057 int_plus_one::INT_PLUS_ONE,
1058 lifetimes::EXTRA_UNUSED_LIFETIMES,
1059 lifetimes::NEEDLESS_LIFETIMES,
1060 loops::EXPLICIT_COUNTER_LOOP,
1061 loops::MUT_RANGE_BOUND,
1062 loops::WHILE_LET_LOOP,
1063 map_unit_fn::OPTION_MAP_UNIT_FN,
1064 map_unit_fn::RESULT_MAP_UNIT_FN,
1065 matches::MATCH_AS_REF,
1066 methods::CHARS_NEXT_CMP,
1067 methods::CLONE_ON_COPY,
1068 methods::FILTER_NEXT,
1069 methods::FLAT_MAP_IDENTITY,
1070 methods::OPTION_AND_THEN_SOME,
1071 methods::SEARCH_IS_SOME,
1072 methods::SUSPICIOUS_MAP,
1073 methods::UNNECESSARY_FILTER_MAP,
1074 methods::USELESS_ASREF,
1075 misc::SHORT_CIRCUIT_STATEMENT,
1076 misc_early::REDUNDANT_CLOSURE_CALL,
1077 misc_early::UNNEEDED_WILDCARD_PATTERN,
1078 misc_early::ZERO_PREFIXED_LITERAL,
1079 needless_bool::BOOL_COMPARISON,
1080 needless_bool::NEEDLESS_BOOL,
1081 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
1082 needless_update::NEEDLESS_UPDATE,
1083 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
1084 no_effect::NO_EFFECT,
1085 no_effect::UNNECESSARY_OPERATION,
1086 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
1087 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
1088 precedence::PRECEDENCE,
1089 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
1090 ranges::RANGE_MINUS_ONE,
1091 ranges::RANGE_PLUS_ONE,
1092 ranges::RANGE_ZIP_WITH_LEN,
1093 reference::DEREF_ADDROF,
1094 reference::REF_IN_DEREF,
1096 temporary_assignment::TEMPORARY_ASSIGNMENT,
1097 transmute::CROSSPOINTER_TRANSMUTE,
1098 transmute::TRANSMUTE_BYTES_TO_STR,
1099 transmute::TRANSMUTE_INT_TO_BOOL,
1100 transmute::TRANSMUTE_INT_TO_CHAR,
1101 transmute::TRANSMUTE_INT_TO_FLOAT,
1102 transmute::TRANSMUTE_PTR_TO_PTR,
1103 transmute::TRANSMUTE_PTR_TO_REF,
1104 transmute::USELESS_TRANSMUTE,
1105 types::BORROWED_BOX,
1106 types::CHAR_LIT_AS_U8,
1107 types::OPTION_OPTION,
1108 types::TYPE_COMPLEXITY,
1110 types::UNNECESSARY_CAST,
1112 unused_label::UNUSED_LABEL,
1113 unwrap::UNNECESSARY_UNWRAP,
1114 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
1117 reg.register_lint_group("clippy::correctness", Some("clippy_correctness"), vec![
1118 approx_const::APPROX_CONSTANT,
1119 attrs::DEPRECATED_SEMVER,
1120 attrs::USELESS_ATTRIBUTE,
1121 bit_mask::BAD_BIT_MASK,
1122 bit_mask::INEFFECTIVE_BIT_MASK,
1123 booleans::LOGIC_BUG,
1124 copies::IFS_SAME_COND,
1125 copies::IF_SAME_THEN_ELSE,
1126 derive::DERIVE_HASH_XOR_EQ,
1127 drop_bounds::DROP_BOUNDS,
1128 drop_forget_ref::DROP_COPY,
1129 drop_forget_ref::DROP_REF,
1130 drop_forget_ref::FORGET_COPY,
1131 drop_forget_ref::FORGET_REF,
1132 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
1134 erasing_op::ERASING_OP,
1135 formatting::POSSIBLE_MISSING_COMMA,
1136 functions::NOT_UNSAFE_PTR_ARG_DEREF,
1137 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
1138 infinite_iter::INFINITE_ITER,
1139 inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
1140 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
1141 literal_representation::MISTYPED_LITERAL_SUFFIXES,
1142 loops::FOR_LOOP_OVER_OPTION,
1143 loops::FOR_LOOP_OVER_RESULT,
1144 loops::ITER_NEXT_LOOP,
1146 loops::REVERSE_RANGE_LOOP,
1147 loops::WHILE_IMMUTABLE_CONDITION,
1148 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
1149 mem_replace::MEM_REPLACE_WITH_UNINIT,
1150 methods::CLONE_DOUBLE_REF,
1151 methods::INTO_ITER_ON_ARRAY,
1152 methods::TEMPORARY_CSTRING_AS_PTR,
1153 methods::UNINIT_ASSUMED_INIT,
1158 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
1159 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
1160 open_options::NONSENSICAL_OPEN_OPTIONS,
1162 ranges::ITERATOR_STEP_BY_ZERO,
1163 regex::INVALID_REGEX,
1164 serde_api::SERDE_API_MISUSE,
1165 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
1166 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
1167 swap::ALMOST_SWAPPED,
1168 transmute::UNSOUND_COLLECTION_TRANSMUTE,
1169 transmute::WRONG_TRANSMUTE,
1170 transmuting_null::TRANSMUTING_NULL,
1171 types::ABSURD_EXTREME_COMPARISONS,
1172 types::CAST_PTR_ALIGNMENT,
1173 types::CAST_REF_TO_MUT,
1175 unicode::ZERO_WIDTH_SPACE,
1176 unused_io_amount::UNUSED_IO_AMOUNT,
1177 unwrap::PANICKING_UNWRAP,
1180 reg.register_lint_group("clippy::perf", Some("clippy_perf"), vec![
1181 bytecount::NAIVE_BYTECOUNT,
1183 escape::BOXED_LOCAL,
1184 large_enum_variant::LARGE_ENUM_VARIANT,
1185 loops::MANUAL_MEMCPY,
1186 loops::NEEDLESS_COLLECT,
1187 methods::EXPECT_FUN_CALL,
1188 methods::INEFFICIENT_TO_STRING,
1190 methods::OR_FUN_CALL,
1191 methods::SINGLE_CHAR_PATTERN,
1193 mul_add::MANUAL_MUL_ADD,
1194 mutex_atomic::MUTEX_ATOMIC,
1195 redundant_clone::REDUNDANT_CLONE,
1196 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
1197 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
1202 reg.register_lint_group("clippy::cargo", Some("clippy_cargo"), vec![
1203 cargo_common_metadata::CARGO_COMMON_METADATA,
1204 multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
1205 wildcard_dependencies::WILDCARD_DEPENDENCIES,
1208 reg.register_lint_group("clippy::nursery", Some("clippy_nursery"), vec![
1209 attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
1210 fallible_impl_from::FALLIBLE_IMPL_FROM,
1211 missing_const_for_fn::MISSING_CONST_FOR_FN,
1212 mutex_atomic::MUTEX_INTEGER,
1213 needless_borrow::NEEDLESS_BORROW,
1214 path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
1219 fn register_removed_non_tool_lints(store: &mut rustc::lint::LintStore) {
1220 store.register_removed(
1222 "`assert!()` will be more flexible with RFC 2011",
1224 store.register_removed(
1225 "extend_from_slice",
1226 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
1228 store.register_removed(
1229 "range_step_by_zero",
1230 "`iterator.step_by(0)` panics nowadays",
1232 store.register_removed(
1233 "unstable_as_slice",
1234 "`Vec::as_slice` has been stabilized in 1.7",
1236 store.register_removed(
1237 "unstable_as_mut_slice",
1238 "`Vec::as_mut_slice` has been stabilized in 1.7",
1240 store.register_removed(
1242 "using `str::to_string` is common even today and specialization will likely happen soon",
1244 store.register_removed(
1246 "using `string::to_string` is common even today and specialization will likely happen soon",
1248 store.register_removed(
1249 "misaligned_transmute",
1250 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
1252 store.register_removed(
1254 "using compound assignment operators (e.g., `+=`) is harmless",
1256 store.register_removed(
1257 "if_let_redundant_pattern_matching",
1258 "this lint has been changed to redundant_pattern_matching",
1260 store.register_removed(
1261 "unsafe_vector_initialization",
1262 "the replacement suggested by this lint had substantially different behavior",
1266 /// Register renamed lints.
1268 /// Used in `./src/driver.rs`.
1269 pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
1270 ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1271 ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
1272 ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
1273 ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
1276 // only exists to let the dogfood integration test works.
1277 // Don't run clippy as an executable directly
1280 panic!("Please use the cargo-clippy executable");