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)]
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_mir;
31 #[allow(unused_extern_crates)]
32 extern crate rustc_target;
33 #[allow(unused_extern_crates)]
34 extern crate rustc_typeck;
35 #[allow(unused_extern_crates)]
37 #[allow(unused_extern_crates)]
38 extern crate syntax_pos;
42 /// Macro used to declare a Clippy lint.
44 /// Every lint declaration consists of 4 parts:
46 /// 1. The documentation, which is used for the website
47 /// 2. The `LINT_NAME`. See [lint naming][lint_naming] on lint naming conventions.
48 /// 3. The `lint_level`, which is a mapping from *one* of our lint groups to `Allow`, `Warn` or
49 /// `Deny`. The lint level here has nothing to do with what lint groups the lint is a part of.
50 /// 4. The `description` that contains a short explanation on what's wrong with code where the
51 /// lint is triggered.
53 /// Currently the categories `style`, `correctness`, `complexity` and `perf` are enabled by default.
54 /// As said in the README.md of this repository, if the lint level mapping changes, please update
60 /// # #![feature(rustc_private)]
61 /// # #[allow(unused_extern_crates)]
62 /// # extern crate rustc;
64 /// # use clippy_lints::declare_clippy_lint;
65 /// use rustc::declare_tool_lint;
67 /// declare_clippy_lint! {
68 /// /// **What it does:** Checks for ... (describe what the lint matches).
70 /// /// **Why is this bad?** Supply the reason for linting the code.
72 /// /// **Known problems:** None. (Or describe where it could go wrong.)
78 /// /// Insert a short example of code that triggers the lint
81 /// /// Insert a short example of improved code that doesn't trigger the lint
88 /// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
90 macro_rules! declare_clippy_lint {
91 { $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
93 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
96 { $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
98 $(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
101 { $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
103 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
106 { $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
108 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
111 { $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
113 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
116 { $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
118 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
121 { $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
123 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
126 { $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
128 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
131 { $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
133 $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
136 { $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
138 $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
147 // begin lints modules, do not remove this comment, it’s used in `update_lints`
148 pub mod approx_const;
150 pub mod assertions_on_constants;
154 pub mod blacklisted_name;
155 pub mod block_in_if_condition;
158 pub mod cargo_common_metadata;
159 pub mod checked_conversions;
160 pub mod cognitive_complexity;
161 pub mod collapsible_if;
163 pub mod copy_iterator;
165 pub mod default_trait_access;
168 pub mod double_comparison;
169 pub mod double_parens;
171 pub mod drop_forget_ref;
172 pub mod duration_subsec;
173 pub mod else_if_without_else;
177 pub mod enum_glob_use;
178 pub mod enum_variants;
182 pub mod eta_reduction;
183 pub mod eval_order_dependence;
184 pub mod excessive_precision;
185 pub mod explicit_write;
186 pub mod fallible_impl_from;
190 pub mod get_last_with_len;
191 pub mod identity_conversion;
194 pub mod implicit_return;
195 pub mod indexing_slicing;
196 pub mod infallible_destructuring_match;
197 pub mod infinite_iter;
198 pub mod inherent_impl;
199 pub mod inherent_to_string;
200 pub mod inline_fn_without_body;
201 pub mod int_plus_one;
202 pub mod integer_division;
203 pub mod items_after_statements;
204 pub mod large_enum_variant;
208 pub mod literal_representation;
210 pub mod main_recursion;
214 pub mod mem_discriminant;
221 pub mod missing_const_for_fn;
223 pub mod missing_inline;
224 pub mod multiple_crate_versions;
226 pub mod mut_reference;
227 pub mod mutex_atomic;
228 pub mod needless_bool;
229 pub mod needless_borrow;
230 pub mod needless_borrowed_ref;
231 pub mod needless_continue;
232 pub mod needless_pass_by_value;
233 pub mod needless_update;
234 pub mod neg_cmp_op_on_partial_ord;
235 pub mod neg_multiply;
236 pub mod new_without_default;
238 pub mod non_copy_const;
239 pub mod non_expressive_names;
241 pub mod open_options;
242 pub mod overflow_check_conditional;
243 pub mod panic_unimplemented;
244 pub mod partialeq_ne_impl;
245 pub mod path_buf_push_overwrite;
248 pub mod ptr_offset_with_cast;
249 pub mod question_mark;
251 pub mod redundant_clone;
252 pub mod redundant_field_names;
253 pub mod redundant_pattern_matching;
254 pub mod redundant_static_lifetimes;
257 pub mod replace_consts;
261 pub mod slow_vector_initialization;
263 pub mod suspicious_trait_impl;
265 pub mod temporary_assignment;
266 pub mod trait_bounds;
268 pub mod transmuting_null;
269 pub mod trivially_copy_pass_by_ref;
273 pub mod unsafe_removed_from_name;
274 pub mod unused_io_amount;
275 pub mod unused_label;
279 pub mod wildcard_dependencies;
281 pub mod zero_div_zero;
282 // end lints modules, do not remove this comment, it’s used in `update_lints`
284 pub use crate::utils::conf::Conf;
287 crate use syntax::ast::Name;
290 /// Register all pre expansion lints
292 /// Pre-expansion lints run before any macro expansion has happened.
294 /// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
295 /// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
297 /// Used in `./src/driver.rs`.
298 pub fn register_pre_expansion_lints(
299 session: &rustc::session::Session,
300 store: &mut rustc::lint::LintStore,
303 store.register_pre_expansion_pass(Some(session), true, false, box write::Write);
304 store.register_pre_expansion_pass(
308 box redundant_field_names::RedundantFieldNames,
310 store.register_pre_expansion_pass(
314 box non_expressive_names::NonExpressiveNames {
315 single_char_binding_names_threshold: conf.single_char_binding_names_threshold,
318 store.register_pre_expansion_pass(Some(session), true, false, box attrs::DeprecatedCfgAttribute);
319 store.register_pre_expansion_pass(Some(session), true, false, box dbg_macro::DbgMacro);
323 pub fn read_conf(reg: &rustc_driver::plugin::Registry<'_>) -> Conf {
324 match utils::conf::file_from_args(reg.args()) {
326 // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
327 // do not require the file to exist
328 let file_name = if let Some(file_name) = file_name {
331 match utils::conf::lookup_conf_file() {
335 .struct_err(&format!("error finding Clippy's configuration file: {}", error))
342 let file_name = file_name.map(|file_name| {
343 if file_name.is_relative() {
345 .local_crate_source_file
347 .and_then(|file| std::path::Path::new(&file).parent().map(std::path::Path::to_path_buf))
355 let (conf, errors) = utils::conf::read(file_name.as_ref().map(std::convert::AsRef::as_ref));
357 // all conf errors are non-fatal, we just use the default conf in case of error
358 for error in errors {
360 .struct_err(&format!(
361 "error reading Clippy's configuration file `{}`: {}",
362 file_name.as_ref().and_then(|p| p.to_str()).unwrap_or(""),
370 Err((err, span)) => {
372 .struct_span_err(span, err)
373 .span_note(span, "Clippy will use default configuration")
375 toml::from_str("").expect("we never error on empty config files")
380 /// Register all lints and lint groups with the rustc plugin registry
382 /// Used in `./src/driver.rs`.
383 #[allow(clippy::too_many_lines)]
385 pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Conf) {
386 let mut store = reg.sess.lint_store.borrow_mut();
387 register_removed_non_tool_lints(&mut store);
389 // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
390 store.register_removed(
391 "clippy::should_assert_eq",
392 "`assert!()` will be more flexible with RFC 2011",
394 store.register_removed(
395 "clippy::extend_from_slice",
396 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
398 store.register_removed(
399 "clippy::range_step_by_zero",
400 "`iterator.step_by(0)` panics nowadays",
402 store.register_removed(
403 "clippy::unstable_as_slice",
404 "`Vec::as_slice` has been stabilized in 1.7",
406 store.register_removed(
407 "clippy::unstable_as_mut_slice",
408 "`Vec::as_mut_slice` has been stabilized in 1.7",
410 store.register_removed(
411 "clippy::str_to_string",
412 "using `str::to_string` is common even today and specialization will likely happen soon",
414 store.register_removed(
415 "clippy::string_to_string",
416 "using `string::to_string` is common even today and specialization will likely happen soon",
418 store.register_removed(
419 "clippy::misaligned_transmute",
420 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
422 store.register_removed(
423 "clippy::assign_ops",
424 "using compound assignment operators (e.g., `+=`) is harmless",
426 store.register_removed(
427 "clippy::if_let_redundant_pattern_matching",
428 "this lint has been changed to redundant_pattern_matching",
430 store.register_removed(
431 "clippy::unsafe_vector_initialization",
432 "the replacement suggested by this lint had substantially different behavior",
434 store.register_removed(
435 "clippy::invalid_ref",
436 "superseded by rustc lint `invalid_value`",
438 store.register_removed(
439 "clippy::unused_collect",
440 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint",
442 // end deprecated lints, do not remove this comment, it’s used in `update_lints`
444 reg.register_late_lint_pass(box serde_api::SerdeAPI);
445 reg.register_early_lint_pass(box utils::internal_lints::ClippyLintsInternal);
446 reg.register_late_lint_pass(box utils::internal_lints::CompilerLintFunctions::new());
447 reg.register_late_lint_pass(box utils::internal_lints::LintWithoutLintPass::default());
448 reg.register_late_lint_pass(box utils::internal_lints::OuterExpnDataPass);
449 reg.register_late_lint_pass(box utils::inspector::DeepCodeInspector);
450 reg.register_late_lint_pass(box utils::author::Author);
451 reg.register_late_lint_pass(box types::Types);
452 reg.register_late_lint_pass(box booleans::NonminimalBool);
453 reg.register_late_lint_pass(box eq_op::EqOp);
454 reg.register_early_lint_pass(box enum_variants::EnumVariantNames::new(conf.enum_variant_name_threshold));
455 reg.register_late_lint_pass(box enum_glob_use::EnumGlobUse);
456 reg.register_late_lint_pass(box enum_clike::UnportableVariant);
457 reg.register_late_lint_pass(box excessive_precision::ExcessivePrecision);
458 reg.register_late_lint_pass(box bit_mask::BitMask::new(conf.verbose_bit_mask_threshold));
459 reg.register_late_lint_pass(box ptr::Ptr);
460 reg.register_late_lint_pass(box needless_bool::NeedlessBool);
461 reg.register_late_lint_pass(box needless_bool::BoolComparison);
462 reg.register_late_lint_pass(box approx_const::ApproxConstant);
463 reg.register_late_lint_pass(box misc::MiscLints);
464 reg.register_early_lint_pass(box precedence::Precedence);
465 reg.register_early_lint_pass(box needless_continue::NeedlessContinue);
466 reg.register_late_lint_pass(box eta_reduction::EtaReduction);
467 reg.register_late_lint_pass(box identity_op::IdentityOp);
468 reg.register_late_lint_pass(box erasing_op::ErasingOp);
469 reg.register_early_lint_pass(box items_after_statements::ItemsAfterStatements);
470 reg.register_late_lint_pass(box mut_mut::MutMut);
471 reg.register_late_lint_pass(box mut_reference::UnnecessaryMutPassed);
472 reg.register_late_lint_pass(box len_zero::LenZero);
473 reg.register_late_lint_pass(box attrs::Attributes);
474 reg.register_early_lint_pass(box collapsible_if::CollapsibleIf);
475 reg.register_late_lint_pass(box block_in_if_condition::BlockInIfCondition);
476 reg.register_late_lint_pass(box unicode::Unicode);
477 reg.register_late_lint_pass(box strings::StringAdd);
478 reg.register_early_lint_pass(box returns::Return);
479 reg.register_late_lint_pass(box implicit_return::ImplicitReturn);
480 reg.register_late_lint_pass(box methods::Methods);
481 reg.register_late_lint_pass(box map_clone::MapClone);
482 reg.register_late_lint_pass(box shadow::Shadow);
483 reg.register_late_lint_pass(box types::LetUnitValue);
484 reg.register_late_lint_pass(box types::UnitCmp);
485 reg.register_late_lint_pass(box loops::Loops);
486 reg.register_late_lint_pass(box main_recursion::MainRecursion::default());
487 reg.register_late_lint_pass(box lifetimes::Lifetimes);
488 reg.register_late_lint_pass(box entry::HashMapPass);
489 reg.register_late_lint_pass(box ranges::Ranges);
490 reg.register_late_lint_pass(box types::Casts);
491 reg.register_late_lint_pass(box types::TypeComplexity::new(conf.type_complexity_threshold));
492 reg.register_late_lint_pass(box matches::Matches);
493 reg.register_late_lint_pass(box minmax::MinMaxPass);
494 reg.register_late_lint_pass(box open_options::OpenOptions);
495 reg.register_late_lint_pass(box zero_div_zero::ZeroDiv);
496 reg.register_late_lint_pass(box mutex_atomic::Mutex);
497 reg.register_late_lint_pass(box needless_update::NeedlessUpdate);
498 reg.register_late_lint_pass(box needless_borrow::NeedlessBorrow::default());
499 reg.register_late_lint_pass(box needless_borrowed_ref::NeedlessBorrowedRef);
500 reg.register_late_lint_pass(box no_effect::NoEffect);
501 reg.register_late_lint_pass(box temporary_assignment::TemporaryAssignment);
502 reg.register_late_lint_pass(box transmute::Transmute);
503 reg.register_late_lint_pass(
504 box cognitive_complexity::CognitiveComplexity::new(conf.cognitive_complexity_threshold)
506 reg.register_late_lint_pass(box escape::BoxedLocal{too_large_for_stack: conf.too_large_for_stack});
507 reg.register_early_lint_pass(box misc_early::MiscEarlyLints);
508 reg.register_late_lint_pass(box panic_unimplemented::PanicUnimplemented);
509 reg.register_late_lint_pass(box strings::StringLitAsBytes);
510 reg.register_late_lint_pass(box derive::Derive);
511 reg.register_late_lint_pass(box types::CharLitAsU8);
512 reg.register_late_lint_pass(box vec::UselessVec);
513 reg.register_late_lint_pass(box drop_bounds::DropBounds);
514 reg.register_late_lint_pass(box get_last_with_len::GetLastWithLen);
515 reg.register_late_lint_pass(box drop_forget_ref::DropForgetRef);
516 reg.register_late_lint_pass(box empty_enum::EmptyEnum);
517 reg.register_late_lint_pass(box types::AbsurdExtremeComparisons);
518 reg.register_late_lint_pass(box types::InvalidUpcastComparisons);
519 reg.register_late_lint_pass(box regex::Regex::default());
520 reg.register_late_lint_pass(box copies::CopyAndPaste);
521 reg.register_late_lint_pass(box copy_iterator::CopyIterator);
522 reg.register_late_lint_pass(box format::UselessFormat);
523 reg.register_early_lint_pass(box formatting::Formatting);
524 reg.register_late_lint_pass(box swap::Swap);
525 reg.register_early_lint_pass(box if_not_else::IfNotElse);
526 reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse);
527 reg.register_early_lint_pass(box int_plus_one::IntPlusOne);
528 reg.register_late_lint_pass(box overflow_check_conditional::OverflowCheckConditional);
529 reg.register_late_lint_pass(box unused_label::UnusedLabel);
530 reg.register_late_lint_pass(box new_without_default::NewWithoutDefault::default());
531 reg.register_late_lint_pass(box blacklisted_name::BlacklistedName::new(
532 conf.blacklisted_names.iter().cloned().collect()
534 reg.register_late_lint_pass(box functions::Functions::new(conf.too_many_arguments_threshold, conf.too_many_lines_threshold));
535 reg.register_early_lint_pass(box doc::DocMarkdown::new(conf.doc_valid_idents.iter().cloned().collect()));
536 reg.register_late_lint_pass(box neg_multiply::NegMultiply);
537 reg.register_early_lint_pass(box unsafe_removed_from_name::UnsafeNameRemoval);
538 reg.register_late_lint_pass(box mem_discriminant::MemDiscriminant);
539 reg.register_late_lint_pass(box mem_forget::MemForget);
540 reg.register_late_lint_pass(box mem_replace::MemReplace);
541 reg.register_late_lint_pass(box arithmetic::Arithmetic::default());
542 reg.register_late_lint_pass(box assign_ops::AssignOps);
543 reg.register_late_lint_pass(box let_if_seq::LetIfSeq);
544 reg.register_late_lint_pass(box eval_order_dependence::EvalOrderDependence);
545 reg.register_late_lint_pass(box missing_doc::MissingDoc::new());
546 reg.register_late_lint_pass(box missing_inline::MissingInline);
547 reg.register_late_lint_pass(box ok_if_let::OkIfLet);
548 reg.register_late_lint_pass(box redundant_pattern_matching::RedundantPatternMatching);
549 reg.register_late_lint_pass(box partialeq_ne_impl::PartialEqNeImpl);
550 reg.register_early_lint_pass(box reference::DerefAddrOf);
551 reg.register_early_lint_pass(box reference::RefInDeref);
552 reg.register_early_lint_pass(box double_parens::DoubleParens);
553 reg.register_late_lint_pass(box unused_io_amount::UnusedIoAmount);
554 reg.register_late_lint_pass(box large_enum_variant::LargeEnumVariant::new(conf.enum_variant_size_threshold));
555 reg.register_late_lint_pass(box explicit_write::ExplicitWrite);
556 reg.register_late_lint_pass(box needless_pass_by_value::NeedlessPassByValue);
557 reg.register_late_lint_pass(box trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
558 conf.trivial_copy_size_limit,
561 reg.register_early_lint_pass(box literal_representation::LiteralDigitGrouping);
562 reg.register_early_lint_pass(box literal_representation::DecimalLiteralRepresentation::new(
563 conf.literal_representation_threshold
565 reg.register_late_lint_pass(box try_err::TryErr);
566 reg.register_late_lint_pass(box use_self::UseSelf);
567 reg.register_late_lint_pass(box bytecount::ByteCount);
568 reg.register_late_lint_pass(box infinite_iter::InfiniteIter);
569 reg.register_late_lint_pass(box inline_fn_without_body::InlineFnWithoutBody);
570 reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
571 reg.register_late_lint_pass(box types::ImplicitHasher);
572 reg.register_early_lint_pass(box redundant_static_lifetimes::RedundantStaticLifetimes);
573 reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom);
574 reg.register_late_lint_pass(box replace_consts::ReplaceConsts);
575 reg.register_late_lint_pass(box types::UnitArg);
576 reg.register_late_lint_pass(box double_comparison::DoubleComparisons);
577 reg.register_late_lint_pass(box question_mark::QuestionMark);
578 reg.register_late_lint_pass(box suspicious_trait_impl::SuspiciousImpl);
579 reg.register_early_lint_pass(box cargo_common_metadata::CargoCommonMetadata);
580 reg.register_early_lint_pass(box multiple_crate_versions::MultipleCrateVersions);
581 reg.register_early_lint_pass(box wildcard_dependencies::WildcardDependencies);
582 reg.register_late_lint_pass(box map_unit_fn::MapUnit);
583 reg.register_late_lint_pass(box infallible_destructuring_match::InfallibleDestructingMatch);
584 reg.register_late_lint_pass(box inherent_impl::MultipleInherentImpl::default());
585 reg.register_late_lint_pass(box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
586 reg.register_late_lint_pass(box unwrap::Unwrap);
587 reg.register_late_lint_pass(box duration_subsec::DurationSubsec);
588 reg.register_late_lint_pass(box default_trait_access::DefaultTraitAccess);
589 reg.register_late_lint_pass(box indexing_slicing::IndexingSlicing);
590 reg.register_late_lint_pass(box non_copy_const::NonCopyConst);
591 reg.register_late_lint_pass(box ptr_offset_with_cast::PtrOffsetWithCast);
592 reg.register_late_lint_pass(box redundant_clone::RedundantClone);
593 reg.register_late_lint_pass(box slow_vector_initialization::SlowVectorInit);
594 reg.register_late_lint_pass(box types::RefToMut);
595 reg.register_late_lint_pass(box assertions_on_constants::AssertionsOnConstants);
596 reg.register_late_lint_pass(box missing_const_for_fn::MissingConstForFn);
597 reg.register_late_lint_pass(box transmuting_null::TransmutingNull);
598 reg.register_late_lint_pass(box path_buf_push_overwrite::PathBufPushOverwrite);
599 reg.register_late_lint_pass(box checked_conversions::CheckedConversions);
600 reg.register_late_lint_pass(box integer_division::IntegerDivision);
601 reg.register_late_lint_pass(box inherent_to_string::InherentToString);
602 reg.register_late_lint_pass(box trait_bounds::TraitBounds);
604 reg.register_lint_group("clippy::restriction", Some("clippy_restriction"), vec![
605 arithmetic::FLOAT_ARITHMETIC,
606 arithmetic::INTEGER_ARITHMETIC,
607 dbg_macro::DBG_MACRO,
608 else_if_without_else::ELSE_IF_WITHOUT_ELSE,
609 implicit_return::IMPLICIT_RETURN,
610 indexing_slicing::INDEXING_SLICING,
611 inherent_impl::MULTIPLE_INHERENT_IMPL,
612 integer_division::INTEGER_DIVISION,
613 literal_representation::DECIMAL_LITERAL_REPRESENTATION,
614 matches::WILDCARD_ENUM_MATCH_ARM,
615 mem_forget::MEM_FORGET,
616 methods::CLONE_ON_REF_PTR,
618 methods::OPTION_UNWRAP_USED,
619 methods::RESULT_UNWRAP_USED,
620 methods::WRONG_PUB_SELF_CONVENTION,
621 misc::FLOAT_CMP_CONST,
622 missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
623 missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
624 panic_unimplemented::UNIMPLEMENTED,
625 shadow::SHADOW_REUSE,
632 reg.register_lint_group("clippy::pedantic", Some("clippy_pedantic"), vec![
633 attrs::INLINE_ALWAYS,
634 checked_conversions::CHECKED_CONVERSIONS,
635 copies::MATCH_SAME_ARMS,
636 copy_iterator::COPY_ITERATOR,
637 default_trait_access::DEFAULT_TRAIT_ACCESS,
638 derive::EXPL_IMPL_CLONE_ON_COPY,
640 empty_enum::EMPTY_ENUM,
641 enum_glob_use::ENUM_GLOB_USE,
642 enum_variants::MODULE_NAME_REPETITIONS,
643 enum_variants::PUB_ENUM_VARIANT_NAMES,
644 eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
645 functions::TOO_MANY_LINES,
646 if_not_else::IF_NOT_ELSE,
647 infinite_iter::MAYBE_INFINITE_ITER,
648 items_after_statements::ITEMS_AFTER_STATEMENTS,
649 literal_representation::LARGE_DIGIT_GROUPS,
650 loops::EXPLICIT_INTO_ITER_LOOP,
651 loops::EXPLICIT_ITER_LOOP,
652 matches::SINGLE_MATCH_ELSE,
654 methods::FILTER_MAP_NEXT,
656 methods::MAP_FLATTEN,
657 methods::OPTION_MAP_UNWRAP_OR,
658 methods::OPTION_MAP_UNWRAP_OR_ELSE,
659 methods::RESULT_MAP_UNWRAP_OR_ELSE,
660 misc::USED_UNDERSCORE_BINDING,
661 misc_early::UNSEPARATED_LITERAL_SUFFIX,
663 needless_continue::NEEDLESS_CONTINUE,
664 needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
665 non_expressive_names::SIMILAR_NAMES,
666 replace_consts::REPLACE_CONSTS,
667 shadow::SHADOW_UNRELATED,
668 strings::STRING_ADD_ASSIGN,
669 trait_bounds::TYPE_REPETITION_IN_BOUNDS,
670 types::CAST_POSSIBLE_TRUNCATION,
671 types::CAST_POSSIBLE_WRAP,
672 types::CAST_PRECISION_LOSS,
673 types::CAST_SIGN_LOSS,
674 types::INVALID_UPCAST_COMPARISONS,
676 unicode::NON_ASCII_LITERAL,
677 unicode::UNICODE_NOT_NFC,
681 reg.register_lint_group("clippy::internal", Some("clippy_internal"), vec![
682 utils::internal_lints::CLIPPY_LINTS_INTERNAL,
683 utils::internal_lints::COMPILER_LINT_FUNCTIONS,
684 utils::internal_lints::LINT_WITHOUT_LINT_PASS,
685 utils::internal_lints::OUTER_EXPN_EXPN_DATA,
688 reg.register_lint_group("clippy::all", Some("clippy"), vec![
689 approx_const::APPROX_CONSTANT,
690 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
691 assign_ops::ASSIGN_OP_PATTERN,
692 assign_ops::MISREFACTORED_ASSIGN_OP,
693 attrs::DEPRECATED_CFG_ATTR,
694 attrs::DEPRECATED_SEMVER,
695 attrs::UNKNOWN_CLIPPY_LINTS,
696 attrs::USELESS_ATTRIBUTE,
697 bit_mask::BAD_BIT_MASK,
698 bit_mask::INEFFECTIVE_BIT_MASK,
699 bit_mask::VERBOSE_BIT_MASK,
700 blacklisted_name::BLACKLISTED_NAME,
701 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
702 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
704 booleans::NONMINIMAL_BOOL,
705 bytecount::NAIVE_BYTECOUNT,
706 cognitive_complexity::COGNITIVE_COMPLEXITY,
707 collapsible_if::COLLAPSIBLE_IF,
708 copies::IFS_SAME_COND,
709 copies::IF_SAME_THEN_ELSE,
710 derive::DERIVE_HASH_XOR_EQ,
711 double_comparison::DOUBLE_COMPARISONS,
712 double_parens::DOUBLE_PARENS,
713 drop_bounds::DROP_BOUNDS,
714 drop_forget_ref::DROP_COPY,
715 drop_forget_ref::DROP_REF,
716 drop_forget_ref::FORGET_COPY,
717 drop_forget_ref::FORGET_REF,
718 duration_subsec::DURATION_SUBSEC,
720 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
721 enum_variants::ENUM_VARIANT_NAMES,
722 enum_variants::MODULE_INCEPTION,
725 erasing_op::ERASING_OP,
727 eta_reduction::REDUNDANT_CLOSURE,
728 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
729 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
730 excessive_precision::EXCESSIVE_PRECISION,
731 explicit_write::EXPLICIT_WRITE,
732 format::USELESS_FORMAT,
733 formatting::POSSIBLE_MISSING_COMMA,
734 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
735 formatting::SUSPICIOUS_ELSE_FORMATTING,
736 functions::NOT_UNSAFE_PTR_ARG_DEREF,
737 functions::TOO_MANY_ARGUMENTS,
738 get_last_with_len::GET_LAST_WITH_LEN,
739 identity_conversion::IDENTITY_CONVERSION,
740 identity_op::IDENTITY_OP,
741 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
742 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
743 infinite_iter::INFINITE_ITER,
744 inherent_to_string::INHERENT_TO_STRING,
745 inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
746 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
747 int_plus_one::INT_PLUS_ONE,
748 large_enum_variant::LARGE_ENUM_VARIANT,
749 len_zero::LEN_WITHOUT_IS_EMPTY,
751 let_if_seq::USELESS_LET_IF_SEQ,
752 lifetimes::EXTRA_UNUSED_LIFETIMES,
753 lifetimes::NEEDLESS_LIFETIMES,
754 literal_representation::INCONSISTENT_DIGIT_GROUPING,
755 literal_representation::MISTYPED_LITERAL_SUFFIXES,
756 literal_representation::UNREADABLE_LITERAL,
758 loops::EXPLICIT_COUNTER_LOOP,
760 loops::FOR_LOOP_OVER_OPTION,
761 loops::FOR_LOOP_OVER_RESULT,
762 loops::ITER_NEXT_LOOP,
763 loops::MANUAL_MEMCPY,
764 loops::MUT_RANGE_BOUND,
765 loops::NEEDLESS_COLLECT,
766 loops::NEEDLESS_RANGE_LOOP,
768 loops::REVERSE_RANGE_LOOP,
769 loops::WHILE_IMMUTABLE_CONDITION,
770 loops::WHILE_LET_LOOP,
771 loops::WHILE_LET_ON_ITERATOR,
772 main_recursion::MAIN_RECURSION,
773 map_clone::MAP_CLONE,
774 map_unit_fn::OPTION_MAP_UNIT_FN,
775 map_unit_fn::RESULT_MAP_UNIT_FN,
776 matches::MATCH_AS_REF,
778 matches::MATCH_OVERLAPPING_ARM,
779 matches::MATCH_REF_PATS,
780 matches::MATCH_WILD_ERR_ARM,
781 matches::SINGLE_MATCH,
782 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
783 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
784 methods::CHARS_LAST_CMP,
785 methods::CHARS_NEXT_CMP,
786 methods::CLONE_DOUBLE_REF,
787 methods::CLONE_ON_COPY,
788 methods::EXPECT_FUN_CALL,
789 methods::FILTER_NEXT,
790 methods::FLAT_MAP_IDENTITY,
791 methods::INTO_ITER_ON_ARRAY,
792 methods::INTO_ITER_ON_REF,
793 methods::ITER_CLONED_COLLECT,
795 methods::ITER_SKIP_NEXT,
796 methods::MANUAL_SATURATING_ARITHMETIC,
797 methods::NEW_RET_NO_SELF,
799 methods::OPTION_AND_THEN_SOME,
800 methods::OPTION_MAP_OR_NONE,
801 methods::OR_FUN_CALL,
802 methods::SEARCH_IS_SOME,
803 methods::SHOULD_IMPLEMENT_TRAIT,
804 methods::SINGLE_CHAR_PATTERN,
805 methods::STRING_EXTEND_CHARS,
806 methods::SUSPICIOUS_MAP,
807 methods::TEMPORARY_CSTRING_AS_PTR,
808 methods::UNINIT_ASSUMED_INIT,
809 methods::UNNECESSARY_FILTER_MAP,
810 methods::UNNECESSARY_FOLD,
811 methods::USELESS_ASREF,
812 methods::WRONG_SELF_CONVENTION,
818 misc::REDUNDANT_PATTERN,
819 misc::SHORT_CIRCUIT_STATEMENT,
820 misc::TOPLEVEL_REF_ARG,
822 misc_early::BUILTIN_TYPE_SHADOW,
823 misc_early::DOUBLE_NEG,
824 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
825 misc_early::MIXED_CASE_HEX_LITERALS,
826 misc_early::REDUNDANT_CLOSURE_CALL,
827 misc_early::UNNEEDED_FIELD_PATTERN,
828 misc_early::ZERO_PREFIXED_LITERAL,
829 mut_reference::UNNECESSARY_MUT_PASSED,
830 mutex_atomic::MUTEX_ATOMIC,
831 needless_bool::BOOL_COMPARISON,
832 needless_bool::NEEDLESS_BOOL,
833 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
834 needless_update::NEEDLESS_UPDATE,
835 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
836 neg_multiply::NEG_MULTIPLY,
837 new_without_default::NEW_WITHOUT_DEFAULT,
838 no_effect::NO_EFFECT,
839 no_effect::UNNECESSARY_OPERATION,
840 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
841 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
842 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
843 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
844 ok_if_let::IF_LET_SOME_RESULT,
845 open_options::NONSENSICAL_OPEN_OPTIONS,
846 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
847 panic_unimplemented::PANIC_PARAMS,
848 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
849 precedence::PRECEDENCE,
853 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
854 question_mark::QUESTION_MARK,
855 ranges::ITERATOR_STEP_BY_ZERO,
856 ranges::RANGE_MINUS_ONE,
857 ranges::RANGE_PLUS_ONE,
858 ranges::RANGE_ZIP_WITH_LEN,
859 redundant_field_names::REDUNDANT_FIELD_NAMES,
860 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
861 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
862 reference::DEREF_ADDROF,
863 reference::REF_IN_DEREF,
864 regex::INVALID_REGEX,
866 regex::TRIVIAL_REGEX,
867 returns::LET_AND_RETURN,
868 returns::NEEDLESS_RETURN,
869 returns::UNUSED_UNIT,
870 serde_api::SERDE_API_MISUSE,
871 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
872 strings::STRING_LIT_AS_BYTES,
873 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
874 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
875 swap::ALMOST_SWAPPED,
877 temporary_assignment::TEMPORARY_ASSIGNMENT,
878 transmute::CROSSPOINTER_TRANSMUTE,
879 transmute::TRANSMUTE_BYTES_TO_STR,
880 transmute::TRANSMUTE_INT_TO_BOOL,
881 transmute::TRANSMUTE_INT_TO_CHAR,
882 transmute::TRANSMUTE_INT_TO_FLOAT,
883 transmute::TRANSMUTE_PTR_TO_PTR,
884 transmute::TRANSMUTE_PTR_TO_REF,
885 transmute::USELESS_TRANSMUTE,
886 transmute::WRONG_TRANSMUTE,
887 transmuting_null::TRANSMUTING_NULL,
888 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
890 types::ABSURD_EXTREME_COMPARISONS,
893 types::CAST_LOSSLESS,
894 types::CAST_PTR_ALIGNMENT,
895 types::CAST_REF_TO_MUT,
896 types::CHAR_LIT_AS_U8,
897 types::FN_TO_NUMERIC_CAST,
898 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
899 types::IMPLICIT_HASHER,
900 types::LET_UNIT_VALUE,
901 types::OPTION_OPTION,
902 types::TYPE_COMPLEXITY,
905 types::UNNECESSARY_CAST,
907 unicode::ZERO_WIDTH_SPACE,
908 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
909 unused_io_amount::UNUSED_IO_AMOUNT,
910 unused_label::UNUSED_LABEL,
911 unwrap::PANICKING_UNWRAP,
912 unwrap::UNNECESSARY_UNWRAP,
914 write::PRINTLN_EMPTY_STRING,
915 write::PRINT_LITERAL,
916 write::PRINT_WITH_NEWLINE,
917 write::WRITELN_EMPTY_STRING,
918 write::WRITE_LITERAL,
919 write::WRITE_WITH_NEWLINE,
920 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
923 reg.register_lint_group("clippy::style", Some("clippy_style"), vec![
924 assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
925 assign_ops::ASSIGN_OP_PATTERN,
926 attrs::UNKNOWN_CLIPPY_LINTS,
927 bit_mask::VERBOSE_BIT_MASK,
928 blacklisted_name::BLACKLISTED_NAME,
929 block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
930 block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
931 collapsible_if::COLLAPSIBLE_IF,
932 enum_variants::ENUM_VARIANT_NAMES,
933 enum_variants::MODULE_INCEPTION,
935 eta_reduction::REDUNDANT_CLOSURE,
936 excessive_precision::EXCESSIVE_PRECISION,
937 formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
938 formatting::SUSPICIOUS_ELSE_FORMATTING,
939 infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
940 inherent_to_string::INHERENT_TO_STRING,
941 len_zero::LEN_WITHOUT_IS_EMPTY,
943 let_if_seq::USELESS_LET_IF_SEQ,
944 literal_representation::INCONSISTENT_DIGIT_GROUPING,
945 literal_representation::UNREADABLE_LITERAL,
948 loops::NEEDLESS_RANGE_LOOP,
949 loops::WHILE_LET_ON_ITERATOR,
950 main_recursion::MAIN_RECURSION,
951 map_clone::MAP_CLONE,
953 matches::MATCH_OVERLAPPING_ARM,
954 matches::MATCH_REF_PATS,
955 matches::MATCH_WILD_ERR_ARM,
956 matches::SINGLE_MATCH,
957 mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
958 methods::CHARS_LAST_CMP,
959 methods::INTO_ITER_ON_REF,
960 methods::ITER_CLONED_COLLECT,
961 methods::ITER_SKIP_NEXT,
962 methods::MANUAL_SATURATING_ARITHMETIC,
963 methods::NEW_RET_NO_SELF,
965 methods::OPTION_MAP_OR_NONE,
966 methods::SHOULD_IMPLEMENT_TRAIT,
967 methods::STRING_EXTEND_CHARS,
968 methods::UNNECESSARY_FOLD,
969 methods::WRONG_SELF_CONVENTION,
970 misc::REDUNDANT_PATTERN,
971 misc::TOPLEVEL_REF_ARG,
973 misc_early::BUILTIN_TYPE_SHADOW,
974 misc_early::DOUBLE_NEG,
975 misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
976 misc_early::MIXED_CASE_HEX_LITERALS,
977 misc_early::UNNEEDED_FIELD_PATTERN,
978 mut_reference::UNNECESSARY_MUT_PASSED,
979 neg_multiply::NEG_MULTIPLY,
980 new_without_default::NEW_WITHOUT_DEFAULT,
981 non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
982 non_expressive_names::MANY_SINGLE_CHAR_NAMES,
983 ok_if_let::IF_LET_SOME_RESULT,
984 panic_unimplemented::PANIC_PARAMS,
987 question_mark::QUESTION_MARK,
988 redundant_field_names::REDUNDANT_FIELD_NAMES,
989 redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
990 redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
992 regex::TRIVIAL_REGEX,
993 returns::LET_AND_RETURN,
994 returns::NEEDLESS_RETURN,
995 returns::UNUSED_UNIT,
996 strings::STRING_LIT_AS_BYTES,
998 types::FN_TO_NUMERIC_CAST,
999 types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
1000 types::IMPLICIT_HASHER,
1001 types::LET_UNIT_VALUE,
1002 unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
1003 write::PRINTLN_EMPTY_STRING,
1004 write::PRINT_LITERAL,
1005 write::PRINT_WITH_NEWLINE,
1006 write::WRITELN_EMPTY_STRING,
1007 write::WRITE_LITERAL,
1008 write::WRITE_WITH_NEWLINE,
1011 reg.register_lint_group("clippy::complexity", Some("clippy_complexity"), vec![
1012 assign_ops::MISREFACTORED_ASSIGN_OP,
1013 attrs::DEPRECATED_CFG_ATTR,
1014 booleans::NONMINIMAL_BOOL,
1015 cognitive_complexity::COGNITIVE_COMPLEXITY,
1016 double_comparison::DOUBLE_COMPARISONS,
1017 double_parens::DOUBLE_PARENS,
1018 duration_subsec::DURATION_SUBSEC,
1019 eval_order_dependence::DIVERGING_SUB_EXPRESSION,
1020 eval_order_dependence::EVAL_ORDER_DEPENDENCE,
1021 explicit_write::EXPLICIT_WRITE,
1022 format::USELESS_FORMAT,
1023 functions::TOO_MANY_ARGUMENTS,
1024 get_last_with_len::GET_LAST_WITH_LEN,
1025 identity_conversion::IDENTITY_CONVERSION,
1026 identity_op::IDENTITY_OP,
1027 int_plus_one::INT_PLUS_ONE,
1028 lifetimes::EXTRA_UNUSED_LIFETIMES,
1029 lifetimes::NEEDLESS_LIFETIMES,
1030 loops::EXPLICIT_COUNTER_LOOP,
1031 loops::MUT_RANGE_BOUND,
1032 loops::WHILE_LET_LOOP,
1033 map_unit_fn::OPTION_MAP_UNIT_FN,
1034 map_unit_fn::RESULT_MAP_UNIT_FN,
1035 matches::MATCH_AS_REF,
1036 methods::CHARS_NEXT_CMP,
1037 methods::CLONE_ON_COPY,
1038 methods::FILTER_NEXT,
1039 methods::FLAT_MAP_IDENTITY,
1040 methods::OPTION_AND_THEN_SOME,
1041 methods::SEARCH_IS_SOME,
1042 methods::SUSPICIOUS_MAP,
1043 methods::UNNECESSARY_FILTER_MAP,
1044 methods::USELESS_ASREF,
1045 misc::SHORT_CIRCUIT_STATEMENT,
1046 misc_early::REDUNDANT_CLOSURE_CALL,
1047 misc_early::ZERO_PREFIXED_LITERAL,
1048 needless_bool::BOOL_COMPARISON,
1049 needless_bool::NEEDLESS_BOOL,
1050 needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
1051 needless_update::NEEDLESS_UPDATE,
1052 neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
1053 no_effect::NO_EFFECT,
1054 no_effect::UNNECESSARY_OPERATION,
1055 overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
1056 partialeq_ne_impl::PARTIALEQ_NE_IMPL,
1057 precedence::PRECEDENCE,
1058 ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
1059 ranges::RANGE_MINUS_ONE,
1060 ranges::RANGE_PLUS_ONE,
1061 ranges::RANGE_ZIP_WITH_LEN,
1062 reference::DEREF_ADDROF,
1063 reference::REF_IN_DEREF,
1065 temporary_assignment::TEMPORARY_ASSIGNMENT,
1066 transmute::CROSSPOINTER_TRANSMUTE,
1067 transmute::TRANSMUTE_BYTES_TO_STR,
1068 transmute::TRANSMUTE_INT_TO_BOOL,
1069 transmute::TRANSMUTE_INT_TO_CHAR,
1070 transmute::TRANSMUTE_INT_TO_FLOAT,
1071 transmute::TRANSMUTE_PTR_TO_PTR,
1072 transmute::TRANSMUTE_PTR_TO_REF,
1073 transmute::USELESS_TRANSMUTE,
1074 types::BORROWED_BOX,
1075 types::CAST_LOSSLESS,
1076 types::CHAR_LIT_AS_U8,
1077 types::OPTION_OPTION,
1078 types::TYPE_COMPLEXITY,
1080 types::UNNECESSARY_CAST,
1082 unused_label::UNUSED_LABEL,
1083 unwrap::UNNECESSARY_UNWRAP,
1084 zero_div_zero::ZERO_DIVIDED_BY_ZERO,
1087 reg.register_lint_group("clippy::correctness", Some("clippy_correctness"), vec![
1088 approx_const::APPROX_CONSTANT,
1089 attrs::DEPRECATED_SEMVER,
1090 attrs::USELESS_ATTRIBUTE,
1091 bit_mask::BAD_BIT_MASK,
1092 bit_mask::INEFFECTIVE_BIT_MASK,
1093 booleans::LOGIC_BUG,
1094 copies::IFS_SAME_COND,
1095 copies::IF_SAME_THEN_ELSE,
1096 derive::DERIVE_HASH_XOR_EQ,
1097 drop_bounds::DROP_BOUNDS,
1098 drop_forget_ref::DROP_COPY,
1099 drop_forget_ref::DROP_REF,
1100 drop_forget_ref::FORGET_COPY,
1101 drop_forget_ref::FORGET_REF,
1102 enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
1104 erasing_op::ERASING_OP,
1105 formatting::POSSIBLE_MISSING_COMMA,
1106 functions::NOT_UNSAFE_PTR_ARG_DEREF,
1107 indexing_slicing::OUT_OF_BOUNDS_INDEXING,
1108 infinite_iter::INFINITE_ITER,
1109 inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
1110 inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
1111 literal_representation::MISTYPED_LITERAL_SUFFIXES,
1112 loops::FOR_LOOP_OVER_OPTION,
1113 loops::FOR_LOOP_OVER_RESULT,
1114 loops::ITER_NEXT_LOOP,
1116 loops::REVERSE_RANGE_LOOP,
1117 loops::WHILE_IMMUTABLE_CONDITION,
1118 mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
1119 methods::CLONE_DOUBLE_REF,
1120 methods::INTO_ITER_ON_ARRAY,
1121 methods::TEMPORARY_CSTRING_AS_PTR,
1122 methods::UNINIT_ASSUMED_INIT,
1127 non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
1128 non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
1129 open_options::NONSENSICAL_OPEN_OPTIONS,
1131 ranges::ITERATOR_STEP_BY_ZERO,
1132 regex::INVALID_REGEX,
1133 serde_api::SERDE_API_MISUSE,
1134 suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
1135 suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
1136 swap::ALMOST_SWAPPED,
1137 transmute::WRONG_TRANSMUTE,
1138 transmuting_null::TRANSMUTING_NULL,
1139 types::ABSURD_EXTREME_COMPARISONS,
1140 types::CAST_PTR_ALIGNMENT,
1141 types::CAST_REF_TO_MUT,
1143 unicode::ZERO_WIDTH_SPACE,
1144 unused_io_amount::UNUSED_IO_AMOUNT,
1145 unwrap::PANICKING_UNWRAP,
1148 reg.register_lint_group("clippy::perf", Some("clippy_perf"), vec![
1149 bytecount::NAIVE_BYTECOUNT,
1151 escape::BOXED_LOCAL,
1152 large_enum_variant::LARGE_ENUM_VARIANT,
1153 loops::MANUAL_MEMCPY,
1154 loops::NEEDLESS_COLLECT,
1155 methods::EXPECT_FUN_CALL,
1157 methods::OR_FUN_CALL,
1158 methods::SINGLE_CHAR_PATTERN,
1160 mutex_atomic::MUTEX_ATOMIC,
1161 slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
1162 trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
1167 reg.register_lint_group("clippy::cargo", Some("clippy_cargo"), vec![
1168 cargo_common_metadata::CARGO_COMMON_METADATA,
1169 multiple_crate_versions::MULTIPLE_CRATE_VERSIONS,
1170 wildcard_dependencies::WILDCARD_DEPENDENCIES,
1173 reg.register_lint_group("clippy::nursery", Some("clippy_nursery"), vec![
1174 attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
1175 fallible_impl_from::FALLIBLE_IMPL_FROM,
1176 missing_const_for_fn::MISSING_CONST_FOR_FN,
1177 mutex_atomic::MUTEX_INTEGER,
1178 needless_borrow::NEEDLESS_BORROW,
1179 path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
1180 redundant_clone::REDUNDANT_CLONE,
1185 fn register_removed_non_tool_lints(store: &mut rustc::lint::LintStore) {
1186 store.register_removed(
1188 "`assert!()` will be more flexible with RFC 2011",
1190 store.register_removed(
1191 "extend_from_slice",
1192 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
1194 store.register_removed(
1195 "range_step_by_zero",
1196 "`iterator.step_by(0)` panics nowadays",
1198 store.register_removed(
1199 "unstable_as_slice",
1200 "`Vec::as_slice` has been stabilized in 1.7",
1202 store.register_removed(
1203 "unstable_as_mut_slice",
1204 "`Vec::as_mut_slice` has been stabilized in 1.7",
1206 store.register_removed(
1208 "using `str::to_string` is common even today and specialization will likely happen soon",
1210 store.register_removed(
1212 "using `string::to_string` is common even today and specialization will likely happen soon",
1214 store.register_removed(
1215 "misaligned_transmute",
1216 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
1218 store.register_removed(
1220 "using compound assignment operators (e.g., `+=`) is harmless",
1222 store.register_removed(
1223 "if_let_redundant_pattern_matching",
1224 "this lint has been changed to redundant_pattern_matching",
1226 store.register_removed(
1227 "unsafe_vector_initialization",
1228 "the replacement suggested by this lint had substantially different behavior",
1232 /// Register renamed lints.
1234 /// Used in `./src/driver.rs`.
1235 pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
1236 ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1237 ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
1238 ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
1239 ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
1242 // only exists to let the dogfood integration test works.
1243 // Don't run clippy as an executable directly
1246 panic!("Please use the cargo-clippy executable");