2022-04-07 18:39:59 +01:00
|
|
|
|
#![feature(array_windows)]
|
2021-12-30 15:10:43 +01:00
|
|
|
|
#![feature(binary_heap_into_iter_sorted)]
|
2019-07-21 12:52:14 +02:00
|
|
|
|
#![feature(box_patterns)]
|
2023-02-25 19:08:29 -05:00
|
|
|
|
#![feature(if_let_guard)]
|
2021-12-30 15:10:43 +01:00
|
|
|
|
#![feature(iter_intersperse)]
|
2022-08-20 20:40:08 +02:00
|
|
|
|
#![feature(let_chains)]
|
2022-05-21 13:24:00 +02:00
|
|
|
|
#![feature(lint_reasons)]
|
2022-06-30 10:50:09 +02:00
|
|
|
|
#![feature(never_type)]
|
2016-06-06 17:09:51 +02:00
|
|
|
|
#![feature(rustc_private)]
|
2016-05-24 18:25:25 +02:00
|
|
|
|
#![feature(stmt_expr_attributes)]
|
2019-05-14 01:34:08 +02:00
|
|
|
|
#![recursion_limit = "512"]
|
2019-07-15 07:35:02 +02:00
|
|
|
|
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
|
2024-02-06 09:51:39 +11:00
|
|
|
|
#![allow(
|
|
|
|
|
clippy::missing_docs_in_private_items,
|
|
|
|
|
clippy::must_use_candidate,
|
|
|
|
|
rustc::diagnostic_outside_of_impl,
|
2024-02-22 15:59:29 +01:00
|
|
|
|
rustc::untranslatable_diagnostic
|
2024-02-06 09:51:39 +11:00
|
|
|
|
)]
|
2020-06-23 17:05:22 +02:00
|
|
|
|
#![warn(trivial_casts, trivial_numeric_casts)]
|
|
|
|
|
// warn on lints, that are included in `rust-lang/rust`s bootstrap
|
|
|
|
|
#![warn(rust_2018_idioms, unused_lifetimes)]
|
|
|
|
|
// warn on rustc internal lints
|
2021-04-27 13:00:36 -04:00
|
|
|
|
#![warn(rustc::internal)]
|
2022-02-10 18:40:06 +01:00
|
|
|
|
// Disable this rustc lint for now, as it was also done in rustc
|
2022-02-23 08:06:22 -05:00
|
|
|
|
#![allow(rustc::potential_query_instability)]
|
2018-03-25 21:04:05 -05:00
|
|
|
|
|
2018-09-15 10:21:58 +03:00
|
|
|
|
// FIXME: switch to something more ergonomic here, once available.
|
2019-01-31 01:15:29 +00:00
|
|
|
|
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
|
2023-09-08 22:39:20 +00:00
|
|
|
|
extern crate pulldown_cmark;
|
2023-12-28 19:33:07 +01:00
|
|
|
|
extern crate rustc_abi;
|
2022-03-24 14:50:04 +01:00
|
|
|
|
extern crate rustc_arena;
|
2020-03-01 12:23:33 +09:00
|
|
|
|
extern crate rustc_ast;
|
2020-02-02 06:56:27 +09:00
|
|
|
|
extern crate rustc_ast_pretty;
|
2024-02-08 20:24:42 +01:00
|
|
|
|
extern crate rustc_attr;
|
2018-09-15 10:21:58 +03:00
|
|
|
|
extern crate rustc_data_structures;
|
2020-12-20 17:19:49 +01:00
|
|
|
|
extern crate rustc_driver;
|
2018-09-15 10:21:58 +03:00
|
|
|
|
extern crate rustc_errors;
|
2020-01-07 01:39:50 +09:00
|
|
|
|
extern crate rustc_hir;
|
2022-10-06 09:44:38 +02:00
|
|
|
|
extern crate rustc_hir_analysis;
|
2020-03-27 15:34:29 +01:00
|
|
|
|
extern crate rustc_hir_pretty;
|
2022-11-21 20:34:47 +01:00
|
|
|
|
extern crate rustc_hir_typeck;
|
2019-10-02 08:02:18 +09:00
|
|
|
|
extern crate rustc_index;
|
2020-02-17 11:07:26 +09:00
|
|
|
|
extern crate rustc_infer;
|
2019-11-03 00:41:22 -04:00
|
|
|
|
extern crate rustc_lexer;
|
2020-01-12 15:08:41 +09:00
|
|
|
|
extern crate rustc_lint;
|
2020-03-30 11:02:14 +02:00
|
|
|
|
extern crate rustc_middle;
|
2019-11-11 06:22:50 +02:00
|
|
|
|
extern crate rustc_parse;
|
2023-09-08 22:39:20 +00:00
|
|
|
|
extern crate rustc_resolve;
|
2019-12-04 00:16:03 +01:00
|
|
|
|
extern crate rustc_session;
|
2019-12-31 09:17:56 +09:00
|
|
|
|
extern crate rustc_span;
|
2018-09-15 10:21:58 +03:00
|
|
|
|
extern crate rustc_target;
|
2020-03-15 05:26:32 +09:00
|
|
|
|
extern crate rustc_trait_selection;
|
2022-11-23 11:55:16 +11:00
|
|
|
|
extern crate thin_vec;
|
2016-05-24 18:25:25 +02:00
|
|
|
|
|
2021-06-03 08:41:37 +02:00
|
|
|
|
#[macro_use]
|
|
|
|
|
extern crate clippy_utils;
|
2022-11-21 20:34:47 +01:00
|
|
|
|
#[macro_use]
|
|
|
|
|
extern crate declare_clippy_lint;
|
|
|
|
|
|
2023-12-16 14:12:50 +01:00
|
|
|
|
use std::collections::BTreeMap;
|
|
|
|
|
|
2019-10-10 21:46:22 -04:00
|
|
|
|
use rustc_data_structures::fx::FxHashSet;
|
2022-11-21 20:34:47 +01:00
|
|
|
|
use rustc_lint::{Lint, LintId};
|
2019-12-24 03:06:52 +07:00
|
|
|
|
|
2022-01-13 13:18:19 +01:00
|
|
|
|
#[cfg(feature = "internal")]
|
2022-06-30 10:50:09 +02:00
|
|
|
|
pub mod deprecated_lints;
|
2022-01-13 13:18:19 +01:00
|
|
|
|
#[cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
|
2021-06-03 08:41:37 +02:00
|
|
|
|
mod utils;
|
2016-05-24 18:25:25 +02:00
|
|
|
|
|
2022-11-21 20:34:47 +01:00
|
|
|
|
mod declared_lints;
|
2022-05-05 15:12:52 +01:00
|
|
|
|
mod renamed_lints;
|
|
|
|
|
|
2016-05-24 18:25:25 +02:00
|
|
|
|
// begin lints modules, do not remove this comment, it’s used in `update_lints`
|
2023-07-31 23:53:53 +02:00
|
|
|
|
mod absolute_paths;
|
2023-03-24 14:04:35 +01:00
|
|
|
|
mod allow_attributes;
|
2022-12-17 14:12:54 +01:00
|
|
|
|
mod almost_complete_range;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod approx_const;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod arc_with_non_send_sync;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod as_conversions;
|
2020-10-09 12:45:29 +02:00
|
|
|
|
mod asm_syntax;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod assertions_on_constants;
|
2022-07-28 19:08:22 +02:00
|
|
|
|
mod assertions_on_result_states;
|
2024-01-01 18:51:45 +01:00
|
|
|
|
mod assigning_clones;
|
2020-09-10 17:47:07 +02:00
|
|
|
|
mod async_yields_async;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod attrs;
|
2020-10-28 23:36:07 +01:00
|
|
|
|
mod await_holding_invalid;
|
2023-12-16 14:12:50 +01:00
|
|
|
|
mod blocks_in_conditions;
|
2021-04-22 11:31:13 +02:00
|
|
|
|
mod bool_assert_comparison;
|
2022-09-09 13:36:26 +02:00
|
|
|
|
mod bool_to_int_with_if;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod booleans;
|
2022-06-04 13:34:07 +02:00
|
|
|
|
mod borrow_deref_ref;
|
2022-10-06 09:44:38 +02:00
|
|
|
|
mod box_default;
|
2022-02-26 14:26:21 +01:00
|
|
|
|
mod cargo;
|
2021-03-12 15:30:50 +01:00
|
|
|
|
mod casts;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod checked_conversions;
|
|
|
|
|
mod cognitive_complexity;
|
|
|
|
|
mod collapsible_if;
|
2023-03-10 10:53:50 +01:00
|
|
|
|
mod collection_is_never_read;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod comparison_chain;
|
|
|
|
|
mod copies;
|
|
|
|
|
mod copy_iterator;
|
2022-04-07 18:39:59 +01:00
|
|
|
|
mod crate_in_macro_def;
|
2020-09-10 17:47:07 +02:00
|
|
|
|
mod create_dir;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod dbg_macro;
|
2020-11-05 14:29:48 +01:00
|
|
|
|
mod default;
|
2023-05-05 17:45:49 +02:00
|
|
|
|
mod default_constructed_unit_structs;
|
2022-06-30 10:50:09 +02:00
|
|
|
|
mod default_instead_of_iter_empty;
|
2021-02-25 11:25:22 +01:00
|
|
|
|
mod default_numeric_fallback;
|
2022-02-10 18:40:06 +01:00
|
|
|
|
mod default_union_representation;
|
2020-03-21 19:34:56 +01:00
|
|
|
|
mod dereference;
|
2021-09-08 16:31:47 +02:00
|
|
|
|
mod derivable_impls;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod derive;
|
2022-10-06 09:44:38 +02:00
|
|
|
|
mod disallowed_macros;
|
2021-12-06 12:33:31 +01:00
|
|
|
|
mod disallowed_methods;
|
2022-08-11 19:42:16 +02:00
|
|
|
|
mod disallowed_names;
|
2021-07-01 18:17:38 +02:00
|
|
|
|
mod disallowed_script_idents;
|
2021-12-06 12:33:31 +01:00
|
|
|
|
mod disallowed_types;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod doc;
|
|
|
|
|
mod double_parens;
|
|
|
|
|
mod drop_forget_ref;
|
2022-05-21 13:24:00 +02:00
|
|
|
|
mod duplicate_mod;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod else_if_without_else;
|
2022-05-05 15:12:52 +01:00
|
|
|
|
mod empty_drop;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod empty_enum;
|
2024-01-11 17:27:03 +01:00
|
|
|
|
mod empty_with_brackets;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod endian_bytes;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod entry;
|
|
|
|
|
mod enum_clike;
|
2021-10-07 11:21:30 +02:00
|
|
|
|
mod equatable_if_let;
|
2023-07-31 23:53:53 +02:00
|
|
|
|
mod error_impl_error;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod escape;
|
|
|
|
|
mod eta_reduction;
|
|
|
|
|
mod excessive_bools;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod excessive_nesting;
|
2021-01-30 18:06:34 +01:00
|
|
|
|
mod exhaustive_items;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod exit;
|
|
|
|
|
mod explicit_write;
|
2023-02-10 14:01:19 +01:00
|
|
|
|
mod extra_unused_type_parameters;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod fallible_impl_from;
|
|
|
|
|
mod float_literal;
|
|
|
|
|
mod floating_point_arithmetic;
|
|
|
|
|
mod format;
|
2021-10-21 13:11:36 +02:00
|
|
|
|
mod format_args;
|
2022-02-26 14:26:21 +01:00
|
|
|
|
mod format_impl;
|
2022-05-05 15:12:52 +01:00
|
|
|
|
mod format_push_string;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod formatting;
|
2023-07-31 23:53:53 +02:00
|
|
|
|
mod four_forward_slashes;
|
2021-01-02 16:29:43 +01:00
|
|
|
|
mod from_over_into;
|
2022-11-21 20:34:47 +01:00
|
|
|
|
mod from_raw_with_void_ptr;
|
2021-02-25 11:25:22 +01:00
|
|
|
|
mod from_str_radix_10;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod functions;
|
2020-04-07 15:39:07 +02:00
|
|
|
|
mod future_not_send;
|
2020-03-05 08:36:19 -05:00
|
|
|
|
mod if_let_mutex;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod if_not_else;
|
2021-03-25 19:29:11 +01:00
|
|
|
|
mod if_then_some_else_none;
|
2023-08-11 14:05:13 +02:00
|
|
|
|
mod ignored_unit_patterns;
|
2023-12-01 18:21:58 +01:00
|
|
|
|
mod impl_hash_with_borrow_str_and_bytes;
|
2021-04-08 17:50:13 +02:00
|
|
|
|
mod implicit_hasher;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod implicit_return;
|
2022-10-06 09:44:38 +02:00
|
|
|
|
mod implicit_saturating_add;
|
2020-04-06 23:37:57 +05:30
|
|
|
|
mod implicit_saturating_sub;
|
2023-08-24 21:32:12 +02:00
|
|
|
|
mod implied_bounds_in_impls;
|
2024-02-08 20:24:42 +01:00
|
|
|
|
mod incompatible_msrv;
|
2021-02-25 11:25:22 +01:00
|
|
|
|
mod inconsistent_struct_constructor;
|
2021-12-06 12:33:31 +01:00
|
|
|
|
mod index_refutable_slice;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod indexing_slicing;
|
2023-12-16 14:12:50 +01:00
|
|
|
|
mod ineffective_open_options;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod infinite_iter;
|
|
|
|
|
mod inherent_impl;
|
|
|
|
|
mod inherent_to_string;
|
2021-12-30 15:10:43 +01:00
|
|
|
|
mod init_numbered_fields;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod inline_fn_without_body;
|
2022-11-21 20:34:47 +01:00
|
|
|
|
mod instant_subtraction;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod int_plus_one;
|
2021-04-08 17:50:13 +02:00
|
|
|
|
mod invalid_upcast_comparisons;
|
2023-10-21 14:16:11 +02:00
|
|
|
|
mod item_name_repetitions;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod items_after_statements;
|
2023-04-23 13:03:09 +02:00
|
|
|
|
mod items_after_test_module;
|
2021-09-28 18:03:12 +01:00
|
|
|
|
mod iter_not_returning_iterator;
|
2023-11-16 19:13:24 +01:00
|
|
|
|
mod iter_over_hash_type;
|
2023-10-06 17:35:45 +02:00
|
|
|
|
mod iter_without_into_iter;
|
2020-03-23 22:07:46 +01:00
|
|
|
|
mod large_const_arrays;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod large_enum_variant;
|
2023-04-11 15:31:08 +02:00
|
|
|
|
mod large_futures;
|
2022-05-05 15:12:52 +01:00
|
|
|
|
mod large_include_file;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod large_stack_arrays;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod large_stack_frames;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod len_zero;
|
|
|
|
|
mod let_if_seq;
|
|
|
|
|
mod let_underscore;
|
2023-03-10 10:53:50 +01:00
|
|
|
|
mod let_with_type_underscore;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod lifetimes;
|
2023-04-11 15:31:08 +02:00
|
|
|
|
mod lines_filter_map_ok;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod literal_representation;
|
|
|
|
|
mod loops;
|
|
|
|
|
mod macro_use;
|
|
|
|
|
mod main_recursion;
|
2021-11-04 12:52:36 +00:00
|
|
|
|
mod manual_assert;
|
2020-05-11 20:23:47 +02:00
|
|
|
|
mod manual_async_fn;
|
2022-01-13 13:18:19 +01:00
|
|
|
|
mod manual_bits;
|
2022-10-06 09:44:38 +02:00
|
|
|
|
mod manual_clamp;
|
2023-07-17 10:19:29 +02:00
|
|
|
|
mod manual_float_methods;
|
2023-10-06 17:35:45 +02:00
|
|
|
|
mod manual_hash_one;
|
2022-11-21 20:34:47 +01:00
|
|
|
|
mod manual_is_ascii_check;
|
|
|
|
|
mod manual_let_else;
|
2023-03-24 14:04:35 +01:00
|
|
|
|
mod manual_main_separator_str;
|
2020-05-11 20:23:47 +02:00
|
|
|
|
mod manual_non_exhaustive;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod manual_range_patterns;
|
2022-06-30 10:50:09 +02:00
|
|
|
|
mod manual_rem_euclid;
|
|
|
|
|
mod manual_retain;
|
2023-04-11 15:31:08 +02:00
|
|
|
|
mod manual_slice_size_calculation;
|
2022-08-31 09:24:45 -04:00
|
|
|
|
mod manual_string_new;
|
2020-09-24 14:49:22 +02:00
|
|
|
|
mod manual_strip;
|
2024-03-10 01:12:15 +01:00
|
|
|
|
mod manual_unwrap_or_default;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod map_unit_fn;
|
2021-09-28 18:03:12 +01:00
|
|
|
|
mod match_result_ok;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod matches;
|
|
|
|
|
mod mem_replace;
|
|
|
|
|
mod methods;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod min_ident_chars;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod minmax;
|
|
|
|
|
mod misc;
|
|
|
|
|
mod misc_early;
|
2022-06-04 13:34:07 +02:00
|
|
|
|
mod mismatching_type_param_order;
|
2023-03-10 10:53:50 +01:00
|
|
|
|
mod missing_assert_message;
|
2023-09-12 18:13:53 +02:00
|
|
|
|
mod missing_asserts_for_indexing;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod missing_const_for_fn;
|
|
|
|
|
mod missing_doc;
|
2021-07-01 18:17:38 +02:00
|
|
|
|
mod missing_enforced_import_rename;
|
2023-06-02 11:41:57 +02:00
|
|
|
|
mod missing_fields_in_debug;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod missing_inline;
|
2022-10-23 15:18:45 +02:00
|
|
|
|
mod missing_trait_methods;
|
2022-05-21 13:24:00 +02:00
|
|
|
|
mod mixed_read_write_in_expression;
|
2021-09-08 16:31:47 +02:00
|
|
|
|
mod module_style;
|
2022-08-31 09:24:45 -04:00
|
|
|
|
mod multi_assignments;
|
2024-02-10 15:04:50 +01:00
|
|
|
|
mod multiple_bound_locations;
|
2023-01-27 21:09:08 +01:00
|
|
|
|
mod multiple_unsafe_ops_per_block;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod mut_key;
|
|
|
|
|
mod mut_mut;
|
|
|
|
|
mod mut_reference;
|
|
|
|
|
mod mutable_debug_assertion;
|
|
|
|
|
mod mutex_atomic;
|
2020-08-11 15:43:21 +02:00
|
|
|
|
mod needless_arbitrary_self_type;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod needless_bool;
|
|
|
|
|
mod needless_borrowed_ref;
|
2023-09-25 11:28:58 +02:00
|
|
|
|
mod needless_borrows_for_generic_args;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod needless_continue;
|
2023-06-02 11:41:57 +02:00
|
|
|
|
mod needless_else;
|
2021-04-08 17:50:13 +02:00
|
|
|
|
mod needless_for_each;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod needless_if;
|
2021-12-06 12:33:31 +01:00
|
|
|
|
mod needless_late_init;
|
2022-06-16 17:39:06 +02:00
|
|
|
|
mod needless_parens_on_range_literals;
|
2023-07-17 10:19:29 +02:00
|
|
|
|
mod needless_pass_by_ref_mut;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod needless_pass_by_value;
|
2021-01-15 10:56:44 +01:00
|
|
|
|
mod needless_question_mark;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod needless_update;
|
|
|
|
|
mod neg_cmp_op_on_partial_ord;
|
|
|
|
|
mod neg_multiply;
|
|
|
|
|
mod new_without_default;
|
|
|
|
|
mod no_effect;
|
2023-02-25 19:08:29 -05:00
|
|
|
|
mod no_mangle_with_rust_abi;
|
2023-09-12 18:13:53 +02:00
|
|
|
|
mod non_canonical_impls;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod non_copy_const;
|
|
|
|
|
mod non_expressive_names;
|
2021-04-08 17:50:13 +02:00
|
|
|
|
mod non_octal_unix_permissions;
|
2021-10-07 11:21:30 +02:00
|
|
|
|
mod non_send_fields_in_send_ty;
|
2021-07-01 18:17:38 +02:00
|
|
|
|
mod nonstandard_macro_braces;
|
2021-12-06 12:33:31 +01:00
|
|
|
|
mod octal_escapes;
|
2022-03-14 12:02:53 +01:00
|
|
|
|
mod only_used_in_recursion;
|
2022-06-30 10:50:09 +02:00
|
|
|
|
mod operators;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod option_env_unwrap;
|
2020-07-14 14:59:59 +02:00
|
|
|
|
mod option_if_let_else;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod overflow_check_conditional;
|
2020-09-24 14:49:22 +02:00
|
|
|
|
mod panic_in_result_fn;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod panic_unimplemented;
|
2022-10-23 15:18:45 +02:00
|
|
|
|
mod partial_pub_fields;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod partialeq_ne_impl;
|
2022-08-11 19:42:16 +02:00
|
|
|
|
mod partialeq_to_none;
|
2020-10-28 23:36:07 +01:00
|
|
|
|
mod pass_by_ref_or_value;
|
2020-07-14 14:59:59 +02:00
|
|
|
|
mod pattern_type_mismatch;
|
2022-12-29 14:28:34 +01:00
|
|
|
|
mod permissions_set_readonly_false;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod precedence;
|
|
|
|
|
mod ptr;
|
|
|
|
|
mod ptr_offset_with_cast;
|
2024-01-11 17:27:03 +01:00
|
|
|
|
mod pub_underscore_fields;
|
2022-05-05 15:12:52 +01:00
|
|
|
|
mod pub_use;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod question_mark;
|
2023-02-25 19:08:29 -05:00
|
|
|
|
mod question_mark_used;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod ranges;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod raw_strings;
|
2022-05-21 13:24:00 +02:00
|
|
|
|
mod rc_clone_in_vec_init;
|
2022-06-16 17:39:06 +02:00
|
|
|
|
mod read_zero_byte_vec;
|
2023-03-10 10:53:50 +01:00
|
|
|
|
mod redundant_async_block;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod redundant_clone;
|
2020-07-26 21:07:07 +02:00
|
|
|
|
mod redundant_closure_call;
|
2020-12-20 17:19:49 +01:00
|
|
|
|
mod redundant_else;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod redundant_field_names;
|
2023-07-31 23:53:53 +02:00
|
|
|
|
mod redundant_locals;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod redundant_pub_crate;
|
2021-01-30 18:06:34 +01:00
|
|
|
|
mod redundant_slicing;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod redundant_static_lifetimes;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod redundant_type_annotations;
|
2020-11-05 14:29:48 +01:00
|
|
|
|
mod ref_option_ref;
|
2023-05-20 15:39:26 +02:00
|
|
|
|
mod ref_patterns;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod reference;
|
|
|
|
|
mod regex;
|
2023-12-16 14:12:50 +01:00
|
|
|
|
mod repeat_vec_with_capacity;
|
2023-08-24 21:32:12 +02:00
|
|
|
|
mod reserve_after_initialization;
|
2021-12-17 13:40:22 +01:00
|
|
|
|
mod return_self_not_must_use;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod returns;
|
2021-09-28 18:03:12 +01:00
|
|
|
|
mod same_name_method;
|
2021-07-29 12:16:06 +02:00
|
|
|
|
mod self_named_constructors;
|
2022-12-17 14:12:54 +01:00
|
|
|
|
mod semicolon_block;
|
2021-02-11 15:04:38 +01:00
|
|
|
|
mod semicolon_if_nothing_returned;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod serde_api;
|
|
|
|
|
mod shadow;
|
2023-02-25 19:08:29 -05:00
|
|
|
|
mod significant_drop_tightening;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod single_call_fn;
|
2022-01-13 13:18:19 +01:00
|
|
|
|
mod single_char_lifetime_names;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod single_component_path_imports;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod single_range_in_vec_init;
|
2020-12-06 15:01:03 +01:00
|
|
|
|
mod size_of_in_element_count;
|
2022-12-29 14:28:34 +01:00
|
|
|
|
mod size_of_ref;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod slow_vector_initialization;
|
2022-07-18 09:39:37 +02:00
|
|
|
|
mod std_instead_of_core;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod strings;
|
2021-07-15 10:44:10 +02:00
|
|
|
|
mod strlen_on_c_strings;
|
2020-12-06 15:01:03 +01:00
|
|
|
|
mod suspicious_operation_groupings;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod suspicious_trait_impl;
|
2022-11-21 20:34:47 +01:00
|
|
|
|
mod suspicious_xor_used_as_pow;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod swap;
|
2022-06-04 13:34:07 +02:00
|
|
|
|
mod swap_ptr_to_ref;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod tabs_in_doc_comments;
|
|
|
|
|
mod temporary_assignment;
|
2023-04-11 15:31:08 +02:00
|
|
|
|
mod tests_outside_test_module;
|
2024-01-11 17:27:03 +01:00
|
|
|
|
mod thread_local_initializer_can_be_made_const;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod to_digit_is_some;
|
2024-02-08 20:24:42 +01:00
|
|
|
|
mod to_string_trait_impl;
|
2021-10-21 13:11:36 +02:00
|
|
|
|
mod trailing_empty_array;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod trait_bounds;
|
|
|
|
|
mod transmute;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod tuple_array_conversions;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod types;
|
2023-12-28 19:33:07 +01:00
|
|
|
|
mod unconditional_recursion;
|
2021-10-21 13:11:36 +02:00
|
|
|
|
mod undocumented_unsafe_blocks;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod unicode;
|
2023-12-16 14:12:50 +01:00
|
|
|
|
mod uninhabited_references;
|
2021-10-21 13:11:36 +02:00
|
|
|
|
mod uninit_vec;
|
2020-07-26 21:07:07 +02:00
|
|
|
|
mod unit_return_expecting_ord;
|
2021-03-25 19:29:11 +01:00
|
|
|
|
mod unit_types;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod unnamed_address;
|
2023-04-11 15:31:08 +02:00
|
|
|
|
mod unnecessary_box_returns;
|
2023-09-25 11:28:58 +02:00
|
|
|
|
mod unnecessary_map_on_constructor;
|
2022-05-05 15:12:52 +01:00
|
|
|
|
mod unnecessary_owned_empty_strings;
|
2021-04-22 11:31:13 +02:00
|
|
|
|
mod unnecessary_self_imports;
|
2023-03-24 14:04:35 +01:00
|
|
|
|
mod unnecessary_struct_initialization;
|
2020-11-23 13:51:04 +01:00
|
|
|
|
mod unnecessary_wraps;
|
2020-06-09 14:36:01 +00:00
|
|
|
|
mod unnested_or_patterns;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod unsafe_removed_from_name;
|
2021-05-20 12:30:31 +02:00
|
|
|
|
mod unused_async;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod unused_io_amount;
|
2022-08-31 09:24:45 -04:00
|
|
|
|
mod unused_peekable;
|
2022-06-04 13:34:07 +02:00
|
|
|
|
mod unused_rounding;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod unused_self;
|
2020-08-28 16:10:16 +02:00
|
|
|
|
mod unused_unit;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod unwrap;
|
2020-08-28 16:10:16 +02:00
|
|
|
|
mod unwrap_in_result;
|
2021-01-30 18:06:34 +01:00
|
|
|
|
mod upper_case_acronyms;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod use_self;
|
2020-05-17 17:36:26 +02:00
|
|
|
|
mod useless_conversion;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod vec;
|
2021-01-15 10:56:44 +01:00
|
|
|
|
mod vec_init_then_push;
|
2023-07-02 14:35:19 +02:00
|
|
|
|
mod visibility;
|
2020-04-02 22:08:25 +02:00
|
|
|
|
mod wildcard_imports;
|
|
|
|
|
mod write;
|
|
|
|
|
mod zero_div_zero;
|
2023-12-10 22:46:25 +00:00
|
|
|
|
mod zero_repeat_side_effects;
|
2020-12-20 17:19:49 +01:00
|
|
|
|
mod zero_sized_map_values;
|
2016-05-24 18:25:25 +02:00
|
|
|
|
// end lints modules, do not remove this comment, it’s used in `update_lints`
|
|
|
|
|
|
2023-11-02 17:35:56 +01:00
|
|
|
|
use clippy_config::{get_configuration_metadata, Conf};
|
2018-08-15 08:11:07 +02:00
|
|
|
|
|
2019-02-11 07:59:57 +01:00
|
|
|
|
/// Register all pre expansion lints
|
|
|
|
|
///
|
|
|
|
|
/// Pre-expansion lints run before any macro expansion has happened.
|
|
|
|
|
///
|
2019-04-04 11:15:30 +02:00
|
|
|
|
/// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
|
2019-02-11 22:32:54 +01:00
|
|
|
|
/// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
|
2019-02-11 07:59:57 +01:00
|
|
|
|
///
|
|
|
|
|
/// Used in `./src/driver.rs`.
|
2023-10-21 14:16:11 +02:00
|
|
|
|
pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
|
2021-04-22 11:31:13 +02:00
|
|
|
|
// NOTE: Do not add any more pre-expansion passes. These should be removed eventually.
|
2023-10-21 14:16:11 +02:00
|
|
|
|
let msrv = || conf.msrv.clone();
|
2021-12-06 12:33:31 +01:00
|
|
|
|
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_pre_expansion_pass(move || Box::new(attrs::EarlyAttributes { msrv: msrv() }));
|
2022-06-30 10:50:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-21 20:34:47 +01:00
|
|
|
|
#[derive(Default)]
|
|
|
|
|
struct RegistrationGroups {
|
|
|
|
|
all: Vec<LintId>,
|
|
|
|
|
cargo: Vec<LintId>,
|
|
|
|
|
complexity: Vec<LintId>,
|
|
|
|
|
correctness: Vec<LintId>,
|
|
|
|
|
nursery: Vec<LintId>,
|
|
|
|
|
pedantic: Vec<LintId>,
|
|
|
|
|
perf: Vec<LintId>,
|
|
|
|
|
restriction: Vec<LintId>,
|
|
|
|
|
style: Vec<LintId>,
|
|
|
|
|
suspicious: Vec<LintId>,
|
|
|
|
|
#[cfg(feature = "internal")]
|
|
|
|
|
internal: Vec<LintId>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl RegistrationGroups {
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
|
fn register(self, store: &mut rustc_lint::LintStore) {
|
|
|
|
|
store.register_group(true, "clippy::all", Some("clippy_all"), self.all);
|
|
|
|
|
store.register_group(true, "clippy::cargo", Some("clippy_cargo"), self.cargo);
|
|
|
|
|
store.register_group(true, "clippy::complexity", Some("clippy_complexity"), self.complexity);
|
|
|
|
|
store.register_group(true, "clippy::correctness", Some("clippy_correctness"), self.correctness);
|
|
|
|
|
store.register_group(true, "clippy::nursery", Some("clippy_nursery"), self.nursery);
|
|
|
|
|
store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), self.pedantic);
|
|
|
|
|
store.register_group(true, "clippy::perf", Some("clippy_perf"), self.perf);
|
|
|
|
|
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), self.restriction);
|
|
|
|
|
store.register_group(true, "clippy::style", Some("clippy_style"), self.style);
|
|
|
|
|
store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), self.suspicious);
|
|
|
|
|
#[cfg(feature = "internal")]
|
|
|
|
|
store.register_group(true, "clippy::internal", Some("clippy_internal"), self.internal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
|
pub(crate) enum LintCategory {
|
|
|
|
|
Cargo,
|
|
|
|
|
Complexity,
|
|
|
|
|
Correctness,
|
|
|
|
|
Nursery,
|
|
|
|
|
Pedantic,
|
|
|
|
|
Perf,
|
|
|
|
|
Restriction,
|
|
|
|
|
Style,
|
|
|
|
|
Suspicious,
|
|
|
|
|
#[cfg(feature = "internal")]
|
|
|
|
|
Internal,
|
|
|
|
|
}
|
|
|
|
|
#[allow(clippy::enum_glob_use)]
|
|
|
|
|
use LintCategory::*;
|
|
|
|
|
|
|
|
|
|
impl LintCategory {
|
|
|
|
|
fn is_all(self) -> bool {
|
|
|
|
|
matches!(self, Correctness | Suspicious | Style | Complexity | Perf)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn group(self, groups: &mut RegistrationGroups) -> &mut Vec<LintId> {
|
|
|
|
|
match self {
|
|
|
|
|
Cargo => &mut groups.cargo,
|
|
|
|
|
Complexity => &mut groups.complexity,
|
|
|
|
|
Correctness => &mut groups.correctness,
|
|
|
|
|
Nursery => &mut groups.nursery,
|
|
|
|
|
Pedantic => &mut groups.pedantic,
|
|
|
|
|
Perf => &mut groups.perf,
|
|
|
|
|
Restriction => &mut groups.restriction,
|
|
|
|
|
Style => &mut groups.style,
|
|
|
|
|
Suspicious => &mut groups.suspicious,
|
|
|
|
|
#[cfg(feature = "internal")]
|
|
|
|
|
Internal => &mut groups.internal,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) struct LintInfo {
|
|
|
|
|
/// Double reference to maintain pointer equality
|
|
|
|
|
lint: &'static &'static Lint,
|
|
|
|
|
category: LintCategory,
|
|
|
|
|
explanation: &'static str,
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-02 14:35:19 +02:00
|
|
|
|
pub fn explain(name: &str) -> i32 {
|
2022-11-21 20:34:47 +01:00
|
|
|
|
let target = format!("clippy::{}", name.to_ascii_uppercase());
|
2023-07-02 14:35:19 +02:00
|
|
|
|
if let Some(info) = declared_lints::LINTS.iter().find(|info| info.lint.name == target) {
|
|
|
|
|
println!("{}", info.explanation);
|
|
|
|
|
// Check if the lint has configuration
|
2023-11-02 17:35:56 +01:00
|
|
|
|
let mut mdconf = get_configuration_metadata();
|
|
|
|
|
let name = name.to_ascii_lowercase();
|
|
|
|
|
mdconf.retain(|cconf| cconf.lints.contains(&name));
|
|
|
|
|
if !mdconf.is_empty() {
|
2023-07-02 14:35:19 +02:00
|
|
|
|
println!("### Configuration for {}:\n", info.lint.name_lower());
|
2023-11-02 17:35:56 +01:00
|
|
|
|
for conf in mdconf {
|
|
|
|
|
println!("{conf}");
|
2023-05-20 15:39:26 +02:00
|
|
|
|
}
|
2023-07-02 14:35:19 +02:00
|
|
|
|
}
|
|
|
|
|
0
|
|
|
|
|
} else {
|
|
|
|
|
println!("unknown lint: {name}");
|
|
|
|
|
1
|
2022-11-21 20:34:47 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn register_categories(store: &mut rustc_lint::LintStore) {
|
|
|
|
|
let mut groups = RegistrationGroups::default();
|
|
|
|
|
|
|
|
|
|
for LintInfo { lint, category, .. } in declared_lints::LINTS {
|
|
|
|
|
if category.is_all() {
|
|
|
|
|
groups.all.push(LintId::of(lint));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
category.group(&mut groups).push(LintId::of(lint));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lints: Vec<&'static Lint> = declared_lints::LINTS.iter().map(|info| *info.lint).collect();
|
|
|
|
|
|
|
|
|
|
store.register_lints(&lints);
|
|
|
|
|
groups.register(store);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-16 19:13:24 +01:00
|
|
|
|
/// Register all lints and lint groups with the rustc lint store
|
2019-02-11 07:59:57 +01:00
|
|
|
|
///
|
|
|
|
|
/// Used in `./src/driver.rs`.
|
2022-05-21 13:24:00 +02:00
|
|
|
|
#[expect(clippy::too_many_lines)]
|
2023-11-16 19:13:24 +01:00
|
|
|
|
pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
|
|
|
|
|
let Conf {
|
|
|
|
|
ref absolute_paths_allowed_crates,
|
|
|
|
|
absolute_paths_max_segments,
|
|
|
|
|
accept_comment_above_attributes,
|
|
|
|
|
accept_comment_above_statement,
|
|
|
|
|
allow_dbg_in_tests,
|
|
|
|
|
allow_expect_in_tests,
|
|
|
|
|
allow_mixed_uninlined_format_args,
|
|
|
|
|
allow_one_hash_in_raw_strings,
|
|
|
|
|
allow_print_in_tests,
|
|
|
|
|
allow_private_module_inception,
|
|
|
|
|
allow_unwrap_in_tests,
|
|
|
|
|
ref allowed_dotfiles,
|
|
|
|
|
ref allowed_idents_below_min_chars,
|
|
|
|
|
ref allowed_scripts,
|
2024-02-08 20:24:42 +01:00
|
|
|
|
ref allowed_wildcard_imports,
|
2023-11-16 19:13:24 +01:00
|
|
|
|
ref arithmetic_side_effects_allowed_binary,
|
|
|
|
|
ref arithmetic_side_effects_allowed_unary,
|
|
|
|
|
ref arithmetic_side_effects_allowed,
|
|
|
|
|
array_size_threshold,
|
|
|
|
|
avoid_breaking_exported_api,
|
|
|
|
|
ref await_holding_invalid_types,
|
|
|
|
|
cargo_ignore_publish,
|
|
|
|
|
cognitive_complexity_threshold,
|
|
|
|
|
ref disallowed_macros,
|
|
|
|
|
ref disallowed_methods,
|
|
|
|
|
ref disallowed_names,
|
|
|
|
|
ref disallowed_types,
|
|
|
|
|
ref doc_valid_idents,
|
|
|
|
|
enable_raw_pointer_heuristic_for_send,
|
|
|
|
|
enforce_iter_loop_reborrow,
|
|
|
|
|
ref enforced_import_renames,
|
|
|
|
|
enum_variant_name_threshold,
|
|
|
|
|
enum_variant_size_threshold,
|
|
|
|
|
excessive_nesting_threshold,
|
|
|
|
|
future_size_threshold,
|
|
|
|
|
ref ignore_interior_mutability,
|
|
|
|
|
large_error_threshold,
|
|
|
|
|
literal_representation_threshold,
|
|
|
|
|
matches_for_let_else,
|
|
|
|
|
max_fn_params_bools,
|
|
|
|
|
max_include_file_size,
|
|
|
|
|
max_struct_bools,
|
|
|
|
|
max_suggested_slice_pattern_length,
|
|
|
|
|
max_trait_bounds,
|
|
|
|
|
min_ident_chars_threshold,
|
|
|
|
|
missing_docs_in_crate_items,
|
|
|
|
|
ref msrv,
|
|
|
|
|
pass_by_value_size_limit,
|
|
|
|
|
semicolon_inside_block_ignore_singleline,
|
|
|
|
|
semicolon_outside_block_ignore_multiline,
|
|
|
|
|
single_char_binding_names_threshold,
|
|
|
|
|
stack_size_threshold,
|
|
|
|
|
ref standard_macro_braces,
|
|
|
|
|
struct_field_name_threshold,
|
|
|
|
|
suppress_restriction_lint_in_const,
|
|
|
|
|
too_large_for_stack,
|
|
|
|
|
too_many_arguments_threshold,
|
|
|
|
|
too_many_lines_threshold,
|
|
|
|
|
trivial_copy_size_limit,
|
|
|
|
|
type_complexity_threshold,
|
|
|
|
|
unnecessary_box_size,
|
|
|
|
|
unreadable_literal_lint_fractions,
|
|
|
|
|
upper_case_acronyms_aggressive,
|
|
|
|
|
vec_box_size_threshold,
|
|
|
|
|
verbose_bit_mask_threshold,
|
|
|
|
|
warn_on_all_wildcard_imports,
|
2023-12-01 18:21:58 +01:00
|
|
|
|
check_private_items,
|
2024-01-11 17:27:03 +01:00
|
|
|
|
pub_underscore_fields_behavior,
|
2024-01-25 19:17:36 +01:00
|
|
|
|
ref allowed_duplicate_crates,
|
2024-02-08 20:24:42 +01:00
|
|
|
|
allow_comparison_to_zero,
|
2023-11-16 19:13:24 +01:00
|
|
|
|
|
|
|
|
|
blacklisted_names: _,
|
|
|
|
|
cyclomatic_complexity_threshold: _,
|
|
|
|
|
} = *conf;
|
|
|
|
|
let msrv = || msrv.clone();
|
|
|
|
|
|
2019-10-10 21:46:22 -04:00
|
|
|
|
register_removed_non_tool_lints(store);
|
2022-11-21 20:34:47 +01:00
|
|
|
|
register_categories(store);
|
2019-08-12 07:28:07 +02:00
|
|
|
|
|
2021-10-07 11:21:30 +02:00
|
|
|
|
include!("lib.deprecated.rs");
|
2016-05-24 18:25:25 +02:00
|
|
|
|
|
2022-01-13 13:18:19 +01:00
|
|
|
|
#[cfg(feature = "internal")]
|
2021-06-03 08:41:37 +02:00
|
|
|
|
{
|
|
|
|
|
if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) {
|
2022-09-21 13:02:37 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(utils::internal_lints::metadata_collector::MetadataCollector::new()));
|
2021-06-03 08:41:37 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// all the internal lints
|
2022-01-13 13:18:19 +01:00
|
|
|
|
#[cfg(feature = "internal")]
|
2021-06-03 08:41:37 +02:00
|
|
|
|
{
|
2023-11-02 17:35:56 +01:00
|
|
|
|
store.register_early_pass(|| {
|
|
|
|
|
Box::new(utils::internal_lints::unsorted_clippy_utils_paths::UnsortedClippyUtilsPaths)
|
|
|
|
|
});
|
2022-10-23 15:18:45 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(utils::internal_lints::produce_ice::ProduceIce));
|
|
|
|
|
store.register_late_pass(|_| Box::new(utils::internal_lints::collapsible_calls::CollapsibleCalls));
|
|
|
|
|
store.register_late_pass(|_| {
|
|
|
|
|
Box::new(utils::internal_lints::compiler_lint_functions::CompilerLintFunctions::new())
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(|_| Box::new(utils::internal_lints::invalid_paths::InvalidPaths));
|
|
|
|
|
store.register_late_pass(|_| {
|
|
|
|
|
Box::<utils::internal_lints::interning_defined_symbol::InterningDefinedSymbol>::default()
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(|_| {
|
|
|
|
|
Box::<utils::internal_lints::lint_without_lint_pass::LintWithoutLintPass>::default()
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(|_| Box::<utils::internal_lints::unnecessary_def_path::UnnecessaryDefPath>::default());
|
|
|
|
|
store.register_late_pass(|_| Box::new(utils::internal_lints::outer_expn_data_pass::OuterExpnDataPass));
|
|
|
|
|
store.register_late_pass(|_| Box::new(utils::internal_lints::msrv_attr_impl::MsrvAttrImpl));
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_late_pass(|_| {
|
|
|
|
|
Box::new(utils::internal_lints::almost_standard_lint_formulation::AlmostStandardFormulation::new())
|
|
|
|
|
});
|
2021-06-03 08:41:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-09 13:36:26 +02:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(operators::arithmetic_side_effects::ArithmeticSideEffects::new(
|
2022-12-17 14:12:54 +01:00
|
|
|
|
arithmetic_side_effects_allowed
|
|
|
|
|
.iter()
|
|
|
|
|
.flat_map(|el| [[el.clone(), "*".to_string()], ["*".to_string(), el.clone()]])
|
|
|
|
|
.chain(arithmetic_side_effects_allowed_binary.clone())
|
|
|
|
|
.collect(),
|
|
|
|
|
arithmetic_side_effects_allowed
|
|
|
|
|
.iter()
|
|
|
|
|
.chain(arithmetic_side_effects_allowed_unary.iter())
|
|
|
|
|
.cloned()
|
|
|
|
|
.collect(),
|
2022-09-09 13:36:26 +02:00
|
|
|
|
))
|
|
|
|
|
});
|
2023-09-25 11:28:58 +02:00
|
|
|
|
store.register_early_pass(|| Box::<utils::format_args_collector::FormatArgsCollector>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(utils::dump_hir::DumpHir));
|
|
|
|
|
store.register_late_pass(|_| Box::new(utils::author::Author));
|
|
|
|
|
store.register_late_pass(move |_| {
|
2022-05-05 15:12:52 +01:00
|
|
|
|
Box::new(await_holding_invalid::AwaitHolding::new(
|
|
|
|
|
await_holding_invalid_types.clone(),
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(serde_api::SerdeApi));
|
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(types::Types::new(
|
|
|
|
|
vec_box_size_threshold,
|
|
|
|
|
type_complexity_threshold,
|
|
|
|
|
avoid_breaking_exported_api,
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(booleans::NonminimalBool));
|
|
|
|
|
store.register_late_pass(|_| Box::new(enum_clike::UnportableVariant));
|
|
|
|
|
store.register_late_pass(|_| Box::new(float_literal::FloatLiteral));
|
|
|
|
|
store.register_late_pass(|_| Box::new(ptr::Ptr));
|
|
|
|
|
store.register_late_pass(|_| Box::new(needless_bool::NeedlessBool));
|
|
|
|
|
store.register_late_pass(|_| Box::new(needless_bool::BoolComparison));
|
|
|
|
|
store.register_late_pass(|_| Box::new(needless_for_each::NeedlessForEach));
|
2023-09-25 11:28:58 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(misc::LintPass));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(eta_reduction::EtaReduction));
|
|
|
|
|
store.register_late_pass(|_| Box::new(mut_mut::MutMut));
|
|
|
|
|
store.register_late_pass(|_| Box::new(mut_reference::UnnecessaryMutPassed));
|
2023-02-25 19:08:29 -05:00
|
|
|
|
store.register_late_pass(|_| Box::<significant_drop_tightening::SignificantDropTightening<'_>>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(len_zero::LenZero));
|
|
|
|
|
store.register_late_pass(|_| Box::new(attrs::Attributes));
|
2023-12-16 14:12:50 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(blocks_in_conditions::BlocksInConditions));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(unicode::Unicode));
|
|
|
|
|
store.register_late_pass(|_| Box::new(uninit_vec::UninitVec));
|
|
|
|
|
store.register_late_pass(|_| Box::new(unit_return_expecting_ord::UnitReturnExpectingOrd));
|
|
|
|
|
store.register_late_pass(|_| Box::new(strings::StringAdd));
|
|
|
|
|
store.register_late_pass(|_| Box::new(implicit_return::ImplicitReturn));
|
|
|
|
|
store.register_late_pass(|_| Box::new(implicit_saturating_sub::ImplicitSaturatingSub));
|
|
|
|
|
store.register_late_pass(|_| Box::new(default_numeric_fallback::DefaultNumericFallback));
|
|
|
|
|
store.register_late_pass(|_| Box::new(inconsistent_struct_constructor::InconsistentStructConstructor));
|
|
|
|
|
store.register_late_pass(|_| Box::new(non_octal_unix_permissions::NonOctalUnixPermissions));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(unnecessary_self_imports::UnnecessarySelfImports));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(approx_const::ApproxConstant::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| {
|
2022-05-21 13:24:00 +02:00
|
|
|
|
Box::new(methods::Methods::new(
|
|
|
|
|
avoid_breaking_exported_api,
|
2022-12-01 18:29:38 +01:00
|
|
|
|
msrv(),
|
2022-05-21 13:24:00 +02:00
|
|
|
|
allow_expect_in_tests,
|
|
|
|
|
allow_unwrap_in_tests,
|
2023-09-25 11:28:58 +02:00
|
|
|
|
allowed_dotfiles.clone(),
|
2022-05-21 13:24:00 +02:00
|
|
|
|
))
|
|
|
|
|
});
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(matches::Matches::new(msrv())));
|
|
|
|
|
store.register_early_pass(move || Box::new(manual_non_exhaustive::ManualNonExhaustiveStruct::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_non_exhaustive::ManualNonExhaustiveEnum::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_strip::ManualStrip::new(msrv())));
|
|
|
|
|
store.register_early_pass(move || Box::new(redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv())));
|
|
|
|
|
store.register_early_pass(move || Box::new(redundant_field_names::RedundantFieldNames::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(checked_conversions::CheckedConversions::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(mem_replace::MemReplace::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(ranges::Ranges::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(from_over_into::FromOverInto::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(use_self::UseSelf::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(missing_const_for_fn::MissingConstForFn::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| Box::new(needless_question_mark::NeedlessQuestionMark));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(casts::Casts::new(msrv())));
|
|
|
|
|
store.register_early_pass(move || Box::new(unnested_or_patterns::UnnestedOrPatterns::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(size_of_in_element_count::SizeOfInElementCount));
|
|
|
|
|
store.register_late_pass(|_| Box::new(same_name_method::SameNameMethod));
|
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(index_refutable_slice::IndexRefutableSlice::new(
|
|
|
|
|
max_suggested_slice_pattern_length,
|
2022-12-01 18:29:38 +01:00
|
|
|
|
msrv(),
|
2021-12-06 12:33:31 +01:00
|
|
|
|
))
|
|
|
|
|
});
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<shadow::Shadow>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(unit_types::UnitTypes));
|
2023-09-12 18:13:53 +02:00
|
|
|
|
store.register_late_pass(move |_| Box::new(loops::Loops::new(msrv(), enforce_iter_loop_reborrow)));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<main_recursion::MainRecursion>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(lifetimes::Lifetimes));
|
|
|
|
|
store.register_late_pass(|_| Box::new(entry::HashMapPass));
|
|
|
|
|
store.register_late_pass(|_| Box::new(minmax::MinMaxPass));
|
|
|
|
|
store.register_late_pass(|_| Box::new(zero_div_zero::ZeroDiv));
|
|
|
|
|
store.register_late_pass(|_| Box::new(mutex_atomic::Mutex));
|
|
|
|
|
store.register_late_pass(|_| Box::new(needless_update::NeedlessUpdate));
|
|
|
|
|
store.register_late_pass(|_| Box::new(needless_borrowed_ref::NeedlessBorrowedRef));
|
|
|
|
|
store.register_late_pass(|_| Box::new(borrow_deref_ref::BorrowDerefRef));
|
2024-01-25 19:17:36 +01:00
|
|
|
|
store.register_late_pass(|_| Box::<no_effect::NoEffect>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(temporary_assignment::TemporaryAssignment));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(transmute::Transmute::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(cognitive_complexity::CognitiveComplexity::new(
|
|
|
|
|
cognitive_complexity_threshold,
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| Box::new(escape::BoxedLocal { too_large_for_stack }));
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(vec::UselessVec {
|
|
|
|
|
too_large_for_stack,
|
|
|
|
|
msrv: msrv(),
|
2023-12-16 14:12:50 +01:00
|
|
|
|
span_to_lint_map: BTreeMap::new(),
|
2023-07-02 14:35:19 +02:00
|
|
|
|
})
|
|
|
|
|
});
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(panic_unimplemented::PanicUnimplemented));
|
|
|
|
|
store.register_late_pass(|_| Box::new(strings::StringLitAsBytes));
|
|
|
|
|
store.register_late_pass(|_| Box::new(derive::Derive));
|
2023-01-12 19:48:13 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(derivable_impls::DerivableImpls::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(drop_forget_ref::DropForgetRef));
|
|
|
|
|
store.register_late_pass(|_| Box::new(empty_enum::EmptyEnum));
|
|
|
|
|
store.register_late_pass(|_| Box::new(invalid_upcast_comparisons::InvalidUpcastComparisons));
|
2023-07-17 10:19:29 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<regex::Regex>::default());
|
2023-03-24 14:04:35 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(copies::CopyAndPaste::new(ignore_interior_mutability.clone())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(copy_iterator::CopyIterator));
|
|
|
|
|
store.register_late_pass(|_| Box::new(format::UselessFormat));
|
|
|
|
|
store.register_late_pass(|_| Box::new(swap::Swap));
|
|
|
|
|
store.register_late_pass(|_| Box::new(overflow_check_conditional::OverflowCheckConditional));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<new_without_default::NewWithoutDefault>::default());
|
2023-11-16 19:13:24 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(disallowed_names::DisallowedNames::new(disallowed_names)));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(functions::Functions::new(
|
|
|
|
|
too_many_arguments_threshold,
|
|
|
|
|
too_many_lines_threshold,
|
2022-08-31 09:24:45 -04:00
|
|
|
|
large_error_threshold,
|
2023-10-21 14:16:11 +02:00
|
|
|
|
avoid_breaking_exported_api,
|
2021-12-06 12:33:31 +01:00
|
|
|
|
))
|
|
|
|
|
});
|
2023-12-01 18:21:58 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(doc::Documentation::new(doc_valid_idents, check_private_items)));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(neg_multiply::NegMultiply));
|
|
|
|
|
store.register_late_pass(|_| Box::new(let_if_seq::LetIfSeq));
|
|
|
|
|
store.register_late_pass(|_| Box::new(mixed_read_write_in_expression::EvalOrderDependence));
|
2023-02-25 19:08:29 -05:00
|
|
|
|
store.register_late_pass(move |_| Box::new(missing_doc::MissingDoc::new(missing_docs_in_crate_items)));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(missing_inline::MissingInline));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(exhaustive_items::ExhaustiveItems));
|
|
|
|
|
store.register_late_pass(|_| Box::new(match_result_ok::MatchResultOk));
|
|
|
|
|
store.register_late_pass(|_| Box::new(partialeq_ne_impl::PartialEqNeImpl));
|
|
|
|
|
store.register_late_pass(|_| Box::new(unused_io_amount::UnusedIoAmount));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold)));
|
|
|
|
|
store.register_late_pass(|_| Box::new(explicit_write::ExplicitWrite));
|
|
|
|
|
store.register_late_pass(|_| Box::new(needless_pass_by_value::NeedlessPassByValue));
|
2023-11-16 19:13:24 +01:00
|
|
|
|
store.register_late_pass(move |tcx| {
|
|
|
|
|
Box::new(pass_by_ref_or_value::PassByRefOrValue::new(
|
|
|
|
|
trivial_copy_size_limit,
|
|
|
|
|
pass_by_value_size_limit,
|
|
|
|
|
avoid_breaking_exported_api,
|
|
|
|
|
tcx.sess.target.pointer_width,
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(ref_option_ref::RefOptionRef));
|
|
|
|
|
store.register_late_pass(|_| Box::new(infinite_iter::InfiniteIter));
|
|
|
|
|
store.register_late_pass(|_| Box::new(inline_fn_without_body::InlineFnWithoutBody));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<useless_conversion::UselessConversion>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(implicit_hasher::ImplicitHasher));
|
|
|
|
|
store.register_late_pass(|_| Box::new(fallible_impl_from::FallibleImplFrom));
|
2023-07-17 10:19:29 +02:00
|
|
|
|
store.register_late_pass(move |_| Box::new(question_mark::QuestionMark::new(msrv(), matches_for_let_else)));
|
2023-02-25 19:08:29 -05:00
|
|
|
|
store.register_late_pass(|_| Box::new(question_mark_used::QuestionMarkUsed));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(suspicious_operation_groupings::SuspiciousOperationGroupings));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(suspicious_trait_impl::SuspiciousImpl));
|
|
|
|
|
store.register_late_pass(|_| Box::new(map_unit_fn::MapUnit));
|
|
|
|
|
store.register_late_pass(|_| Box::new(inherent_impl::MultipleInherentImpl));
|
|
|
|
|
store.register_late_pass(|_| Box::new(neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd));
|
|
|
|
|
store.register_late_pass(|_| Box::new(unwrap::Unwrap));
|
2022-12-17 14:12:54 +01:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(indexing_slicing::IndexingSlicing::new(
|
|
|
|
|
suppress_restriction_lint_in_const,
|
|
|
|
|
))
|
|
|
|
|
});
|
2023-10-21 14:16:11 +02:00
|
|
|
|
store.register_late_pass(move |_| Box::new(non_copy_const::NonCopyConst::new(ignore_interior_mutability.clone())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(ptr_offset_with_cast::PtrOffsetWithCast));
|
|
|
|
|
store.register_late_pass(|_| Box::new(redundant_clone::RedundantClone));
|
|
|
|
|
store.register_late_pass(|_| Box::new(slow_vector_initialization::SlowVectorInit));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(unnecessary_wraps::UnnecessaryWraps::new(avoid_breaking_exported_api)));
|
|
|
|
|
store.register_late_pass(|_| Box::new(assertions_on_constants::AssertionsOnConstants));
|
|
|
|
|
store.register_late_pass(|_| Box::new(assertions_on_result_states::AssertionsOnResultStates));
|
|
|
|
|
store.register_late_pass(|_| Box::new(inherent_to_string::InherentToString));
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_late_pass(move |_| Box::new(trait_bounds::TraitBounds::new(max_trait_bounds, msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(comparison_chain::ComparisonChain));
|
2022-11-21 20:34:47 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(mut_key::MutableKeyType::new(ignore_interior_mutability.clone())));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(reference::DerefAddrOf));
|
|
|
|
|
store.register_early_pass(|| Box::new(double_parens::DoubleParens));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(format_impl::FormatImpl::new()));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(unsafe_removed_from_name::UnsafeNameRemoval));
|
|
|
|
|
store.register_early_pass(|| Box::new(else_if_without_else::ElseIfWithoutElse));
|
|
|
|
|
store.register_early_pass(|| Box::new(int_plus_one::IntPlusOne));
|
|
|
|
|
store.register_early_pass(|| Box::new(formatting::Formatting));
|
|
|
|
|
store.register_early_pass(|| Box::new(misc_early::MiscEarlyLints));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(redundant_closure_call::RedundantClosureCall));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(unused_unit::UnusedUnit));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(returns::Return));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(collapsible_if::CollapsibleIf));
|
2023-04-11 15:31:08 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(items_after_statements::ItemsAfterStatements));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(precedence::Precedence));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(needless_parens_on_range_literals::NeedlessParensOnRangeLiterals));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(needless_continue::NeedlessContinue));
|
|
|
|
|
store.register_early_pass(|| Box::new(redundant_else::RedundantElse));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(create_dir::CreateDir));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(needless_arbitrary_self_type::NeedlessArbitrarySelfType));
|
2021-12-06 12:33:31 +01:00
|
|
|
|
store.register_early_pass(move || {
|
|
|
|
|
Box::new(literal_representation::LiteralDigitGrouping::new(
|
2023-11-16 19:13:24 +01:00
|
|
|
|
unreadable_literal_lint_fractions,
|
2021-12-06 12:33:31 +01:00
|
|
|
|
))
|
|
|
|
|
});
|
|
|
|
|
store.register_early_pass(move || {
|
|
|
|
|
Box::new(literal_representation::DecimalLiteralRepresentation::new(
|
|
|
|
|
literal_representation_threshold,
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| {
|
2023-10-21 14:16:11 +02:00
|
|
|
|
Box::new(item_name_repetitions::ItemNameRepetitions::new(
|
2021-12-06 12:33:31 +01:00
|
|
|
|
enum_variant_name_threshold,
|
2023-10-21 14:16:11 +02:00
|
|
|
|
struct_field_name_threshold,
|
2021-12-06 12:33:31 +01:00
|
|
|
|
avoid_breaking_exported_api,
|
2023-07-02 14:35:19 +02:00
|
|
|
|
allow_private_module_inception,
|
2021-12-06 12:33:31 +01:00
|
|
|
|
))
|
|
|
|
|
});
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(tabs_in_doc_comments::TabsInDocComments));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(upper_case_acronyms::UpperCaseAcronyms::new(
|
|
|
|
|
avoid_breaking_exported_api,
|
|
|
|
|
upper_case_acronyms_aggressive,
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<default::Default>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| Box::new(unused_self::UnusedSelf::new(avoid_breaking_exported_api)));
|
|
|
|
|
store.register_late_pass(|_| Box::new(mutable_debug_assertion::DebugAssertWithMutCall));
|
|
|
|
|
store.register_late_pass(|_| Box::new(exit::Exit));
|
|
|
|
|
store.register_late_pass(|_| Box::new(to_digit_is_some::ToDigitIsSome));
|
2023-11-16 19:13:24 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(large_stack_arrays::LargeStackArrays::new(array_size_threshold.into())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(large_const_arrays::LargeConstArrays::new(array_size_threshold.into())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(floating_point_arithmetic::FloatingPointArithmetic));
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(as_conversions::AsConversions));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(let_underscore::LetUnderscore));
|
2022-11-21 20:34:47 +01:00
|
|
|
|
store.register_early_pass(|| Box::<single_component_path_imports::SingleComponentPathImports>::default());
|
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(excessive_bools::ExcessiveBools::new(
|
|
|
|
|
max_struct_bools,
|
|
|
|
|
max_fn_params_bools,
|
|
|
|
|
))
|
|
|
|
|
});
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(option_env_unwrap::OptionEnvUnwrap));
|
2024-02-08 20:24:42 +01:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(wildcard_imports::WildcardImports::new(
|
|
|
|
|
warn_on_all_wildcard_imports,
|
|
|
|
|
allowed_wildcard_imports.clone(),
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<redundant_pub_crate::RedundantPubCrate>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(unnamed_address::UnnamedAddress));
|
2023-09-25 11:28:58 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<dereference::Dereferencing<'_>>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(option_if_let_else::OptionIfLetElse));
|
|
|
|
|
store.register_late_pass(|_| Box::new(future_not_send::FutureNotSend));
|
2023-04-11 15:31:08 +02:00
|
|
|
|
store.register_late_pass(move |_| Box::new(large_futures::LargeFuture::new(future_size_threshold)));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(if_let_mutex::IfLetMutex));
|
|
|
|
|
store.register_late_pass(|_| Box::new(if_not_else::IfNotElse));
|
|
|
|
|
store.register_late_pass(|_| Box::new(equatable_if_let::PatternEquality));
|
|
|
|
|
store.register_late_pass(|_| Box::new(manual_async_fn::ManualAsyncFn));
|
|
|
|
|
store.register_late_pass(|_| Box::new(panic_in_result_fn::PanicInResultFn));
|
2021-12-06 12:33:31 +01:00
|
|
|
|
store.register_early_pass(move || {
|
|
|
|
|
Box::new(non_expressive_names::NonExpressiveNames {
|
|
|
|
|
single_char_binding_names_threshold,
|
|
|
|
|
})
|
|
|
|
|
});
|
2023-11-16 19:13:24 +01:00
|
|
|
|
store.register_early_pass(move || Box::new(nonstandard_macro_braces::MacroBraces::new(standard_macro_braces)));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<macro_use::MacroUseImports>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(pattern_type_mismatch::PatternTypeMismatch));
|
|
|
|
|
store.register_late_pass(|_| Box::new(unwrap_in_result::UnwrapInResult));
|
|
|
|
|
store.register_late_pass(|_| Box::new(semicolon_if_nothing_returned::SemicolonIfNothingReturned));
|
|
|
|
|
store.register_late_pass(|_| Box::new(async_yields_async::AsyncYieldsAsync));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(move |_| Box::new(disallowed_macros::DisallowedMacros::new(disallowed_macros.clone())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| Box::new(disallowed_methods::DisallowedMethods::new(disallowed_methods.clone())));
|
2021-08-06 17:14:27 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86AttSyntax));
|
|
|
|
|
store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86IntelSyntax));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(empty_drop::EmptyDrop));
|
|
|
|
|
store.register_late_pass(|_| Box::new(strings::StrToString));
|
|
|
|
|
store.register_late_pass(|_| Box::new(strings::StringToString));
|
|
|
|
|
store.register_late_pass(|_| Box::new(zero_sized_map_values::ZeroSizedMapValues));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<vec_init_then_push::VecInitThenPush>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(redundant_slicing::RedundantSlicing));
|
|
|
|
|
store.register_late_pass(|_| Box::new(from_str_radix_10::FromStrRadix10));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(if_then_some_else_none::IfThenSomeElseNone::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(bool_assert_comparison::BoolAssertComparison));
|
2021-09-08 16:31:47 +02:00
|
|
|
|
store.register_early_pass(move || Box::new(module_style::ModStyle));
|
2023-07-31 23:53:53 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<unused_async::UnusedAsync>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| Box::new(disallowed_types::DisallowedTypes::new(disallowed_types.clone())));
|
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(missing_enforced_import_rename::ImportRename::new(
|
2023-11-16 19:13:24 +01:00
|
|
|
|
enforced_import_renames.clone(),
|
2021-12-06 12:33:31 +01:00
|
|
|
|
))
|
|
|
|
|
});
|
2023-11-16 19:13:24 +01:00
|
|
|
|
store.register_early_pass(move || Box::new(disallowed_script_idents::DisallowedScriptIdents::new(allowed_scripts)));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(strlen_on_c_strings::StrlenOnCStrings));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(self_named_constructors::SelfNamedConstructors));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(iter_not_returning_iterator::IterNotReturningIterator));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_assert::ManualAssert));
|
|
|
|
|
store.register_late_pass(move |_| {
|
2021-12-06 12:33:31 +01:00
|
|
|
|
Box::new(non_send_fields_in_send_ty::NonSendFieldInSendTy::new(
|
|
|
|
|
enable_raw_pointer_heuristic_for_send,
|
|
|
|
|
))
|
|
|
|
|
});
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(undocumented_unsafe_blocks::UndocumentedUnsafeBlocks::new(
|
|
|
|
|
accept_comment_above_statement,
|
|
|
|
|
accept_comment_above_attributes,
|
|
|
|
|
))
|
|
|
|
|
});
|
2023-11-16 19:13:24 +01:00
|
|
|
|
store
|
|
|
|
|
.register_late_pass(move |_| Box::new(format_args::FormatArgs::new(msrv(), allow_mixed_uninlined_format_args)));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(trailing_empty_array::TrailingEmptyArray));
|
2021-12-06 12:33:31 +01:00
|
|
|
|
store.register_early_pass(|| Box::new(octal_escapes::OctalEscapes));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(needless_late_init::NeedlessLateInit));
|
|
|
|
|
store.register_late_pass(|_| Box::new(return_self_not_must_use::ReturnSelfNotMustUse));
|
|
|
|
|
store.register_late_pass(|_| Box::new(init_numbered_fields::NumberedFields));
|
2022-01-13 13:18:19 +01:00
|
|
|
|
store.register_early_pass(|| Box::new(single_char_lifetime_names::SingleCharLifetimeNames));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_bits::ManualBits::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(default_union_representation::DefaultUnionRepresentation));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<only_used_in_recursion::OnlyUsedInRecursion>::default());
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| Box::new(dbg_macro::DbgMacro::new(allow_dbg_in_tests)));
|
2022-11-21 20:34:47 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(write::Write::new(allow_print_in_tests)));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(move |_| {
|
2022-02-26 14:26:21 +01:00
|
|
|
|
Box::new(cargo::Cargo {
|
|
|
|
|
ignore_publish: cargo_ignore_publish,
|
2024-01-25 19:17:36 +01:00
|
|
|
|
allowed_duplicate_crates: allowed_duplicate_crates.clone(),
|
2022-02-26 14:26:21 +01:00
|
|
|
|
})
|
|
|
|
|
});
|
2022-04-07 18:39:59 +01:00
|
|
|
|
store.register_early_pass(|| Box::new(crate_in_macro_def::CrateInMacroDef));
|
2024-01-11 17:27:03 +01:00
|
|
|
|
store.register_early_pass(|| Box::new(empty_with_brackets::EmptyWithBrackets));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(unnecessary_owned_empty_strings::UnnecessaryOwnedEmptyStrings));
|
2022-05-05 15:12:52 +01:00
|
|
|
|
store.register_early_pass(|| Box::new(pub_use::PubUse));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(format_push_string::FormatPushString));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(large_include_file::LargeIncludeFile::new(max_include_file_size)));
|
|
|
|
|
store.register_late_pass(|_| Box::new(strings::TrimSplitWhitespace));
|
|
|
|
|
store.register_late_pass(|_| Box::new(rc_clone_in_vec_init::RcCloneInVecInit));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_early_pass(|| Box::<duplicate_mod::DuplicateMod>::default());
|
2022-06-04 13:34:07 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(unused_rounding::UnusedRounding));
|
2022-12-17 14:12:54 +01:00
|
|
|
|
store.register_early_pass(move || Box::new(almost_complete_range::AlmostCompleteRange::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(swap_ptr_to_ref::SwapPtrToRef));
|
|
|
|
|
store.register_late_pass(|_| Box::new(mismatching_type_param_order::TypeParamMismatch));
|
|
|
|
|
store.register_late_pass(|_| Box::new(read_zero_byte_vec::ReadZeroByteVec));
|
|
|
|
|
store.register_late_pass(|_| Box::new(default_instead_of_iter_empty::DefaultIterEmpty));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_rem_euclid::ManualRemEuclid::new(msrv())));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_retain::ManualRetain::new(msrv())));
|
2024-02-08 20:24:42 +01:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(operators::Operators::new(
|
|
|
|
|
verbose_bit_mask_threshold,
|
|
|
|
|
allow_comparison_to_zero,
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<std_instead_of_core::StdReexports>::default());
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(instant_subtraction::InstantSubtraction::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(partialeq_to_none::PartialeqToNone));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_clamp::ManualClamp::new(msrv())));
|
2022-09-06 14:23:03 -04:00
|
|
|
|
store.register_late_pass(|_| Box::new(manual_string_new::ManualStringNew));
|
|
|
|
|
store.register_late_pass(|_| Box::new(unused_peekable::UnusedPeekable));
|
2022-08-31 09:24:45 -04:00
|
|
|
|
store.register_early_pass(|| Box::new(multi_assignments::MultiAssignments));
|
2022-09-09 13:36:26 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(bool_to_int_with_if::BoolToIntWithIf));
|
2022-10-06 09:44:38 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(box_default::BoxDefault));
|
|
|
|
|
store.register_late_pass(|_| Box::new(implicit_saturating_add::ImplicitSaturatingAdd));
|
2022-10-23 15:18:45 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(partial_pub_fields::PartialPubFields));
|
|
|
|
|
store.register_late_pass(|_| Box::new(missing_trait_methods::MissingTraitMethods));
|
2022-11-21 20:34:47 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(from_raw_with_void_ptr::FromRawWithVoidPtr));
|
|
|
|
|
store.register_late_pass(|_| Box::new(suspicious_xor_used_as_pow::ConfusingXorAndPow));
|
2022-12-01 18:29:38 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_is_ascii_check::ManualIsAsciiCheck::new(msrv())));
|
2023-05-05 17:45:49 +02:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(semicolon_block::SemicolonBlock::new(
|
|
|
|
|
semicolon_inside_block_ignore_singleline,
|
|
|
|
|
semicolon_outside_block_ignore_multiline,
|
|
|
|
|
))
|
|
|
|
|
});
|
2022-12-29 14:28:34 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(permissions_set_readonly_false::PermissionsSetReadonlyFalse));
|
|
|
|
|
store.register_late_pass(|_| Box::new(size_of_ref::SizeOfRef));
|
2023-01-27 21:09:08 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(multiple_unsafe_ops_per_block::MultipleUnsafeOpsPerBlock));
|
2023-02-25 19:08:29 -05:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(extra_unused_type_parameters::ExtraUnusedTypeParameters::new(
|
|
|
|
|
avoid_breaking_exported_api,
|
|
|
|
|
))
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(|_| Box::new(no_mangle_with_rust_abi::NoMangleWithRustAbi));
|
2023-03-10 10:53:50 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(collection_is_never_read::CollectionIsNeverRead));
|
|
|
|
|
store.register_late_pass(|_| Box::new(missing_assert_message::MissingAssertMessage));
|
2023-04-11 15:31:08 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(redundant_async_block::RedundantAsyncBlock));
|
2023-03-10 10:53:50 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(let_with_type_underscore::UnderscoreTyped));
|
2023-03-24 14:04:35 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(allow_attributes::AllowAttribute));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_main_separator_str::ManualMainSeparatorStr::new(msrv())));
|
|
|
|
|
store.register_late_pass(|_| Box::new(unnecessary_struct_initialization::UnnecessaryStruct));
|
2023-04-11 15:31:08 +02:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(unnecessary_box_returns::UnnecessaryBoxReturns::new(
|
|
|
|
|
avoid_breaking_exported_api,
|
2023-04-23 13:03:09 +02:00
|
|
|
|
unnecessary_box_size,
|
2023-04-11 15:31:08 +02:00
|
|
|
|
))
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(|_| Box::new(lines_filter_map_ok::LinesFilterMapOk));
|
|
|
|
|
store.register_late_pass(|_| Box::new(tests_outside_test_module::TestsOutsideTestModule));
|
|
|
|
|
store.register_late_pass(|_| Box::new(manual_slice_size_calculation::ManualSliceSizeCalculation));
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_early_pass(move || {
|
|
|
|
|
Box::new(excessive_nesting::ExcessiveNesting {
|
|
|
|
|
excessive_nesting_threshold,
|
|
|
|
|
nodes: rustc_ast::node_id::NodeSet::new(),
|
|
|
|
|
})
|
|
|
|
|
});
|
2023-04-23 13:03:09 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(items_after_test_module::ItemsAfterTestModule));
|
2023-05-20 15:39:26 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(ref_patterns::RefPatterns));
|
2023-05-05 17:45:49 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(default_constructed_unit_structs::DefaultConstructedUnitStructs));
|
2023-06-02 11:41:57 +02:00
|
|
|
|
store.register_early_pass(|| Box::new(needless_else::NeedlessElse));
|
|
|
|
|
store.register_late_pass(|_| Box::new(missing_fields_in_debug::MissingFieldsInDebug));
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(endian_bytes::EndianBytes));
|
|
|
|
|
store.register_late_pass(|_| Box::new(redundant_type_annotations::RedundantTypeAnnotations));
|
|
|
|
|
store.register_late_pass(|_| Box::new(arc_with_non_send_sync::ArcWithNonSendSync));
|
|
|
|
|
store.register_late_pass(|_| Box::new(needless_if::NeedlessIf));
|
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(min_ident_chars::MinIdentChars {
|
|
|
|
|
allowed_idents_below_min_chars: allowed_idents_below_min_chars.clone(),
|
|
|
|
|
min_ident_chars_threshold,
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(move |_| Box::new(large_stack_frames::LargeStackFrames::new(stack_size_threshold)));
|
|
|
|
|
store.register_late_pass(|_| Box::new(single_range_in_vec_init::SingleRangeInVecInit));
|
2023-07-17 10:19:29 +02:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(needless_pass_by_ref_mut::NeedlessPassByRefMut::new(
|
|
|
|
|
avoid_breaking_exported_api,
|
|
|
|
|
))
|
|
|
|
|
});
|
2023-09-12 18:13:53 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(non_canonical_impls::NonCanonicalImpls));
|
2023-07-02 14:35:19 +02:00
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(single_call_fn::SingleCallFn {
|
|
|
|
|
avoid_breaking_exported_api,
|
2024-01-21 16:40:06 +01:00
|
|
|
|
def_id_to_usage: rustc_data_structures::fx::FxIndexMap::default(),
|
2023-07-02 14:35:19 +02:00
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
store.register_early_pass(move || {
|
|
|
|
|
Box::new(raw_strings::RawStrings {
|
2023-11-16 19:13:24 +01:00
|
|
|
|
allow_one_hash_in_raw_strings,
|
2023-07-02 14:35:19 +02:00
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(|_| Box::new(manual_range_patterns::ManualRangePatterns));
|
|
|
|
|
store.register_early_pass(|| Box::new(visibility::Visibility));
|
|
|
|
|
store.register_late_pass(move |_| Box::new(tuple_array_conversions::TupleArrayConversions { msrv: msrv() }));
|
2023-07-17 10:19:29 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(manual_float_methods::ManualFloatMethods));
|
2023-07-31 23:53:53 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(four_forward_slashes::FourForwardSlashes));
|
|
|
|
|
store.register_late_pass(|_| Box::new(error_impl_error::ErrorImplError));
|
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(absolute_paths::AbsolutePaths {
|
|
|
|
|
absolute_paths_max_segments,
|
|
|
|
|
absolute_paths_allowed_crates: absolute_paths_allowed_crates.clone(),
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(|_| Box::new(redundant_locals::RedundantLocals));
|
2023-08-11 14:05:13 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(ignored_unit_patterns::IgnoredUnitPatterns));
|
2023-08-24 21:32:12 +02:00
|
|
|
|
store.register_late_pass(|_| Box::<reserve_after_initialization::ReserveAfterInitialization>::default());
|
|
|
|
|
store.register_late_pass(|_| Box::new(implied_bounds_in_impls::ImpliedBoundsInImpls));
|
2023-09-12 18:13:53 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(missing_asserts_for_indexing::MissingAssertsForIndexing));
|
2023-09-25 11:28:58 +02:00
|
|
|
|
store.register_late_pass(|_| Box::new(unnecessary_map_on_constructor::UnnecessaryMapOnConstructor));
|
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(needless_borrows_for_generic_args::NeedlessBorrowsForGenericArgs::new(
|
|
|
|
|
msrv(),
|
|
|
|
|
))
|
|
|
|
|
});
|
2023-10-06 17:35:45 +02:00
|
|
|
|
store.register_late_pass(move |_| Box::new(manual_hash_one::ManualHashOne::new(msrv())));
|
|
|
|
|
store.register_late_pass(|_| Box::new(iter_without_into_iter::IterWithoutIntoIter));
|
2023-11-16 19:13:24 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(iter_over_hash_type::IterOverHashType));
|
2023-12-01 18:21:58 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(impl_hash_with_borrow_str_and_bytes::ImplHashWithBorrowStrBytes));
|
2023-12-16 14:12:50 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(repeat_vec_with_capacity::RepeatVecWithCapacity));
|
|
|
|
|
store.register_late_pass(|_| Box::new(uninhabited_references::UninhabitedReferences));
|
|
|
|
|
store.register_late_pass(|_| Box::new(ineffective_open_options::IneffectiveOpenOptions));
|
2024-01-11 17:27:03 +01:00
|
|
|
|
store.register_late_pass(|_| Box::<unconditional_recursion::UnconditionalRecursion>::default());
|
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(pub_underscore_fields::PubUnderscoreFields {
|
|
|
|
|
behavior: pub_underscore_fields_behavior,
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
store.register_late_pass(move |_| {
|
|
|
|
|
Box::new(thread_local_initializer_can_be_made_const::ThreadLocalInitializerCanBeMadeConst::new(msrv()))
|
|
|
|
|
});
|
2024-02-08 20:24:42 +01:00
|
|
|
|
store.register_late_pass(move |_| Box::new(incompatible_msrv::IncompatibleMsrv::new(msrv())));
|
|
|
|
|
store.register_late_pass(|_| Box::new(to_string_trait_impl::ToStringTraitImpl));
|
2024-02-10 15:04:50 +01:00
|
|
|
|
store.register_early_pass(|| Box::new(multiple_bound_locations::MultipleBoundLocations));
|
2024-01-01 18:51:45 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(assigning_clones::AssigningClones));
|
2023-12-10 22:46:25 +00:00
|
|
|
|
store.register_late_pass(|_| Box::new(zero_repeat_side_effects::ZeroRepeatSideEffects));
|
2024-03-10 01:12:15 +01:00
|
|
|
|
store.register_late_pass(|_| Box::new(manual_unwrap_or_default::ManualUnwrapOrDefault));
|
2021-11-04 12:52:36 +00:00
|
|
|
|
// add lints here, do not remove this comment, it's used in `new_lint`
|
2018-12-17 13:58:41 +01:00
|
|
|
|
}
|
2018-12-16 22:49:46 +01:00
|
|
|
|
|
2019-08-12 07:28:07 +02:00
|
|
|
|
#[rustfmt::skip]
|
2020-01-12 15:08:41 +09:00
|
|
|
|
fn register_removed_non_tool_lints(store: &mut rustc_lint::LintStore) {
|
2019-08-12 07:28:07 +02:00
|
|
|
|
store.register_removed(
|
|
|
|
|
"should_assert_eq",
|
|
|
|
|
"`assert!()` will be more flexible with RFC 2011",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"extend_from_slice",
|
|
|
|
|
"`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"range_step_by_zero",
|
|
|
|
|
"`iterator.step_by(0)` panics nowadays",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"unstable_as_slice",
|
|
|
|
|
"`Vec::as_slice` has been stabilized in 1.7",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"unstable_as_mut_slice",
|
|
|
|
|
"`Vec::as_mut_slice` has been stabilized in 1.7",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"misaligned_transmute",
|
|
|
|
|
"this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"assign_ops",
|
|
|
|
|
"using compound assignment operators (e.g., `+=`) is harmless",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"if_let_redundant_pattern_matching",
|
|
|
|
|
"this lint has been changed to redundant_pattern_matching",
|
|
|
|
|
);
|
|
|
|
|
store.register_removed(
|
|
|
|
|
"unsafe_vector_initialization",
|
|
|
|
|
"the replacement suggested by this lint had substantially different behavior",
|
|
|
|
|
);
|
2020-05-17 17:36:26 +02:00
|
|
|
|
store.register_removed(
|
|
|
|
|
"reverse_range_loop",
|
|
|
|
|
"this lint is now included in reversed_empty_ranges",
|
|
|
|
|
);
|
2019-08-12 07:28:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 07:59:57 +01:00
|
|
|
|
/// Register renamed lints.
|
|
|
|
|
///
|
|
|
|
|
/// Used in `./src/driver.rs`.
|
2020-01-12 15:08:41 +09:00
|
|
|
|
pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
|
2022-05-05 15:12:52 +01:00
|
|
|
|
for (old_name, new_name) in renamed_lints::RENAMED_LINTS {
|
|
|
|
|
ls.register_renamed(old_name, new_name);
|
|
|
|
|
}
|
2016-05-24 18:25:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// only exists to let the dogfood integration test works.
|
|
|
|
|
// Don't run clippy as an executable directly
|
2018-11-17 13:47:27 +01:00
|
|
|
|
#[allow(dead_code)]
|
2016-05-24 18:25:25 +02:00
|
|
|
|
fn main() {
|
|
|
|
|
panic!("Please use the cargo-clippy executable");
|
|
|
|
|
}
|