From e26e3e10952214096b3a1c6731717d58fd6641c4 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Sun, 13 Feb 2022 18:08:54 +0100 Subject: [PATCH 1/7] Add check to enable nightly lints in Clippy --- clippy_lints/src/lib.rs | 1 + clippy_utils/src/lib.rs | 1 + clippy_utils/src/nightly.rs | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 clippy_utils/src/nightly.rs diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index e78f61873593..9af960333ff7 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -462,6 +462,7 @@ pub fn read_conf(sess: &Session) -> Conf { /// Used in `./src/driver.rs`. #[allow(clippy::too_many_lines)] pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) { + clippy_utils::nightly::eval_is_nightly_run(sess); register_removed_non_tool_lints(store); include!("lib.deprecated.rs"); diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 73d91550693d..8d084b688aae 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -45,6 +45,7 @@ pub mod higher; mod hir_utils; pub mod macros; pub mod msrvs; +pub mod nightly; pub mod numeric_literal; pub mod paths; pub mod ptr; diff --git a/clippy_utils/src/nightly.rs b/clippy_utils/src/nightly.rs new file mode 100644 index 000000000000..6515b33c7eb9 --- /dev/null +++ b/clippy_utils/src/nightly.rs @@ -0,0 +1,34 @@ +//! This module is intended to hold most implementations related to Clippy's +//! nightly lints. + +use std::lazy::SyncOnceCell; + +use rustc_session::Session; + +static IS_NIGHTLY_RUN: SyncOnceCell = SyncOnceCell::new(); + +/// This function is used to determine if nightly lints should be enabled or disabled +/// in this Clippy run. +/// +/// It's only allowed to call this once. This is done by [`clippy_lints::lib`] +pub fn eval_is_nightly_run(sess: &Session) { + // This allows users to disable nightly lints on nightly + let disable_nightly = std::env::var("CLIPPY_NIGHTLY").map(|s| s == "0").unwrap_or(false); + // This allows users to enable nightly lints on stable + let enable_nightly = std::env::var("CLIPPY_NIGHTLY").map(|s| s == "1").unwrap_or(false); + + let is_nightly_run = enable_nightly || (sess.is_nightly_build() && !disable_nightly); + + IS_NIGHTLY_RUN + .set(is_nightly_run) + .expect("`ENABLE_NIGHTLY_LINTS` should only be set once."); +} + +/// This function checks if the current run is a nightly run with Clippy's nightly lints. This is +/// destinct from rustc's as a nightly build can disable Clippy's nightly features. +/// +/// See [`Session::is_nightly_build(&self)`] if you want to check if the current build is a nightly build. +#[inline] +pub fn is_nightly_run() -> bool { + *IS_NIGHTLY_RUN.get().unwrap_or(&false) +} From c7363053a2f9bc5ef055440a761b04d650b7aa0b Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 15 Feb 2022 00:25:27 +0100 Subject: [PATCH 2/7] Update `update_lints` to support nightly lints --- clippy_dev/src/update_lints.rs | 143 ++++++++++++++++++++++++--------- clippy_lints/src/lib.rs | 1 + clippy_utils/src/nightly.rs | 5 +- 3 files changed, 107 insertions(+), 42 deletions(-) diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index d368ef1f46a2..eca7487358ac 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -18,7 +18,7 @@ static DEC_CLIPPY_LINT_RE: SyncLazy = SyncLazy::new(|| { r#"(?x) declare_clippy_lint!\s*[\{(] (?:\s+///.*)* - (?:\s*\#\[clippy::version\s*=\s*"[^"]*"\])? + (?:\s*\#\[clippy::version\s*=\s*"(?P[^"]*)"\])? \s+pub\s+(?P[A-Z_][A-Z_0-9]*)\s*,\s* (?P[a-z_]+)\s*,\s* "(?P(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})] @@ -32,7 +32,7 @@ static DEC_DEPRECATED_LINT_RE: SyncLazy = SyncLazy::new(|| { r#"(?x) declare_deprecated_lint!\s*[{(]\s* (?:\s+///.*)* - (?:\s*\#\[clippy::version\s*=\s*"[^"]*"\])? + (?:\s*\#\[clippy::version\s*=\s*"(?P[^"]*)"\])? \s+pub\s+(?P[A-Z_][A-Z_0-9]*)\s*,\s* "(?P(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})] "#, @@ -200,17 +200,26 @@ struct Lint { desc: String, deprecation: Option, module: String, + version: Option, } impl Lint { #[must_use] - fn new(name: &str, group: &str, desc: &str, deprecation: Option<&str>, module: &str) -> Self { + fn new( + name: &str, + group: &str, + desc: &str, + deprecation: Option<&str>, + module: &str, + version: Option<&str>, + ) -> Self { Self { name: name.to_lowercase(), group: group.to_string(), desc: NL_ESCAPE_RE.replace(&desc.replace("\\\"", "\""), "").to_string(), deprecation: deprecation.map(ToString::to_string), module: module.to_string(), + version: version.map(str::to_string), } } @@ -245,19 +254,26 @@ impl Lint { /// Generates the code for registering a group fn gen_lint_group_list<'a>(group_name: &str, lints: impl Iterator) -> String { - let mut details: Vec<_> = lints.map(|l| (&l.module, l.name.to_uppercase())).collect(); + let mut details: Vec<_> = lints.map(|l| (&l.module, l.name.to_uppercase(), &l.version)).collect(); details.sort_unstable(); let mut output = GENERATED_FILE_COMMENT.to_string(); output.push_str(&format!( - "store.register_group(true, \"clippy::{0}\", Some(\"clippy_{0}\"), vec![\n", + "store.register_group(true, \"clippy::{0}\", Some(\"clippy_{0}\"), [\n", group_name )); - for (module, name) in details { - output.push_str(&format!(" LintId::of({}::{}),\n", module, name)); + for (module, name, version) in details { + if version.as_ref().map_or(false, |v| v == "nightly") { + output.push_str(&format!( + " clippy_utils::nightly::is_nightly_run().then_some(LintId::of({}::{})),\n", + module, name + )); + } else { + output.push_str(&format!(" Some(LintId::of({}::{})),\n", module, name)); + } } - output.push_str("])\n"); + output.push_str("].iter().copied().flatten().collect::>())\n"); output } @@ -359,12 +375,26 @@ fn gather_from_file(dir_entry: &walkdir::DirEntry) -> impl Iterator } fn parse_contents(content: &str, module: &str) -> impl Iterator { - let lints = DEC_CLIPPY_LINT_RE - .captures_iter(content) - .map(|m| Lint::new(&m["name"], &m["cat"], &m["desc"], None, module)); - let deprecated = DEC_DEPRECATED_LINT_RE - .captures_iter(content) - .map(|m| Lint::new(&m["name"], "Deprecated", &m["desc"], Some(&m["desc"]), module)); + let lints = DEC_CLIPPY_LINT_RE.captures_iter(content).map(|m| { + Lint::new( + &m["name"], + &m["cat"], + &m["desc"], + None, + module, + m.name("version").map(|v| v.as_str()), + ) + }); + let deprecated = DEC_DEPRECATED_LINT_RE.captures_iter(content).map(|m| { + Lint::new( + &m["name"], + "Deprecated", + &m["desc"], + Some(&m["desc"]), + module, + m.name("version").map(|v| v.as_str()), + ) + }); // Removing the `.collect::>().into_iter()` causes some lifetime issues due to the map lints.chain(deprecated).collect::>().into_iter() } @@ -505,7 +535,6 @@ declare_clippy_lint! { } declare_clippy_lint!{ - #[clippy::version = "Test version"] pub DOC_MARKDOWN, pedantic, "single line" @@ -523,14 +552,22 @@ declare_deprecated_lint! { .collect(); let expected = vec![ - Lint::new("ptr_arg", "style", "really long text", None, "module_name"), - Lint::new("doc_markdown", "pedantic", "single line", None, "module_name"), + Lint::new( + "ptr_arg", + "style", + "really long text", + None, + "module_name", + Some("Hello Clippy!"), + ), + Lint::new("doc_markdown", "pedantic", "single line", None, "module_name", None), Lint::new( "should_assert_eq", "Deprecated", "`assert!()` will be more flexible with RFC 2011", Some("`assert!()` will be more flexible with RFC 2011"), "module_name", + Some("I'm a version"), ), ]; assert_eq!(expected, result); @@ -580,10 +617,17 @@ mod tests { #[test] fn test_usable_lints() { let lints = vec![ - Lint::new("should_assert_eq", "Deprecated", "abc", Some("Reason"), "module_name"), - Lint::new("should_assert_eq2", "Not Deprecated", "abc", None, "module_name"), - Lint::new("should_assert_eq2", "internal", "abc", None, "module_name"), - Lint::new("should_assert_eq2", "internal_style", "abc", None, "module_name"), + Lint::new( + "should_assert_eq", + "Deprecated", + "abc", + Some("Reason"), + "module_name", + None, + ), + Lint::new("should_assert_eq2", "Not Deprecated", "abc", None, "module_name", None), + Lint::new("should_assert_eq2", "internal", "abc", None, "module_name", None), + Lint::new("should_assert_eq2", "internal_style", "abc", None, "module_name", None), ]; let expected = vec![Lint::new( "should_assert_eq2", @@ -591,6 +635,7 @@ mod tests { "abc", None, "module_name", + None, )]; assert_eq!(expected, Lint::usable_lints(&lints)); } @@ -598,21 +643,28 @@ mod tests { #[test] fn test_by_lint_group() { let lints = vec![ - Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), - Lint::new("should_assert_eq2", "group2", "abc", None, "module_name"), - Lint::new("incorrect_match", "group1", "abc", None, "module_name"), + Lint::new("should_assert_eq", "group1", "abc", None, "module_name", None), + Lint::new("should_assert_eq2", "group2", "abc", None, "module_name", None), + Lint::new("incorrect_match", "group1", "abc", None, "module_name", None), ]; let mut expected: HashMap> = HashMap::new(); expected.insert( "group1".to_string(), vec![ - Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), - Lint::new("incorrect_match", "group1", "abc", None, "module_name"), + Lint::new("should_assert_eq", "group1", "abc", None, "module_name", None), + Lint::new("incorrect_match", "group1", "abc", None, "module_name", None), ], ); expected.insert( "group2".to_string(), - vec![Lint::new("should_assert_eq2", "group2", "abc", None, "module_name")], + vec![Lint::new( + "should_assert_eq2", + "group2", + "abc", + None, + "module_name", + None, + )], ); assert_eq!(expected, Lint::by_lint_group(lints.into_iter())); } @@ -620,8 +672,8 @@ mod tests { #[test] fn test_gen_changelog_lint_list() { let lints = vec![ - Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), - Lint::new("should_assert_eq2", "group2", "abc", None, "module_name"), + Lint::new("should_assert_eq", "group1", "abc", None, "module_name", None), + Lint::new("should_assert_eq2", "group2", "abc", None, "module_name", None), ]; let expected = vec![ format!("[`should_assert_eq`]: {}#should_assert_eq", DOCS_LINK), @@ -639,6 +691,7 @@ mod tests { "abc", Some("has been superseded by should_assert_eq2"), "module_name", + None, ), Lint::new( "another_deprecated", @@ -646,6 +699,7 @@ mod tests { "abc", Some("will be removed"), "module_name", + None, ), ]; @@ -671,15 +725,22 @@ mod tests { #[test] #[should_panic] fn test_gen_deprecated_fail() { - let lints = vec![Lint::new("should_assert_eq2", "group2", "abc", None, "module_name")]; + let lints = vec![Lint::new( + "should_assert_eq2", + "group2", + "abc", + None, + "module_name", + None, + )]; let _deprecated_lints = gen_deprecated(lints.iter()); } #[test] fn test_gen_modules_list() { let lints = vec![ - Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), - Lint::new("incorrect_stuff", "group3", "abc", None, "another_module"), + Lint::new("should_assert_eq", "group1", "abc", None, "module_name", None), + Lint::new("incorrect_stuff", "group3", "abc", None, "another_module", None), ]; let expected = vec!["mod another_module;".to_string(), "mod module_name;".to_string()]; assert_eq!(expected, gen_modules_list(lints.iter())); @@ -688,17 +749,19 @@ mod tests { #[test] fn test_gen_lint_group_list() { let lints = vec![ - Lint::new("abc", "group1", "abc", None, "module_name"), - Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), - Lint::new("internal", "internal_style", "abc", None, "module_name"), + Lint::new("abc", "group1", "abc", None, "module_name", Some("1.0.1")), + Lint::new("should_assert_eq", "group1", "abc", None, "module_name", Some("1.60.0")), + Lint::new("internal", "internal_style", "abc", None, "module_name", None), + Lint::new("nightly_lint", "nightly", "abc", None, "module_name", Some("nightly")), ]; let expected = GENERATED_FILE_COMMENT.to_string() + &[ - "store.register_group(true, \"clippy::group1\", Some(\"clippy_group1\"), vec![", - " LintId::of(module_name::ABC),", - " LintId::of(module_name::INTERNAL),", - " LintId::of(module_name::SHOULD_ASSERT_EQ),", - "])", + "store.register_group(true, \"clippy::group1\", Some(\"clippy_group1\"), [", + " Some(LintId::of(module_name::ABC)),", + " Some(LintId::of(module_name::INTERNAL)),", + " clippy_utils::nightly::is_nightly_run().then_some(LintId::of(module_name::NIGHTLY_LINT)),", + " Some(LintId::of(module_name::SHOULD_ASSERT_EQ)),", + "].iter().copied().flatten().collect::>())", ] .join("\n") + "\n"; diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 9af960333ff7..f2661a82c0d2 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -1,6 +1,7 @@ // error-pattern:cargo-clippy #![feature(binary_heap_into_iter_sorted)] +#![feature(bool_to_option)] #![feature(box_patterns)] #![feature(control_flow_enum)] #![feature(drain_filter)] diff --git a/clippy_utils/src/nightly.rs b/clippy_utils/src/nightly.rs index 6515b33c7eb9..b5a4dbcc8b69 100644 --- a/clippy_utils/src/nightly.rs +++ b/clippy_utils/src/nightly.rs @@ -26,8 +26,9 @@ pub fn eval_is_nightly_run(sess: &Session) { /// This function checks if the current run is a nightly run with Clippy's nightly lints. This is /// destinct from rustc's as a nightly build can disable Clippy's nightly features. -/// -/// See [`Session::is_nightly_build(&self)`] if you want to check if the current build is a nightly build. +/// +/// See [`Session::is_nightly_build(&self)`] if you want to check if the current build is a nightly +/// build. #[inline] pub fn is_nightly_run() -> bool { *IS_NIGHTLY_RUN.get().unwrap_or(&false) From 1462930def3cd329a33b65ceba259aa8e7af4c95 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 15 Feb 2022 00:26:42 +0100 Subject: [PATCH 3/7] Run `cargo dev update_lints` --- clippy_lints/src/lib.register_all.rs | 626 +++++++++---------- clippy_lints/src/lib.register_cargo.rs | 14 +- clippy_lints/src/lib.register_complexity.rs | 184 +++--- clippy_lints/src/lib.register_correctness.rs | 144 ++--- clippy_lints/src/lib.register_internal.rs | 32 +- clippy_lints/src/lib.register_nursery.rs | 54 +- clippy_lints/src/lib.register_pedantic.rs | 194 +++--- clippy_lints/src/lib.register_perf.rs | 52 +- clippy_lints/src/lib.register_restriction.rs | 138 ++-- clippy_lints/src/lib.register_style.rs | 228 +++---- clippy_lints/src/lib.register_suspicious.rs | 34 +- 11 files changed, 850 insertions(+), 850 deletions(-) diff --git a/clippy_lints/src/lib.register_all.rs b/clippy_lints/src/lib.register_all.rs index d93e34e76b49..e45f25eab0e8 100644 --- a/clippy_lints/src/lib.register_all.rs +++ b/clippy_lints/src/lib.register_all.rs @@ -2,316 +2,316 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::all", Some("clippy_all"), vec![ - LintId::of(absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS), - LintId::of(approx_const::APPROX_CONSTANT), - LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS), - LintId::of(assign_ops::ASSIGN_OP_PATTERN), - LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP), - LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC), - LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS), - LintId::of(attrs::DEPRECATED_CFG_ATTR), - LintId::of(attrs::DEPRECATED_SEMVER), - LintId::of(attrs::MISMATCHED_TARGET_OS), - LintId::of(attrs::USELESS_ATTRIBUTE), - LintId::of(bit_mask::BAD_BIT_MASK), - LintId::of(bit_mask::INEFFECTIVE_BIT_MASK), - LintId::of(blacklisted_name::BLACKLISTED_NAME), - LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS), - LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON), - LintId::of(booleans::LOGIC_BUG), - LintId::of(booleans::NONMINIMAL_BOOL), - LintId::of(casts::CAST_REF_TO_MUT), - LintId::of(casts::CHAR_LIT_AS_U8), - LintId::of(casts::FN_TO_NUMERIC_CAST), - LintId::of(casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION), - LintId::of(casts::UNNECESSARY_CAST), - LintId::of(collapsible_if::COLLAPSIBLE_ELSE_IF), - LintId::of(collapsible_if::COLLAPSIBLE_IF), - LintId::of(collapsible_match::COLLAPSIBLE_MATCH), - LintId::of(comparison_chain::COMPARISON_CHAIN), - LintId::of(copies::IFS_SAME_COND), - LintId::of(copies::IF_SAME_THEN_ELSE), - LintId::of(default::FIELD_REASSIGN_WITH_DEFAULT), - LintId::of(dereference::NEEDLESS_BORROW), - LintId::of(derivable_impls::DERIVABLE_IMPLS), - LintId::of(derive::DERIVE_HASH_XOR_EQ), - LintId::of(derive::DERIVE_ORD_XOR_PARTIAL_ORD), - LintId::of(disallowed_methods::DISALLOWED_METHODS), - LintId::of(disallowed_types::DISALLOWED_TYPES), - LintId::of(doc::MISSING_SAFETY_DOC), - LintId::of(doc::NEEDLESS_DOCTEST_MAIN), - LintId::of(double_comparison::DOUBLE_COMPARISONS), - LintId::of(double_parens::DOUBLE_PARENS), - LintId::of(drop_forget_ref::DROP_COPY), - LintId::of(drop_forget_ref::DROP_REF), - LintId::of(drop_forget_ref::FORGET_COPY), - LintId::of(drop_forget_ref::FORGET_REF), - LintId::of(duration_subsec::DURATION_SUBSEC), - LintId::of(entry::MAP_ENTRY), - LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT), - LintId::of(enum_variants::ENUM_VARIANT_NAMES), - LintId::of(enum_variants::MODULE_INCEPTION), - LintId::of(eq_op::EQ_OP), - LintId::of(eq_op::OP_REF), - LintId::of(erasing_op::ERASING_OP), - LintId::of(escape::BOXED_LOCAL), - LintId::of(eta_reduction::REDUNDANT_CLOSURE), - LintId::of(eval_order_dependence::DIVERGING_SUB_EXPRESSION), - LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE), - LintId::of(explicit_write::EXPLICIT_WRITE), - LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS), - LintId::of(float_literal::EXCESSIVE_PRECISION), - LintId::of(format::USELESS_FORMAT), - LintId::of(format_args::FORMAT_IN_FORMAT_ARGS), - LintId::of(format_args::TO_STRING_IN_FORMAT_ARGS), - LintId::of(formatting::POSSIBLE_MISSING_COMMA), - LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING), - LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING), - LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING), - LintId::of(from_over_into::FROM_OVER_INTO), - LintId::of(from_str_radix_10::FROM_STR_RADIX_10), - LintId::of(functions::DOUBLE_MUST_USE), - LintId::of(functions::MUST_USE_UNIT), - LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF), - LintId::of(functions::RESULT_UNIT_ERR), - LintId::of(functions::TOO_MANY_ARGUMENTS), - LintId::of(get_last_with_len::GET_LAST_WITH_LEN), - LintId::of(identity_op::IDENTITY_OP), - LintId::of(if_let_mutex::IF_LET_MUTEX), - LintId::of(indexing_slicing::OUT_OF_BOUNDS_INDEXING), - LintId::of(infinite_iter::INFINITE_ITER), - LintId::of(inherent_to_string::INHERENT_TO_STRING), - LintId::of(inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY), - LintId::of(init_numbered_fields::INIT_NUMBERED_FIELDS), - LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY), - LintId::of(int_plus_one::INT_PLUS_ONE), - LintId::of(large_const_arrays::LARGE_CONST_ARRAYS), - LintId::of(large_enum_variant::LARGE_ENUM_VARIANT), - LintId::of(len_zero::COMPARISON_TO_EMPTY), - LintId::of(len_zero::LEN_WITHOUT_IS_EMPTY), - LintId::of(len_zero::LEN_ZERO), - LintId::of(let_underscore::LET_UNDERSCORE_LOCK), - LintId::of(lifetimes::EXTRA_UNUSED_LIFETIMES), - LintId::of(lifetimes::NEEDLESS_LIFETIMES), - LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING), - LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES), - LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS), - LintId::of(loops::EMPTY_LOOP), - LintId::of(loops::EXPLICIT_COUNTER_LOOP), - LintId::of(loops::FOR_KV_MAP), - LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES), - LintId::of(loops::ITER_NEXT_LOOP), - LintId::of(loops::MANUAL_FLATTEN), - LintId::of(loops::MANUAL_MEMCPY), - LintId::of(loops::MUT_RANGE_BOUND), - LintId::of(loops::NEEDLESS_COLLECT), - LintId::of(loops::NEEDLESS_RANGE_LOOP), - LintId::of(loops::NEVER_LOOP), - LintId::of(loops::SAME_ITEM_PUSH), - LintId::of(loops::SINGLE_ELEMENT_LOOP), - LintId::of(loops::WHILE_IMMUTABLE_CONDITION), - LintId::of(loops::WHILE_LET_LOOP), - LintId::of(loops::WHILE_LET_ON_ITERATOR), - LintId::of(main_recursion::MAIN_RECURSION), - LintId::of(manual_async_fn::MANUAL_ASYNC_FN), - LintId::of(manual_bits::MANUAL_BITS), - LintId::of(manual_map::MANUAL_MAP), - LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE), - LintId::of(manual_strip::MANUAL_STRIP), - LintId::of(manual_unwrap_or::MANUAL_UNWRAP_OR), - LintId::of(map_clone::MAP_CLONE), - LintId::of(map_unit_fn::OPTION_MAP_UNIT_FN), - LintId::of(map_unit_fn::RESULT_MAP_UNIT_FN), - LintId::of(match_result_ok::MATCH_RESULT_OK), - LintId::of(match_str_case_mismatch::MATCH_STR_CASE_MISMATCH), - LintId::of(matches::INFALLIBLE_DESTRUCTURING_MATCH), - LintId::of(matches::MATCH_AS_REF), - LintId::of(matches::MATCH_LIKE_MATCHES_MACRO), - LintId::of(matches::MATCH_OVERLAPPING_ARM), - LintId::of(matches::MATCH_REF_PATS), - LintId::of(matches::MATCH_SINGLE_BINDING), - LintId::of(matches::REDUNDANT_PATTERN_MATCHING), - LintId::of(matches::SINGLE_MATCH), - LintId::of(matches::WILDCARD_IN_OR_PATTERNS), - LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE), - LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT), - LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT), - LintId::of(methods::BIND_INSTEAD_OF_MAP), - LintId::of(methods::BYTES_NTH), - LintId::of(methods::CHARS_LAST_CMP), - LintId::of(methods::CHARS_NEXT_CMP), - LintId::of(methods::CLONE_DOUBLE_REF), - LintId::of(methods::CLONE_ON_COPY), - LintId::of(methods::EXPECT_FUN_CALL), - LintId::of(methods::EXTEND_WITH_DRAIN), - LintId::of(methods::FILTER_MAP_IDENTITY), - LintId::of(methods::FILTER_NEXT), - LintId::of(methods::FLAT_MAP_IDENTITY), - LintId::of(methods::INSPECT_FOR_EACH), - LintId::of(methods::INTO_ITER_ON_REF), - LintId::of(methods::ITERATOR_STEP_BY_ZERO), - LintId::of(methods::ITER_CLONED_COLLECT), - LintId::of(methods::ITER_COUNT), - LintId::of(methods::ITER_NEXT_SLICE), - LintId::of(methods::ITER_NTH), - LintId::of(methods::ITER_NTH_ZERO), - LintId::of(methods::ITER_OVEREAGER_CLONED), - LintId::of(methods::ITER_SKIP_NEXT), - LintId::of(methods::MANUAL_FILTER_MAP), - LintId::of(methods::MANUAL_FIND_MAP), - LintId::of(methods::MANUAL_SATURATING_ARITHMETIC), - LintId::of(methods::MANUAL_SPLIT_ONCE), - LintId::of(methods::MANUAL_STR_REPEAT), - LintId::of(methods::MAP_COLLECT_RESULT_UNIT), - LintId::of(methods::MAP_FLATTEN), - LintId::of(methods::MAP_IDENTITY), - LintId::of(methods::NEEDLESS_SPLITN), - LintId::of(methods::NEW_RET_NO_SELF), - LintId::of(methods::OK_EXPECT), - LintId::of(methods::OPTION_AS_REF_DEREF), - LintId::of(methods::OPTION_FILTER_MAP), - LintId::of(methods::OPTION_MAP_OR_NONE), - LintId::of(methods::OR_FUN_CALL), - LintId::of(methods::RESULT_MAP_OR_INTO_OPTION), - LintId::of(methods::SEARCH_IS_SOME), - LintId::of(methods::SHOULD_IMPLEMENT_TRAIT), - LintId::of(methods::SINGLE_CHAR_ADD_STR), - LintId::of(methods::SINGLE_CHAR_PATTERN), - LintId::of(methods::SKIP_WHILE_NEXT), - LintId::of(methods::STRING_EXTEND_CHARS), - LintId::of(methods::SUSPICIOUS_MAP), - LintId::of(methods::SUSPICIOUS_SPLITN), - LintId::of(methods::UNINIT_ASSUMED_INIT), - LintId::of(methods::UNNECESSARY_FILTER_MAP), - LintId::of(methods::UNNECESSARY_FOLD), - LintId::of(methods::UNNECESSARY_LAZY_EVALUATIONS), - LintId::of(methods::UNNECESSARY_TO_OWNED), - LintId::of(methods::UNWRAP_OR_ELSE_DEFAULT), - LintId::of(methods::USELESS_ASREF), - LintId::of(methods::WRONG_SELF_CONVENTION), - LintId::of(methods::ZST_OFFSET), - LintId::of(minmax::MIN_MAX), - LintId::of(misc::CMP_NAN), - LintId::of(misc::CMP_OWNED), - LintId::of(misc::MODULO_ONE), - LintId::of(misc::SHORT_CIRCUIT_STATEMENT), - LintId::of(misc::TOPLEVEL_REF_ARG), - LintId::of(misc::ZERO_PTR), - LintId::of(misc_early::BUILTIN_TYPE_SHADOW), - LintId::of(misc_early::DOUBLE_NEG), - LintId::of(misc_early::DUPLICATE_UNDERSCORE_ARGUMENT), - LintId::of(misc_early::MIXED_CASE_HEX_LITERALS), - LintId::of(misc_early::REDUNDANT_PATTERN), - LintId::of(misc_early::UNNEEDED_WILDCARD_PATTERN), - LintId::of(misc_early::ZERO_PREFIXED_LITERAL), - LintId::of(mut_key::MUTABLE_KEY_TYPE), - LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK), - LintId::of(mut_reference::UNNECESSARY_MUT_PASSED), - LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE), - LintId::of(needless_bool::BOOL_COMPARISON), - LintId::of(needless_bool::NEEDLESS_BOOL), - LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE), - LintId::of(needless_late_init::NEEDLESS_LATE_INIT), - LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF), - LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK), - LintId::of(needless_update::NEEDLESS_UPDATE), - LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD), - LintId::of(neg_multiply::NEG_MULTIPLY), - LintId::of(new_without_default::NEW_WITHOUT_DEFAULT), - LintId::of(no_effect::NO_EFFECT), - LintId::of(no_effect::UNNECESSARY_OPERATION), - LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST), - LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST), - LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS), - LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS), - LintId::of(octal_escapes::OCTAL_ESCAPES), - LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS), - LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP), - LintId::of(overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL), - LintId::of(partialeq_ne_impl::PARTIALEQ_NE_IMPL), - LintId::of(precedence::PRECEDENCE), - LintId::of(ptr::CMP_NULL), - LintId::of(ptr::INVALID_NULL_PTR_USAGE), - LintId::of(ptr::MUT_FROM_REF), - LintId::of(ptr::PTR_ARG), - LintId::of(ptr_eq::PTR_EQ), - LintId::of(ptr_offset_with_cast::PTR_OFFSET_WITH_CAST), - LintId::of(question_mark::QUESTION_MARK), - LintId::of(ranges::MANUAL_RANGE_CONTAINS), - LintId::of(ranges::RANGE_ZIP_WITH_LEN), - LintId::of(ranges::REVERSED_EMPTY_RANGES), - LintId::of(redundant_clone::REDUNDANT_CLONE), - LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL), - LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES), - LintId::of(redundant_slicing::REDUNDANT_SLICING), - LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES), - LintId::of(reference::DEREF_ADDROF), - LintId::of(regex::INVALID_REGEX), - LintId::of(repeat_once::REPEAT_ONCE), - LintId::of(returns::LET_AND_RETURN), - LintId::of(returns::NEEDLESS_RETURN), - LintId::of(self_assignment::SELF_ASSIGNMENT), - LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS), - LintId::of(serde_api::SERDE_API_MISUSE), - LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS), - LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT), - LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION), - LintId::of(stable_sort_primitive::STABLE_SORT_PRIMITIVE), - LintId::of(strings::STRING_FROM_UTF8_AS_BYTES), - LintId::of(strlen_on_c_strings::STRLEN_ON_C_STRINGS), - LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL), - LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL), - LintId::of(swap::ALMOST_SWAPPED), - LintId::of(swap::MANUAL_SWAP), - LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS), - LintId::of(temporary_assignment::TEMPORARY_ASSIGNMENT), - LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME), - LintId::of(to_string_in_display::TO_STRING_IN_DISPLAY), - LintId::of(transmute::CROSSPOINTER_TRANSMUTE), - LintId::of(transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS), - LintId::of(transmute::TRANSMUTE_BYTES_TO_STR), - LintId::of(transmute::TRANSMUTE_FLOAT_TO_INT), - LintId::of(transmute::TRANSMUTE_INT_TO_BOOL), - LintId::of(transmute::TRANSMUTE_INT_TO_CHAR), - LintId::of(transmute::TRANSMUTE_INT_TO_FLOAT), - LintId::of(transmute::TRANSMUTE_NUM_TO_BYTES), - LintId::of(transmute::TRANSMUTE_PTR_TO_REF), - LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR), - LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE), - LintId::of(transmute::WRONG_TRANSMUTE), - LintId::of(transmuting_null::TRANSMUTING_NULL), - LintId::of(try_err::TRY_ERR), - LintId::of(types::BORROWED_BOX), - LintId::of(types::BOX_COLLECTION), - LintId::of(types::REDUNDANT_ALLOCATION), - LintId::of(types::TYPE_COMPLEXITY), - LintId::of(types::VEC_BOX), - LintId::of(undropped_manually_drops::UNDROPPED_MANUALLY_DROPS), - LintId::of(unicode::INVISIBLE_CHARACTERS), - LintId::of(uninit_vec::UNINIT_VEC), - LintId::of(unit_hash::UNIT_HASH), - LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD), - LintId::of(unit_types::UNIT_ARG), - LintId::of(unit_types::UNIT_CMP), - LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS), - LintId::of(unnamed_address::VTABLE_ADDRESS_COMPARISONS), - LintId::of(unnecessary_sort_by::UNNECESSARY_SORT_BY), - LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME), - LintId::of(unused_io_amount::UNUSED_IO_AMOUNT), - LintId::of(unused_unit::UNUSED_UNIT), - LintId::of(unwrap::PANICKING_UNWRAP), - LintId::of(unwrap::UNNECESSARY_UNWRAP), - LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS), - LintId::of(useless_conversion::USELESS_CONVERSION), - LintId::of(vec::USELESS_VEC), - LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH), - LintId::of(vec_resize_to_zero::VEC_RESIZE_TO_ZERO), - LintId::of(write::PRINTLN_EMPTY_STRING), - LintId::of(write::PRINT_LITERAL), - LintId::of(write::PRINT_WITH_NEWLINE), - LintId::of(write::WRITELN_EMPTY_STRING), - LintId::of(write::WRITE_LITERAL), - LintId::of(write::WRITE_WITH_NEWLINE), - LintId::of(zero_div_zero::ZERO_DIVIDED_BY_ZERO), -]) +store.register_group(true, "clippy::all", Some("clippy_all"), [ + Some(LintId::of(absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS)), + Some(LintId::of(approx_const::APPROX_CONSTANT)), + Some(LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS)), + Some(LintId::of(assign_ops::ASSIGN_OP_PATTERN)), + Some(LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP)), + Some(LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC)), + Some(LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS)), + Some(LintId::of(attrs::DEPRECATED_CFG_ATTR)), + Some(LintId::of(attrs::DEPRECATED_SEMVER)), + Some(LintId::of(attrs::MISMATCHED_TARGET_OS)), + Some(LintId::of(attrs::USELESS_ATTRIBUTE)), + Some(LintId::of(bit_mask::BAD_BIT_MASK)), + Some(LintId::of(bit_mask::INEFFECTIVE_BIT_MASK)), + Some(LintId::of(blacklisted_name::BLACKLISTED_NAME)), + Some(LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS)), + Some(LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON)), + Some(LintId::of(booleans::LOGIC_BUG)), + Some(LintId::of(booleans::NONMINIMAL_BOOL)), + Some(LintId::of(casts::CAST_REF_TO_MUT)), + Some(LintId::of(casts::CHAR_LIT_AS_U8)), + Some(LintId::of(casts::FN_TO_NUMERIC_CAST)), + Some(LintId::of(casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION)), + Some(LintId::of(casts::UNNECESSARY_CAST)), + Some(LintId::of(collapsible_if::COLLAPSIBLE_ELSE_IF)), + Some(LintId::of(collapsible_if::COLLAPSIBLE_IF)), + Some(LintId::of(collapsible_match::COLLAPSIBLE_MATCH)), + Some(LintId::of(comparison_chain::COMPARISON_CHAIN)), + Some(LintId::of(copies::IFS_SAME_COND)), + Some(LintId::of(copies::IF_SAME_THEN_ELSE)), + Some(LintId::of(default::FIELD_REASSIGN_WITH_DEFAULT)), + Some(LintId::of(dereference::NEEDLESS_BORROW)), + Some(LintId::of(derivable_impls::DERIVABLE_IMPLS)), + Some(LintId::of(derive::DERIVE_HASH_XOR_EQ)), + Some(LintId::of(derive::DERIVE_ORD_XOR_PARTIAL_ORD)), + Some(LintId::of(disallowed_methods::DISALLOWED_METHODS)), + Some(LintId::of(disallowed_types::DISALLOWED_TYPES)), + Some(LintId::of(doc::MISSING_SAFETY_DOC)), + Some(LintId::of(doc::NEEDLESS_DOCTEST_MAIN)), + Some(LintId::of(double_comparison::DOUBLE_COMPARISONS)), + Some(LintId::of(double_parens::DOUBLE_PARENS)), + Some(LintId::of(drop_forget_ref::DROP_COPY)), + Some(LintId::of(drop_forget_ref::DROP_REF)), + Some(LintId::of(drop_forget_ref::FORGET_COPY)), + Some(LintId::of(drop_forget_ref::FORGET_REF)), + Some(LintId::of(duration_subsec::DURATION_SUBSEC)), + Some(LintId::of(entry::MAP_ENTRY)), + Some(LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT)), + Some(LintId::of(enum_variants::ENUM_VARIANT_NAMES)), + Some(LintId::of(enum_variants::MODULE_INCEPTION)), + Some(LintId::of(eq_op::EQ_OP)), + Some(LintId::of(eq_op::OP_REF)), + Some(LintId::of(erasing_op::ERASING_OP)), + Some(LintId::of(escape::BOXED_LOCAL)), + Some(LintId::of(eta_reduction::REDUNDANT_CLOSURE)), + Some(LintId::of(eval_order_dependence::DIVERGING_SUB_EXPRESSION)), + Some(LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE)), + Some(LintId::of(explicit_write::EXPLICIT_WRITE)), + Some(LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS)), + Some(LintId::of(float_literal::EXCESSIVE_PRECISION)), + Some(LintId::of(format::USELESS_FORMAT)), + Some(LintId::of(format_args::FORMAT_IN_FORMAT_ARGS)), + Some(LintId::of(format_args::TO_STRING_IN_FORMAT_ARGS)), + Some(LintId::of(formatting::POSSIBLE_MISSING_COMMA)), + Some(LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING)), + Some(LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING)), + Some(LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING)), + Some(LintId::of(from_over_into::FROM_OVER_INTO)), + Some(LintId::of(from_str_radix_10::FROM_STR_RADIX_10)), + Some(LintId::of(functions::DOUBLE_MUST_USE)), + Some(LintId::of(functions::MUST_USE_UNIT)), + Some(LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF)), + Some(LintId::of(functions::RESULT_UNIT_ERR)), + Some(LintId::of(functions::TOO_MANY_ARGUMENTS)), + Some(LintId::of(get_last_with_len::GET_LAST_WITH_LEN)), + Some(LintId::of(identity_op::IDENTITY_OP)), + Some(LintId::of(if_let_mutex::IF_LET_MUTEX)), + Some(LintId::of(indexing_slicing::OUT_OF_BOUNDS_INDEXING)), + Some(LintId::of(infinite_iter::INFINITE_ITER)), + Some(LintId::of(inherent_to_string::INHERENT_TO_STRING)), + Some(LintId::of(inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY)), + Some(LintId::of(init_numbered_fields::INIT_NUMBERED_FIELDS)), + Some(LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY)), + Some(LintId::of(int_plus_one::INT_PLUS_ONE)), + Some(LintId::of(large_const_arrays::LARGE_CONST_ARRAYS)), + Some(LintId::of(large_enum_variant::LARGE_ENUM_VARIANT)), + Some(LintId::of(len_zero::COMPARISON_TO_EMPTY)), + Some(LintId::of(len_zero::LEN_WITHOUT_IS_EMPTY)), + Some(LintId::of(len_zero::LEN_ZERO)), + Some(LintId::of(let_underscore::LET_UNDERSCORE_LOCK)), + Some(LintId::of(lifetimes::EXTRA_UNUSED_LIFETIMES)), + Some(LintId::of(lifetimes::NEEDLESS_LIFETIMES)), + Some(LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING)), + Some(LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES)), + Some(LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS)), + Some(LintId::of(loops::EMPTY_LOOP)), + Some(LintId::of(loops::EXPLICIT_COUNTER_LOOP)), + Some(LintId::of(loops::FOR_KV_MAP)), + Some(LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES)), + Some(LintId::of(loops::ITER_NEXT_LOOP)), + Some(LintId::of(loops::MANUAL_FLATTEN)), + Some(LintId::of(loops::MANUAL_MEMCPY)), + Some(LintId::of(loops::MUT_RANGE_BOUND)), + Some(LintId::of(loops::NEEDLESS_COLLECT)), + Some(LintId::of(loops::NEEDLESS_RANGE_LOOP)), + Some(LintId::of(loops::NEVER_LOOP)), + Some(LintId::of(loops::SAME_ITEM_PUSH)), + Some(LintId::of(loops::SINGLE_ELEMENT_LOOP)), + Some(LintId::of(loops::WHILE_IMMUTABLE_CONDITION)), + Some(LintId::of(loops::WHILE_LET_LOOP)), + Some(LintId::of(loops::WHILE_LET_ON_ITERATOR)), + Some(LintId::of(main_recursion::MAIN_RECURSION)), + Some(LintId::of(manual_async_fn::MANUAL_ASYNC_FN)), + Some(LintId::of(manual_bits::MANUAL_BITS)), + Some(LintId::of(manual_map::MANUAL_MAP)), + Some(LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE)), + Some(LintId::of(manual_strip::MANUAL_STRIP)), + Some(LintId::of(manual_unwrap_or::MANUAL_UNWRAP_OR)), + Some(LintId::of(map_clone::MAP_CLONE)), + Some(LintId::of(map_unit_fn::OPTION_MAP_UNIT_FN)), + Some(LintId::of(map_unit_fn::RESULT_MAP_UNIT_FN)), + Some(LintId::of(match_result_ok::MATCH_RESULT_OK)), + Some(LintId::of(match_str_case_mismatch::MATCH_STR_CASE_MISMATCH)), + Some(LintId::of(matches::INFALLIBLE_DESTRUCTURING_MATCH)), + Some(LintId::of(matches::MATCH_AS_REF)), + Some(LintId::of(matches::MATCH_LIKE_MATCHES_MACRO)), + Some(LintId::of(matches::MATCH_OVERLAPPING_ARM)), + Some(LintId::of(matches::MATCH_REF_PATS)), + Some(LintId::of(matches::MATCH_SINGLE_BINDING)), + Some(LintId::of(matches::REDUNDANT_PATTERN_MATCHING)), + Some(LintId::of(matches::SINGLE_MATCH)), + Some(LintId::of(matches::WILDCARD_IN_OR_PATTERNS)), + Some(LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE)), + Some(LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT)), + Some(LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT)), + Some(LintId::of(methods::BIND_INSTEAD_OF_MAP)), + Some(LintId::of(methods::BYTES_NTH)), + Some(LintId::of(methods::CHARS_LAST_CMP)), + Some(LintId::of(methods::CHARS_NEXT_CMP)), + Some(LintId::of(methods::CLONE_DOUBLE_REF)), + Some(LintId::of(methods::CLONE_ON_COPY)), + Some(LintId::of(methods::EXPECT_FUN_CALL)), + Some(LintId::of(methods::EXTEND_WITH_DRAIN)), + Some(LintId::of(methods::FILTER_MAP_IDENTITY)), + Some(LintId::of(methods::FILTER_NEXT)), + Some(LintId::of(methods::FLAT_MAP_IDENTITY)), + Some(LintId::of(methods::INSPECT_FOR_EACH)), + Some(LintId::of(methods::INTO_ITER_ON_REF)), + Some(LintId::of(methods::ITERATOR_STEP_BY_ZERO)), + Some(LintId::of(methods::ITER_CLONED_COLLECT)), + Some(LintId::of(methods::ITER_COUNT)), + Some(LintId::of(methods::ITER_NEXT_SLICE)), + Some(LintId::of(methods::ITER_NTH)), + Some(LintId::of(methods::ITER_NTH_ZERO)), + Some(LintId::of(methods::ITER_OVEREAGER_CLONED)), + Some(LintId::of(methods::ITER_SKIP_NEXT)), + Some(LintId::of(methods::MANUAL_FILTER_MAP)), + Some(LintId::of(methods::MANUAL_FIND_MAP)), + Some(LintId::of(methods::MANUAL_SATURATING_ARITHMETIC)), + Some(LintId::of(methods::MANUAL_SPLIT_ONCE)), + Some(LintId::of(methods::MANUAL_STR_REPEAT)), + Some(LintId::of(methods::MAP_COLLECT_RESULT_UNIT)), + Some(LintId::of(methods::MAP_FLATTEN)), + Some(LintId::of(methods::MAP_IDENTITY)), + Some(LintId::of(methods::NEEDLESS_SPLITN)), + Some(LintId::of(methods::NEW_RET_NO_SELF)), + Some(LintId::of(methods::OK_EXPECT)), + Some(LintId::of(methods::OPTION_AS_REF_DEREF)), + Some(LintId::of(methods::OPTION_FILTER_MAP)), + Some(LintId::of(methods::OPTION_MAP_OR_NONE)), + Some(LintId::of(methods::OR_FUN_CALL)), + Some(LintId::of(methods::RESULT_MAP_OR_INTO_OPTION)), + Some(LintId::of(methods::SEARCH_IS_SOME)), + Some(LintId::of(methods::SHOULD_IMPLEMENT_TRAIT)), + Some(LintId::of(methods::SINGLE_CHAR_ADD_STR)), + Some(LintId::of(methods::SINGLE_CHAR_PATTERN)), + Some(LintId::of(methods::SKIP_WHILE_NEXT)), + Some(LintId::of(methods::STRING_EXTEND_CHARS)), + Some(LintId::of(methods::SUSPICIOUS_MAP)), + Some(LintId::of(methods::SUSPICIOUS_SPLITN)), + Some(LintId::of(methods::UNINIT_ASSUMED_INIT)), + Some(LintId::of(methods::UNNECESSARY_FILTER_MAP)), + Some(LintId::of(methods::UNNECESSARY_FOLD)), + Some(LintId::of(methods::UNNECESSARY_LAZY_EVALUATIONS)), + Some(LintId::of(methods::UNNECESSARY_TO_OWNED)), + Some(LintId::of(methods::UNWRAP_OR_ELSE_DEFAULT)), + Some(LintId::of(methods::USELESS_ASREF)), + Some(LintId::of(methods::WRONG_SELF_CONVENTION)), + Some(LintId::of(methods::ZST_OFFSET)), + Some(LintId::of(minmax::MIN_MAX)), + Some(LintId::of(misc::CMP_NAN)), + Some(LintId::of(misc::CMP_OWNED)), + Some(LintId::of(misc::MODULO_ONE)), + Some(LintId::of(misc::SHORT_CIRCUIT_STATEMENT)), + Some(LintId::of(misc::TOPLEVEL_REF_ARG)), + Some(LintId::of(misc::ZERO_PTR)), + Some(LintId::of(misc_early::BUILTIN_TYPE_SHADOW)), + Some(LintId::of(misc_early::DOUBLE_NEG)), + Some(LintId::of(misc_early::DUPLICATE_UNDERSCORE_ARGUMENT)), + Some(LintId::of(misc_early::MIXED_CASE_HEX_LITERALS)), + Some(LintId::of(misc_early::REDUNDANT_PATTERN)), + Some(LintId::of(misc_early::UNNEEDED_WILDCARD_PATTERN)), + Some(LintId::of(misc_early::ZERO_PREFIXED_LITERAL)), + Some(LintId::of(mut_key::MUTABLE_KEY_TYPE)), + Some(LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK)), + Some(LintId::of(mut_reference::UNNECESSARY_MUT_PASSED)), + Some(LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE)), + Some(LintId::of(needless_bool::BOOL_COMPARISON)), + Some(LintId::of(needless_bool::NEEDLESS_BOOL)), + Some(LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE)), + Some(LintId::of(needless_late_init::NEEDLESS_LATE_INIT)), + Some(LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF)), + Some(LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK)), + Some(LintId::of(needless_update::NEEDLESS_UPDATE)), + Some(LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD)), + Some(LintId::of(neg_multiply::NEG_MULTIPLY)), + Some(LintId::of(new_without_default::NEW_WITHOUT_DEFAULT)), + Some(LintId::of(no_effect::NO_EFFECT)), + Some(LintId::of(no_effect::UNNECESSARY_OPERATION)), + Some(LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST)), + Some(LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST)), + Some(LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS)), + Some(LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS)), + Some(LintId::of(octal_escapes::OCTAL_ESCAPES)), + Some(LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS)), + Some(LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP)), + Some(LintId::of(overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL)), + Some(LintId::of(partialeq_ne_impl::PARTIALEQ_NE_IMPL)), + Some(LintId::of(precedence::PRECEDENCE)), + Some(LintId::of(ptr::CMP_NULL)), + Some(LintId::of(ptr::INVALID_NULL_PTR_USAGE)), + Some(LintId::of(ptr::MUT_FROM_REF)), + Some(LintId::of(ptr::PTR_ARG)), + Some(LintId::of(ptr_eq::PTR_EQ)), + Some(LintId::of(ptr_offset_with_cast::PTR_OFFSET_WITH_CAST)), + Some(LintId::of(question_mark::QUESTION_MARK)), + Some(LintId::of(ranges::MANUAL_RANGE_CONTAINS)), + Some(LintId::of(ranges::RANGE_ZIP_WITH_LEN)), + Some(LintId::of(ranges::REVERSED_EMPTY_RANGES)), + Some(LintId::of(redundant_clone::REDUNDANT_CLONE)), + Some(LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL)), + Some(LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES)), + Some(LintId::of(redundant_slicing::REDUNDANT_SLICING)), + Some(LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES)), + Some(LintId::of(reference::DEREF_ADDROF)), + Some(LintId::of(regex::INVALID_REGEX)), + Some(LintId::of(repeat_once::REPEAT_ONCE)), + Some(LintId::of(returns::LET_AND_RETURN)), + Some(LintId::of(returns::NEEDLESS_RETURN)), + Some(LintId::of(self_assignment::SELF_ASSIGNMENT)), + Some(LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS)), + Some(LintId::of(serde_api::SERDE_API_MISUSE)), + Some(LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS)), + Some(LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT)), + Some(LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION)), + Some(LintId::of(stable_sort_primitive::STABLE_SORT_PRIMITIVE)), + Some(LintId::of(strings::STRING_FROM_UTF8_AS_BYTES)), + Some(LintId::of(strlen_on_c_strings::STRLEN_ON_C_STRINGS)), + Some(LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL)), + Some(LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL)), + Some(LintId::of(swap::ALMOST_SWAPPED)), + Some(LintId::of(swap::MANUAL_SWAP)), + Some(LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS)), + Some(LintId::of(temporary_assignment::TEMPORARY_ASSIGNMENT)), + Some(LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME)), + Some(LintId::of(to_string_in_display::TO_STRING_IN_DISPLAY)), + Some(LintId::of(transmute::CROSSPOINTER_TRANSMUTE)), + Some(LintId::of(transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS)), + Some(LintId::of(transmute::TRANSMUTE_BYTES_TO_STR)), + Some(LintId::of(transmute::TRANSMUTE_FLOAT_TO_INT)), + Some(LintId::of(transmute::TRANSMUTE_INT_TO_BOOL)), + Some(LintId::of(transmute::TRANSMUTE_INT_TO_CHAR)), + Some(LintId::of(transmute::TRANSMUTE_INT_TO_FLOAT)), + Some(LintId::of(transmute::TRANSMUTE_NUM_TO_BYTES)), + Some(LintId::of(transmute::TRANSMUTE_PTR_TO_REF)), + Some(LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR)), + Some(LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE)), + Some(LintId::of(transmute::WRONG_TRANSMUTE)), + Some(LintId::of(transmuting_null::TRANSMUTING_NULL)), + Some(LintId::of(try_err::TRY_ERR)), + Some(LintId::of(types::BORROWED_BOX)), + Some(LintId::of(types::BOX_COLLECTION)), + Some(LintId::of(types::REDUNDANT_ALLOCATION)), + Some(LintId::of(types::TYPE_COMPLEXITY)), + Some(LintId::of(types::VEC_BOX)), + Some(LintId::of(undropped_manually_drops::UNDROPPED_MANUALLY_DROPS)), + Some(LintId::of(unicode::INVISIBLE_CHARACTERS)), + Some(LintId::of(uninit_vec::UNINIT_VEC)), + Some(LintId::of(unit_hash::UNIT_HASH)), + Some(LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD)), + Some(LintId::of(unit_types::UNIT_ARG)), + Some(LintId::of(unit_types::UNIT_CMP)), + Some(LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS)), + Some(LintId::of(unnamed_address::VTABLE_ADDRESS_COMPARISONS)), + Some(LintId::of(unnecessary_sort_by::UNNECESSARY_SORT_BY)), + Some(LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME)), + Some(LintId::of(unused_io_amount::UNUSED_IO_AMOUNT)), + Some(LintId::of(unused_unit::UNUSED_UNIT)), + Some(LintId::of(unwrap::PANICKING_UNWRAP)), + Some(LintId::of(unwrap::UNNECESSARY_UNWRAP)), + Some(LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS)), + Some(LintId::of(useless_conversion::USELESS_CONVERSION)), + Some(LintId::of(vec::USELESS_VEC)), + Some(LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH)), + Some(LintId::of(vec_resize_to_zero::VEC_RESIZE_TO_ZERO)), + Some(LintId::of(write::PRINTLN_EMPTY_STRING)), + Some(LintId::of(write::PRINT_LITERAL)), + Some(LintId::of(write::PRINT_WITH_NEWLINE)), + Some(LintId::of(write::WRITELN_EMPTY_STRING)), + Some(LintId::of(write::WRITE_LITERAL)), + Some(LintId::of(write::WRITE_WITH_NEWLINE)), + Some(LintId::of(zero_div_zero::ZERO_DIVIDED_BY_ZERO)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_cargo.rs b/clippy_lints/src/lib.register_cargo.rs index c890523fe5ae..017b75ee79ac 100644 --- a/clippy_lints/src/lib.register_cargo.rs +++ b/clippy_lints/src/lib.register_cargo.rs @@ -2,10 +2,10 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::cargo", Some("clippy_cargo"), vec![ - LintId::of(cargo::CARGO_COMMON_METADATA), - LintId::of(cargo::MULTIPLE_CRATE_VERSIONS), - LintId::of(cargo::NEGATIVE_FEATURE_NAMES), - LintId::of(cargo::REDUNDANT_FEATURE_NAMES), - LintId::of(cargo::WILDCARD_DEPENDENCIES), -]) +store.register_group(true, "clippy::cargo", Some("clippy_cargo"), [ + Some(LintId::of(cargo::CARGO_COMMON_METADATA)), + Some(LintId::of(cargo::MULTIPLE_CRATE_VERSIONS)), + Some(LintId::of(cargo::NEGATIVE_FEATURE_NAMES)), + Some(LintId::of(cargo::REDUNDANT_FEATURE_NAMES)), + Some(LintId::of(cargo::WILDCARD_DEPENDENCIES)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_complexity.rs b/clippy_lints/src/lib.register_complexity.rs index bd5ff613447c..97bd7fd963a6 100644 --- a/clippy_lints/src/lib.register_complexity.rs +++ b/clippy_lints/src/lib.register_complexity.rs @@ -2,95 +2,95 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![ - LintId::of(attrs::DEPRECATED_CFG_ATTR), - LintId::of(booleans::NONMINIMAL_BOOL), - LintId::of(casts::CHAR_LIT_AS_U8), - LintId::of(casts::UNNECESSARY_CAST), - LintId::of(derivable_impls::DERIVABLE_IMPLS), - LintId::of(double_comparison::DOUBLE_COMPARISONS), - LintId::of(double_parens::DOUBLE_PARENS), - LintId::of(duration_subsec::DURATION_SUBSEC), - LintId::of(eval_order_dependence::DIVERGING_SUB_EXPRESSION), - LintId::of(explicit_write::EXPLICIT_WRITE), - LintId::of(format::USELESS_FORMAT), - LintId::of(functions::TOO_MANY_ARGUMENTS), - LintId::of(get_last_with_len::GET_LAST_WITH_LEN), - LintId::of(identity_op::IDENTITY_OP), - LintId::of(int_plus_one::INT_PLUS_ONE), - LintId::of(lifetimes::EXTRA_UNUSED_LIFETIMES), - LintId::of(lifetimes::NEEDLESS_LIFETIMES), - LintId::of(loops::EXPLICIT_COUNTER_LOOP), - LintId::of(loops::MANUAL_FLATTEN), - LintId::of(loops::SINGLE_ELEMENT_LOOP), - LintId::of(loops::WHILE_LET_LOOP), - LintId::of(manual_strip::MANUAL_STRIP), - LintId::of(manual_unwrap_or::MANUAL_UNWRAP_OR), - LintId::of(map_unit_fn::OPTION_MAP_UNIT_FN), - LintId::of(map_unit_fn::RESULT_MAP_UNIT_FN), - LintId::of(matches::MATCH_AS_REF), - LintId::of(matches::MATCH_SINGLE_BINDING), - LintId::of(matches::WILDCARD_IN_OR_PATTERNS), - LintId::of(methods::BIND_INSTEAD_OF_MAP), - LintId::of(methods::CLONE_ON_COPY), - LintId::of(methods::FILTER_MAP_IDENTITY), - LintId::of(methods::FILTER_NEXT), - LintId::of(methods::FLAT_MAP_IDENTITY), - LintId::of(methods::INSPECT_FOR_EACH), - LintId::of(methods::ITER_COUNT), - LintId::of(methods::MANUAL_FILTER_MAP), - LintId::of(methods::MANUAL_FIND_MAP), - LintId::of(methods::MANUAL_SPLIT_ONCE), - LintId::of(methods::MAP_FLATTEN), - LintId::of(methods::MAP_IDENTITY), - LintId::of(methods::NEEDLESS_SPLITN), - LintId::of(methods::OPTION_AS_REF_DEREF), - LintId::of(methods::OPTION_FILTER_MAP), - LintId::of(methods::SEARCH_IS_SOME), - LintId::of(methods::SKIP_WHILE_NEXT), - LintId::of(methods::UNNECESSARY_FILTER_MAP), - LintId::of(methods::USELESS_ASREF), - LintId::of(misc::SHORT_CIRCUIT_STATEMENT), - LintId::of(misc_early::UNNEEDED_WILDCARD_PATTERN), - LintId::of(misc_early::ZERO_PREFIXED_LITERAL), - LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE), - LintId::of(needless_bool::BOOL_COMPARISON), - LintId::of(needless_bool::NEEDLESS_BOOL), - LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE), - LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF), - LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK), - LintId::of(needless_update::NEEDLESS_UPDATE), - LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD), - LintId::of(no_effect::NO_EFFECT), - LintId::of(no_effect::UNNECESSARY_OPERATION), - LintId::of(overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL), - LintId::of(partialeq_ne_impl::PARTIALEQ_NE_IMPL), - LintId::of(precedence::PRECEDENCE), - LintId::of(ptr_offset_with_cast::PTR_OFFSET_WITH_CAST), - LintId::of(ranges::RANGE_ZIP_WITH_LEN), - LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL), - LintId::of(redundant_slicing::REDUNDANT_SLICING), - LintId::of(reference::DEREF_ADDROF), - LintId::of(repeat_once::REPEAT_ONCE), - LintId::of(strings::STRING_FROM_UTF8_AS_BYTES), - LintId::of(strlen_on_c_strings::STRLEN_ON_C_STRINGS), - LintId::of(swap::MANUAL_SWAP), - LintId::of(temporary_assignment::TEMPORARY_ASSIGNMENT), - LintId::of(transmute::CROSSPOINTER_TRANSMUTE), - LintId::of(transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS), - LintId::of(transmute::TRANSMUTE_BYTES_TO_STR), - LintId::of(transmute::TRANSMUTE_FLOAT_TO_INT), - LintId::of(transmute::TRANSMUTE_INT_TO_BOOL), - LintId::of(transmute::TRANSMUTE_INT_TO_CHAR), - LintId::of(transmute::TRANSMUTE_INT_TO_FLOAT), - LintId::of(transmute::TRANSMUTE_NUM_TO_BYTES), - LintId::of(transmute::TRANSMUTE_PTR_TO_REF), - LintId::of(types::BORROWED_BOX), - LintId::of(types::TYPE_COMPLEXITY), - LintId::of(types::VEC_BOX), - LintId::of(unit_types::UNIT_ARG), - LintId::of(unnecessary_sort_by::UNNECESSARY_SORT_BY), - LintId::of(unwrap::UNNECESSARY_UNWRAP), - LintId::of(useless_conversion::USELESS_CONVERSION), - LintId::of(zero_div_zero::ZERO_DIVIDED_BY_ZERO), -]) +store.register_group(true, "clippy::complexity", Some("clippy_complexity"), [ + Some(LintId::of(attrs::DEPRECATED_CFG_ATTR)), + Some(LintId::of(booleans::NONMINIMAL_BOOL)), + Some(LintId::of(casts::CHAR_LIT_AS_U8)), + Some(LintId::of(casts::UNNECESSARY_CAST)), + Some(LintId::of(derivable_impls::DERIVABLE_IMPLS)), + Some(LintId::of(double_comparison::DOUBLE_COMPARISONS)), + Some(LintId::of(double_parens::DOUBLE_PARENS)), + Some(LintId::of(duration_subsec::DURATION_SUBSEC)), + Some(LintId::of(eval_order_dependence::DIVERGING_SUB_EXPRESSION)), + Some(LintId::of(explicit_write::EXPLICIT_WRITE)), + Some(LintId::of(format::USELESS_FORMAT)), + Some(LintId::of(functions::TOO_MANY_ARGUMENTS)), + Some(LintId::of(get_last_with_len::GET_LAST_WITH_LEN)), + Some(LintId::of(identity_op::IDENTITY_OP)), + Some(LintId::of(int_plus_one::INT_PLUS_ONE)), + Some(LintId::of(lifetimes::EXTRA_UNUSED_LIFETIMES)), + Some(LintId::of(lifetimes::NEEDLESS_LIFETIMES)), + Some(LintId::of(loops::EXPLICIT_COUNTER_LOOP)), + Some(LintId::of(loops::MANUAL_FLATTEN)), + Some(LintId::of(loops::SINGLE_ELEMENT_LOOP)), + Some(LintId::of(loops::WHILE_LET_LOOP)), + Some(LintId::of(manual_strip::MANUAL_STRIP)), + Some(LintId::of(manual_unwrap_or::MANUAL_UNWRAP_OR)), + Some(LintId::of(map_unit_fn::OPTION_MAP_UNIT_FN)), + Some(LintId::of(map_unit_fn::RESULT_MAP_UNIT_FN)), + Some(LintId::of(matches::MATCH_AS_REF)), + Some(LintId::of(matches::MATCH_SINGLE_BINDING)), + Some(LintId::of(matches::WILDCARD_IN_OR_PATTERNS)), + Some(LintId::of(methods::BIND_INSTEAD_OF_MAP)), + Some(LintId::of(methods::CLONE_ON_COPY)), + Some(LintId::of(methods::FILTER_MAP_IDENTITY)), + Some(LintId::of(methods::FILTER_NEXT)), + Some(LintId::of(methods::FLAT_MAP_IDENTITY)), + Some(LintId::of(methods::INSPECT_FOR_EACH)), + Some(LintId::of(methods::ITER_COUNT)), + Some(LintId::of(methods::MANUAL_FILTER_MAP)), + Some(LintId::of(methods::MANUAL_FIND_MAP)), + Some(LintId::of(methods::MANUAL_SPLIT_ONCE)), + Some(LintId::of(methods::MAP_FLATTEN)), + Some(LintId::of(methods::MAP_IDENTITY)), + Some(LintId::of(methods::NEEDLESS_SPLITN)), + Some(LintId::of(methods::OPTION_AS_REF_DEREF)), + Some(LintId::of(methods::OPTION_FILTER_MAP)), + Some(LintId::of(methods::SEARCH_IS_SOME)), + Some(LintId::of(methods::SKIP_WHILE_NEXT)), + Some(LintId::of(methods::UNNECESSARY_FILTER_MAP)), + Some(LintId::of(methods::USELESS_ASREF)), + Some(LintId::of(misc::SHORT_CIRCUIT_STATEMENT)), + Some(LintId::of(misc_early::UNNEEDED_WILDCARD_PATTERN)), + Some(LintId::of(misc_early::ZERO_PREFIXED_LITERAL)), + Some(LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE)), + Some(LintId::of(needless_bool::BOOL_COMPARISON)), + Some(LintId::of(needless_bool::NEEDLESS_BOOL)), + Some(LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE)), + Some(LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF)), + Some(LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK)), + Some(LintId::of(needless_update::NEEDLESS_UPDATE)), + Some(LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD)), + Some(LintId::of(no_effect::NO_EFFECT)), + Some(LintId::of(no_effect::UNNECESSARY_OPERATION)), + Some(LintId::of(overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL)), + Some(LintId::of(partialeq_ne_impl::PARTIALEQ_NE_IMPL)), + Some(LintId::of(precedence::PRECEDENCE)), + Some(LintId::of(ptr_offset_with_cast::PTR_OFFSET_WITH_CAST)), + Some(LintId::of(ranges::RANGE_ZIP_WITH_LEN)), + Some(LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL)), + Some(LintId::of(redundant_slicing::REDUNDANT_SLICING)), + Some(LintId::of(reference::DEREF_ADDROF)), + Some(LintId::of(repeat_once::REPEAT_ONCE)), + Some(LintId::of(strings::STRING_FROM_UTF8_AS_BYTES)), + Some(LintId::of(strlen_on_c_strings::STRLEN_ON_C_STRINGS)), + Some(LintId::of(swap::MANUAL_SWAP)), + Some(LintId::of(temporary_assignment::TEMPORARY_ASSIGNMENT)), + Some(LintId::of(transmute::CROSSPOINTER_TRANSMUTE)), + Some(LintId::of(transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS)), + Some(LintId::of(transmute::TRANSMUTE_BYTES_TO_STR)), + Some(LintId::of(transmute::TRANSMUTE_FLOAT_TO_INT)), + Some(LintId::of(transmute::TRANSMUTE_INT_TO_BOOL)), + Some(LintId::of(transmute::TRANSMUTE_INT_TO_CHAR)), + Some(LintId::of(transmute::TRANSMUTE_INT_TO_FLOAT)), + Some(LintId::of(transmute::TRANSMUTE_NUM_TO_BYTES)), + Some(LintId::of(transmute::TRANSMUTE_PTR_TO_REF)), + Some(LintId::of(types::BORROWED_BOX)), + Some(LintId::of(types::TYPE_COMPLEXITY)), + Some(LintId::of(types::VEC_BOX)), + Some(LintId::of(unit_types::UNIT_ARG)), + Some(LintId::of(unnecessary_sort_by::UNNECESSARY_SORT_BY)), + Some(LintId::of(unwrap::UNNECESSARY_UNWRAP)), + Some(LintId::of(useless_conversion::USELESS_CONVERSION)), + Some(LintId::of(zero_div_zero::ZERO_DIVIDED_BY_ZERO)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_correctness.rs b/clippy_lints/src/lib.register_correctness.rs index d013daa8e082..7cce7f29b60e 100644 --- a/clippy_lints/src/lib.register_correctness.rs +++ b/clippy_lints/src/lib.register_correctness.rs @@ -2,75 +2,75 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::correctness", Some("clippy_correctness"), vec![ - LintId::of(absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS), - LintId::of(approx_const::APPROX_CONSTANT), - LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC), - LintId::of(attrs::DEPRECATED_SEMVER), - LintId::of(attrs::MISMATCHED_TARGET_OS), - LintId::of(attrs::USELESS_ATTRIBUTE), - LintId::of(bit_mask::BAD_BIT_MASK), - LintId::of(bit_mask::INEFFECTIVE_BIT_MASK), - LintId::of(booleans::LOGIC_BUG), - LintId::of(casts::CAST_REF_TO_MUT), - LintId::of(copies::IFS_SAME_COND), - LintId::of(copies::IF_SAME_THEN_ELSE), - LintId::of(derive::DERIVE_HASH_XOR_EQ), - LintId::of(derive::DERIVE_ORD_XOR_PARTIAL_ORD), - LintId::of(drop_forget_ref::DROP_COPY), - LintId::of(drop_forget_ref::DROP_REF), - LintId::of(drop_forget_ref::FORGET_COPY), - LintId::of(drop_forget_ref::FORGET_REF), - LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT), - LintId::of(eq_op::EQ_OP), - LintId::of(erasing_op::ERASING_OP), - LintId::of(formatting::POSSIBLE_MISSING_COMMA), - LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF), - LintId::of(if_let_mutex::IF_LET_MUTEX), - LintId::of(indexing_slicing::OUT_OF_BOUNDS_INDEXING), - LintId::of(infinite_iter::INFINITE_ITER), - LintId::of(inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY), - LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY), - LintId::of(let_underscore::LET_UNDERSCORE_LOCK), - LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES), - LintId::of(loops::ITER_NEXT_LOOP), - LintId::of(loops::NEVER_LOOP), - LintId::of(loops::WHILE_IMMUTABLE_CONDITION), - LintId::of(match_str_case_mismatch::MATCH_STR_CASE_MISMATCH), - LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT), - LintId::of(methods::CLONE_DOUBLE_REF), - LintId::of(methods::ITERATOR_STEP_BY_ZERO), - LintId::of(methods::SUSPICIOUS_SPLITN), - LintId::of(methods::UNINIT_ASSUMED_INIT), - LintId::of(methods::ZST_OFFSET), - LintId::of(minmax::MIN_MAX), - LintId::of(misc::CMP_NAN), - LintId::of(misc::MODULO_ONE), - LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS), - LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS), - LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP), - LintId::of(ptr::INVALID_NULL_PTR_USAGE), - LintId::of(ptr::MUT_FROM_REF), - LintId::of(ranges::REVERSED_EMPTY_RANGES), - LintId::of(regex::INVALID_REGEX), - LintId::of(self_assignment::SELF_ASSIGNMENT), - LintId::of(serde_api::SERDE_API_MISUSE), - LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT), - LintId::of(swap::ALMOST_SWAPPED), - LintId::of(to_string_in_display::TO_STRING_IN_DISPLAY), - LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR), - LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE), - LintId::of(transmute::WRONG_TRANSMUTE), - LintId::of(transmuting_null::TRANSMUTING_NULL), - LintId::of(undropped_manually_drops::UNDROPPED_MANUALLY_DROPS), - LintId::of(unicode::INVISIBLE_CHARACTERS), - LintId::of(uninit_vec::UNINIT_VEC), - LintId::of(unit_hash::UNIT_HASH), - LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD), - LintId::of(unit_types::UNIT_CMP), - LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS), - LintId::of(unnamed_address::VTABLE_ADDRESS_COMPARISONS), - LintId::of(unused_io_amount::UNUSED_IO_AMOUNT), - LintId::of(unwrap::PANICKING_UNWRAP), - LintId::of(vec_resize_to_zero::VEC_RESIZE_TO_ZERO), -]) +store.register_group(true, "clippy::correctness", Some("clippy_correctness"), [ + Some(LintId::of(absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS)), + Some(LintId::of(approx_const::APPROX_CONSTANT)), + Some(LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC)), + Some(LintId::of(attrs::DEPRECATED_SEMVER)), + Some(LintId::of(attrs::MISMATCHED_TARGET_OS)), + Some(LintId::of(attrs::USELESS_ATTRIBUTE)), + Some(LintId::of(bit_mask::BAD_BIT_MASK)), + Some(LintId::of(bit_mask::INEFFECTIVE_BIT_MASK)), + Some(LintId::of(booleans::LOGIC_BUG)), + Some(LintId::of(casts::CAST_REF_TO_MUT)), + Some(LintId::of(copies::IFS_SAME_COND)), + Some(LintId::of(copies::IF_SAME_THEN_ELSE)), + Some(LintId::of(derive::DERIVE_HASH_XOR_EQ)), + Some(LintId::of(derive::DERIVE_ORD_XOR_PARTIAL_ORD)), + Some(LintId::of(drop_forget_ref::DROP_COPY)), + Some(LintId::of(drop_forget_ref::DROP_REF)), + Some(LintId::of(drop_forget_ref::FORGET_COPY)), + Some(LintId::of(drop_forget_ref::FORGET_REF)), + Some(LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT)), + Some(LintId::of(eq_op::EQ_OP)), + Some(LintId::of(erasing_op::ERASING_OP)), + Some(LintId::of(formatting::POSSIBLE_MISSING_COMMA)), + Some(LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF)), + Some(LintId::of(if_let_mutex::IF_LET_MUTEX)), + Some(LintId::of(indexing_slicing::OUT_OF_BOUNDS_INDEXING)), + Some(LintId::of(infinite_iter::INFINITE_ITER)), + Some(LintId::of(inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY)), + Some(LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY)), + Some(LintId::of(let_underscore::LET_UNDERSCORE_LOCK)), + Some(LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES)), + Some(LintId::of(loops::ITER_NEXT_LOOP)), + Some(LintId::of(loops::NEVER_LOOP)), + Some(LintId::of(loops::WHILE_IMMUTABLE_CONDITION)), + Some(LintId::of(match_str_case_mismatch::MATCH_STR_CASE_MISMATCH)), + Some(LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT)), + Some(LintId::of(methods::CLONE_DOUBLE_REF)), + Some(LintId::of(methods::ITERATOR_STEP_BY_ZERO)), + Some(LintId::of(methods::SUSPICIOUS_SPLITN)), + Some(LintId::of(methods::UNINIT_ASSUMED_INIT)), + Some(LintId::of(methods::ZST_OFFSET)), + Some(LintId::of(minmax::MIN_MAX)), + Some(LintId::of(misc::CMP_NAN)), + Some(LintId::of(misc::MODULO_ONE)), + Some(LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS)), + Some(LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS)), + Some(LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP)), + Some(LintId::of(ptr::INVALID_NULL_PTR_USAGE)), + Some(LintId::of(ptr::MUT_FROM_REF)), + Some(LintId::of(ranges::REVERSED_EMPTY_RANGES)), + Some(LintId::of(regex::INVALID_REGEX)), + Some(LintId::of(self_assignment::SELF_ASSIGNMENT)), + Some(LintId::of(serde_api::SERDE_API_MISUSE)), + Some(LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT)), + Some(LintId::of(swap::ALMOST_SWAPPED)), + Some(LintId::of(to_string_in_display::TO_STRING_IN_DISPLAY)), + Some(LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR)), + Some(LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE)), + Some(LintId::of(transmute::WRONG_TRANSMUTE)), + Some(LintId::of(transmuting_null::TRANSMUTING_NULL)), + Some(LintId::of(undropped_manually_drops::UNDROPPED_MANUALLY_DROPS)), + Some(LintId::of(unicode::INVISIBLE_CHARACTERS)), + Some(LintId::of(uninit_vec::UNINIT_VEC)), + Some(LintId::of(unit_hash::UNIT_HASH)), + Some(LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD)), + Some(LintId::of(unit_types::UNIT_CMP)), + Some(LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS)), + Some(LintId::of(unnamed_address::VTABLE_ADDRESS_COMPARISONS)), + Some(LintId::of(unused_io_amount::UNUSED_IO_AMOUNT)), + Some(LintId::of(unwrap::PANICKING_UNWRAP)), + Some(LintId::of(vec_resize_to_zero::VEC_RESIZE_TO_ZERO)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_internal.rs b/clippy_lints/src/lib.register_internal.rs index 7d4c7d2adb5b..8910cb44b927 100644 --- a/clippy_lints/src/lib.register_internal.rs +++ b/clippy_lints/src/lib.register_internal.rs @@ -2,19 +2,19 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![ - LintId::of(utils::internal_lints::CLIPPY_LINTS_INTERNAL), - LintId::of(utils::internal_lints::COLLAPSIBLE_SPAN_LINT_CALLS), - LintId::of(utils::internal_lints::COMPILER_LINT_FUNCTIONS), - LintId::of(utils::internal_lints::DEFAULT_LINT), - LintId::of(utils::internal_lints::IF_CHAIN_STYLE), - LintId::of(utils::internal_lints::INTERNING_DEFINED_SYMBOL), - LintId::of(utils::internal_lints::INVALID_CLIPPY_VERSION_ATTRIBUTE), - LintId::of(utils::internal_lints::INVALID_PATHS), - LintId::of(utils::internal_lints::LINT_WITHOUT_LINT_PASS), - LintId::of(utils::internal_lints::MATCH_TYPE_ON_DIAGNOSTIC_ITEM), - LintId::of(utils::internal_lints::MISSING_CLIPPY_VERSION_ATTRIBUTE), - LintId::of(utils::internal_lints::OUTER_EXPN_EXPN_DATA), - LintId::of(utils::internal_lints::PRODUCE_ICE), - LintId::of(utils::internal_lints::UNNECESSARY_SYMBOL_STR), -]) +store.register_group(true, "clippy::internal", Some("clippy_internal"), [ + Some(LintId::of(utils::internal_lints::CLIPPY_LINTS_INTERNAL)), + Some(LintId::of(utils::internal_lints::COLLAPSIBLE_SPAN_LINT_CALLS)), + Some(LintId::of(utils::internal_lints::COMPILER_LINT_FUNCTIONS)), + Some(LintId::of(utils::internal_lints::DEFAULT_LINT)), + Some(LintId::of(utils::internal_lints::IF_CHAIN_STYLE)), + Some(LintId::of(utils::internal_lints::INTERNING_DEFINED_SYMBOL)), + Some(LintId::of(utils::internal_lints::INVALID_CLIPPY_VERSION_ATTRIBUTE)), + Some(LintId::of(utils::internal_lints::INVALID_PATHS)), + Some(LintId::of(utils::internal_lints::LINT_WITHOUT_LINT_PASS)), + Some(LintId::of(utils::internal_lints::MATCH_TYPE_ON_DIAGNOSTIC_ITEM)), + Some(LintId::of(utils::internal_lints::MISSING_CLIPPY_VERSION_ATTRIBUTE)), + Some(LintId::of(utils::internal_lints::OUTER_EXPN_EXPN_DATA)), + Some(LintId::of(utils::internal_lints::PRODUCE_ICE)), + Some(LintId::of(utils::internal_lints::UNNECESSARY_SYMBOL_STR)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_nursery.rs b/clippy_lints/src/lib.register_nursery.rs index a73537901002..8f0864b7d6db 100644 --- a/clippy_lints/src/lib.register_nursery.rs +++ b/clippy_lints/src/lib.register_nursery.rs @@ -2,30 +2,30 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![ - LintId::of(attrs::EMPTY_LINE_AFTER_OUTER_ATTR), - LintId::of(cognitive_complexity::COGNITIVE_COMPLEXITY), - LintId::of(copies::BRANCHES_SHARING_CODE), - LintId::of(equatable_if_let::EQUATABLE_IF_LET), - LintId::of(fallible_impl_from::FALLIBLE_IMPL_FROM), - LintId::of(floating_point_arithmetic::IMPRECISE_FLOPS), - LintId::of(floating_point_arithmetic::SUBOPTIMAL_FLOPS), - LintId::of(future_not_send::FUTURE_NOT_SEND), - LintId::of(index_refutable_slice::INDEX_REFUTABLE_SLICE), - LintId::of(let_if_seq::USELESS_LET_IF_SEQ), - LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN), - LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL), - LintId::of(mutex_atomic::MUTEX_ATOMIC), - LintId::of(mutex_atomic::MUTEX_INTEGER), - LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY), - LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES), - LintId::of(option_if_let_else::OPTION_IF_LET_ELSE), - LintId::of(path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE), - LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE), - LintId::of(regex::TRIVIAL_REGEX), - LintId::of(strings::STRING_LIT_AS_BYTES), - LintId::of(suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS), - LintId::of(trailing_empty_array::TRAILING_EMPTY_ARRAY), - LintId::of(transmute::USELESS_TRANSMUTE), - LintId::of(use_self::USE_SELF), -]) +store.register_group(true, "clippy::nursery", Some("clippy_nursery"), [ + Some(LintId::of(attrs::EMPTY_LINE_AFTER_OUTER_ATTR)), + Some(LintId::of(cognitive_complexity::COGNITIVE_COMPLEXITY)), + Some(LintId::of(copies::BRANCHES_SHARING_CODE)), + Some(LintId::of(equatable_if_let::EQUATABLE_IF_LET)), + Some(LintId::of(fallible_impl_from::FALLIBLE_IMPL_FROM)), + Some(LintId::of(floating_point_arithmetic::IMPRECISE_FLOPS)), + Some(LintId::of(floating_point_arithmetic::SUBOPTIMAL_FLOPS)), + Some(LintId::of(future_not_send::FUTURE_NOT_SEND)), + Some(LintId::of(index_refutable_slice::INDEX_REFUTABLE_SLICE)), + Some(LintId::of(let_if_seq::USELESS_LET_IF_SEQ)), + Some(LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN)), + Some(LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL)), + Some(LintId::of(mutex_atomic::MUTEX_ATOMIC)), + Some(LintId::of(mutex_atomic::MUTEX_INTEGER)), + Some(LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY)), + Some(LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES)), + Some(LintId::of(option_if_let_else::OPTION_IF_LET_ELSE)), + Some(LintId::of(path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE)), + Some(LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE)), + Some(LintId::of(regex::TRIVIAL_REGEX)), + Some(LintId::of(strings::STRING_LIT_AS_BYTES)), + Some(LintId::of(suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS)), + Some(LintId::of(trailing_empty_array::TRAILING_EMPTY_ARRAY)), + Some(LintId::of(transmute::USELESS_TRANSMUTE)), + Some(LintId::of(use_self::USE_SELF)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_pedantic.rs b/clippy_lints/src/lib.register_pedantic.rs index 1292675f4a96..7f3e4696405b 100644 --- a/clippy_lints/src/lib.register_pedantic.rs +++ b/clippy_lints/src/lib.register_pedantic.rs @@ -2,100 +2,100 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![ - LintId::of(attrs::INLINE_ALWAYS), - LintId::of(await_holding_invalid::AWAIT_HOLDING_LOCK), - LintId::of(await_holding_invalid::AWAIT_HOLDING_REFCELL_REF), - LintId::of(bit_mask::VERBOSE_BIT_MASK), - LintId::of(borrow_as_ptr::BORROW_AS_PTR), - LintId::of(bytecount::NAIVE_BYTECOUNT), - LintId::of(case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS), - LintId::of(casts::CAST_LOSSLESS), - LintId::of(casts::CAST_POSSIBLE_TRUNCATION), - LintId::of(casts::CAST_POSSIBLE_WRAP), - LintId::of(casts::CAST_PRECISION_LOSS), - LintId::of(casts::CAST_PTR_ALIGNMENT), - LintId::of(casts::CAST_SIGN_LOSS), - LintId::of(casts::PTR_AS_PTR), - LintId::of(checked_conversions::CHECKED_CONVERSIONS), - LintId::of(copies::SAME_FUNCTIONS_IN_IF_CONDITION), - LintId::of(copy_iterator::COPY_ITERATOR), - LintId::of(default::DEFAULT_TRAIT_ACCESS), - LintId::of(dereference::EXPLICIT_DEREF_METHODS), - LintId::of(dereference::REF_BINDING_TO_REFERENCE), - LintId::of(derive::EXPL_IMPL_CLONE_ON_COPY), - LintId::of(derive::UNSAFE_DERIVE_DESERIALIZE), - LintId::of(doc::DOC_MARKDOWN), - LintId::of(doc::MISSING_ERRORS_DOC), - LintId::of(doc::MISSING_PANICS_DOC), - LintId::of(empty_enum::EMPTY_ENUM), - LintId::of(enum_variants::MODULE_NAME_REPETITIONS), - LintId::of(eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS), - LintId::of(excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS), - LintId::of(excessive_bools::STRUCT_EXCESSIVE_BOOLS), - LintId::of(functions::MUST_USE_CANDIDATE), - LintId::of(functions::TOO_MANY_LINES), - LintId::of(if_not_else::IF_NOT_ELSE), - LintId::of(implicit_hasher::IMPLICIT_HASHER), - LintId::of(implicit_saturating_sub::IMPLICIT_SATURATING_SUB), - LintId::of(inconsistent_struct_constructor::INCONSISTENT_STRUCT_CONSTRUCTOR), - LintId::of(infinite_iter::MAYBE_INFINITE_ITER), - LintId::of(invalid_upcast_comparisons::INVALID_UPCAST_COMPARISONS), - LintId::of(items_after_statements::ITEMS_AFTER_STATEMENTS), - LintId::of(iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR), - LintId::of(large_stack_arrays::LARGE_STACK_ARRAYS), - LintId::of(let_underscore::LET_UNDERSCORE_DROP), - LintId::of(literal_representation::LARGE_DIGIT_GROUPS), - LintId::of(literal_representation::UNREADABLE_LITERAL), - LintId::of(loops::EXPLICIT_INTO_ITER_LOOP), - LintId::of(loops::EXPLICIT_ITER_LOOP), - LintId::of(macro_use::MACRO_USE_IMPORTS), - LintId::of(manual_assert::MANUAL_ASSERT), - LintId::of(manual_ok_or::MANUAL_OK_OR), - LintId::of(match_on_vec_items::MATCH_ON_VEC_ITEMS), - LintId::of(matches::MATCH_BOOL), - LintId::of(matches::MATCH_SAME_ARMS), - LintId::of(matches::MATCH_WILDCARD_FOR_SINGLE_VARIANTS), - LintId::of(matches::MATCH_WILD_ERR_ARM), - LintId::of(matches::SINGLE_MATCH_ELSE), - LintId::of(methods::CLONED_INSTEAD_OF_COPIED), - LintId::of(methods::FILTER_MAP_NEXT), - LintId::of(methods::FLAT_MAP_OPTION), - LintId::of(methods::FROM_ITER_INSTEAD_OF_COLLECT), - LintId::of(methods::IMPLICIT_CLONE), - LintId::of(methods::INEFFICIENT_TO_STRING), - LintId::of(methods::MAP_UNWRAP_OR), - LintId::of(misc::FLOAT_CMP), - LintId::of(misc::USED_UNDERSCORE_BINDING), - LintId::of(mut_mut::MUT_MUT), - LintId::of(needless_bitwise_bool::NEEDLESS_BITWISE_BOOL), - LintId::of(needless_continue::NEEDLESS_CONTINUE), - LintId::of(needless_for_each::NEEDLESS_FOR_EACH), - LintId::of(needless_pass_by_value::NEEDLESS_PASS_BY_VALUE), - LintId::of(no_effect::NO_EFFECT_UNDERSCORE_BINDING), - LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES), - LintId::of(non_expressive_names::SIMILAR_NAMES), - LintId::of(pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE), - LintId::of(pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF), - LintId::of(ranges::RANGE_MINUS_ONE), - LintId::of(ranges::RANGE_PLUS_ONE), - LintId::of(redundant_else::REDUNDANT_ELSE), - LintId::of(ref_option_ref::REF_OPTION_REF), - LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE), - LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED), - LintId::of(strings::STRING_ADD_ASSIGN), - LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS), - LintId::of(trait_bounds::TYPE_REPETITION_IN_BOUNDS), - LintId::of(transmute::TRANSMUTE_PTR_TO_PTR), - LintId::of(types::LINKEDLIST), - LintId::of(types::OPTION_OPTION), - LintId::of(unicode::UNICODE_NOT_NFC), - LintId::of(unit_types::LET_UNIT_VALUE), - LintId::of(unnecessary_wraps::UNNECESSARY_WRAPS), - LintId::of(unnested_or_patterns::UNNESTED_OR_PATTERNS), - LintId::of(unused_async::UNUSED_ASYNC), - LintId::of(unused_self::UNUSED_SELF), - LintId::of(wildcard_imports::ENUM_GLOB_USE), - LintId::of(wildcard_imports::WILDCARD_IMPORTS), - LintId::of(zero_sized_map_values::ZERO_SIZED_MAP_VALUES), -]) +store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), [ + Some(LintId::of(attrs::INLINE_ALWAYS)), + Some(LintId::of(await_holding_invalid::AWAIT_HOLDING_LOCK)), + Some(LintId::of(await_holding_invalid::AWAIT_HOLDING_REFCELL_REF)), + Some(LintId::of(bit_mask::VERBOSE_BIT_MASK)), + Some(LintId::of(borrow_as_ptr::BORROW_AS_PTR)), + Some(LintId::of(bytecount::NAIVE_BYTECOUNT)), + Some(LintId::of(case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS)), + Some(LintId::of(casts::CAST_LOSSLESS)), + Some(LintId::of(casts::CAST_POSSIBLE_TRUNCATION)), + Some(LintId::of(casts::CAST_POSSIBLE_WRAP)), + Some(LintId::of(casts::CAST_PRECISION_LOSS)), + Some(LintId::of(casts::CAST_PTR_ALIGNMENT)), + Some(LintId::of(casts::CAST_SIGN_LOSS)), + Some(LintId::of(casts::PTR_AS_PTR)), + Some(LintId::of(checked_conversions::CHECKED_CONVERSIONS)), + Some(LintId::of(copies::SAME_FUNCTIONS_IN_IF_CONDITION)), + Some(LintId::of(copy_iterator::COPY_ITERATOR)), + Some(LintId::of(default::DEFAULT_TRAIT_ACCESS)), + Some(LintId::of(dereference::EXPLICIT_DEREF_METHODS)), + Some(LintId::of(dereference::REF_BINDING_TO_REFERENCE)), + Some(LintId::of(derive::EXPL_IMPL_CLONE_ON_COPY)), + Some(LintId::of(derive::UNSAFE_DERIVE_DESERIALIZE)), + Some(LintId::of(doc::DOC_MARKDOWN)), + Some(LintId::of(doc::MISSING_ERRORS_DOC)), + Some(LintId::of(doc::MISSING_PANICS_DOC)), + Some(LintId::of(empty_enum::EMPTY_ENUM)), + Some(LintId::of(enum_variants::MODULE_NAME_REPETITIONS)), + Some(LintId::of(eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS)), + Some(LintId::of(excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS)), + Some(LintId::of(excessive_bools::STRUCT_EXCESSIVE_BOOLS)), + Some(LintId::of(functions::MUST_USE_CANDIDATE)), + Some(LintId::of(functions::TOO_MANY_LINES)), + Some(LintId::of(if_not_else::IF_NOT_ELSE)), + Some(LintId::of(implicit_hasher::IMPLICIT_HASHER)), + Some(LintId::of(implicit_saturating_sub::IMPLICIT_SATURATING_SUB)), + Some(LintId::of(inconsistent_struct_constructor::INCONSISTENT_STRUCT_CONSTRUCTOR)), + Some(LintId::of(infinite_iter::MAYBE_INFINITE_ITER)), + Some(LintId::of(invalid_upcast_comparisons::INVALID_UPCAST_COMPARISONS)), + Some(LintId::of(items_after_statements::ITEMS_AFTER_STATEMENTS)), + Some(LintId::of(iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR)), + Some(LintId::of(large_stack_arrays::LARGE_STACK_ARRAYS)), + Some(LintId::of(let_underscore::LET_UNDERSCORE_DROP)), + Some(LintId::of(literal_representation::LARGE_DIGIT_GROUPS)), + Some(LintId::of(literal_representation::UNREADABLE_LITERAL)), + Some(LintId::of(loops::EXPLICIT_INTO_ITER_LOOP)), + Some(LintId::of(loops::EXPLICIT_ITER_LOOP)), + Some(LintId::of(macro_use::MACRO_USE_IMPORTS)), + Some(LintId::of(manual_assert::MANUAL_ASSERT)), + Some(LintId::of(manual_ok_or::MANUAL_OK_OR)), + Some(LintId::of(match_on_vec_items::MATCH_ON_VEC_ITEMS)), + Some(LintId::of(matches::MATCH_BOOL)), + Some(LintId::of(matches::MATCH_SAME_ARMS)), + Some(LintId::of(matches::MATCH_WILDCARD_FOR_SINGLE_VARIANTS)), + Some(LintId::of(matches::MATCH_WILD_ERR_ARM)), + Some(LintId::of(matches::SINGLE_MATCH_ELSE)), + Some(LintId::of(methods::CLONED_INSTEAD_OF_COPIED)), + Some(LintId::of(methods::FILTER_MAP_NEXT)), + Some(LintId::of(methods::FLAT_MAP_OPTION)), + Some(LintId::of(methods::FROM_ITER_INSTEAD_OF_COLLECT)), + Some(LintId::of(methods::IMPLICIT_CLONE)), + Some(LintId::of(methods::INEFFICIENT_TO_STRING)), + Some(LintId::of(methods::MAP_UNWRAP_OR)), + Some(LintId::of(misc::FLOAT_CMP)), + Some(LintId::of(misc::USED_UNDERSCORE_BINDING)), + Some(LintId::of(mut_mut::MUT_MUT)), + Some(LintId::of(needless_bitwise_bool::NEEDLESS_BITWISE_BOOL)), + Some(LintId::of(needless_continue::NEEDLESS_CONTINUE)), + Some(LintId::of(needless_for_each::NEEDLESS_FOR_EACH)), + Some(LintId::of(needless_pass_by_value::NEEDLESS_PASS_BY_VALUE)), + Some(LintId::of(no_effect::NO_EFFECT_UNDERSCORE_BINDING)), + Some(LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES)), + Some(LintId::of(non_expressive_names::SIMILAR_NAMES)), + Some(LintId::of(pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE)), + Some(LintId::of(pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF)), + Some(LintId::of(ranges::RANGE_MINUS_ONE)), + Some(LintId::of(ranges::RANGE_PLUS_ONE)), + Some(LintId::of(redundant_else::REDUNDANT_ELSE)), + Some(LintId::of(ref_option_ref::REF_OPTION_REF)), + Some(LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE)), + Some(LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED)), + Some(LintId::of(strings::STRING_ADD_ASSIGN)), + Some(LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS)), + Some(LintId::of(trait_bounds::TYPE_REPETITION_IN_BOUNDS)), + Some(LintId::of(transmute::TRANSMUTE_PTR_TO_PTR)), + Some(LintId::of(types::LINKEDLIST)), + Some(LintId::of(types::OPTION_OPTION)), + Some(LintId::of(unicode::UNICODE_NOT_NFC)), + Some(LintId::of(unit_types::LET_UNIT_VALUE)), + Some(LintId::of(unnecessary_wraps::UNNECESSARY_WRAPS)), + Some(LintId::of(unnested_or_patterns::UNNESTED_OR_PATTERNS)), + Some(LintId::of(unused_async::UNUSED_ASYNC)), + Some(LintId::of(unused_self::UNUSED_SELF)), + Some(LintId::of(wildcard_imports::ENUM_GLOB_USE)), + Some(LintId::of(wildcard_imports::WILDCARD_IMPORTS)), + Some(LintId::of(zero_sized_map_values::ZERO_SIZED_MAP_VALUES)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_perf.rs b/clippy_lints/src/lib.register_perf.rs index c44ef124bfa0..ef7c9f3f1a30 100644 --- a/clippy_lints/src/lib.register_perf.rs +++ b/clippy_lints/src/lib.register_perf.rs @@ -2,29 +2,29 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![ - LintId::of(entry::MAP_ENTRY), - LintId::of(escape::BOXED_LOCAL), - LintId::of(format_args::FORMAT_IN_FORMAT_ARGS), - LintId::of(format_args::TO_STRING_IN_FORMAT_ARGS), - LintId::of(large_const_arrays::LARGE_CONST_ARRAYS), - LintId::of(large_enum_variant::LARGE_ENUM_VARIANT), - LintId::of(loops::MANUAL_MEMCPY), - LintId::of(loops::NEEDLESS_COLLECT), - LintId::of(methods::EXPECT_FUN_CALL), - LintId::of(methods::EXTEND_WITH_DRAIN), - LintId::of(methods::ITER_NTH), - LintId::of(methods::ITER_OVEREAGER_CLONED), - LintId::of(methods::MANUAL_STR_REPEAT), - LintId::of(methods::OR_FUN_CALL), - LintId::of(methods::SINGLE_CHAR_PATTERN), - LintId::of(methods::UNNECESSARY_TO_OWNED), - LintId::of(misc::CMP_OWNED), - LintId::of(redundant_clone::REDUNDANT_CLONE), - LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION), - LintId::of(stable_sort_primitive::STABLE_SORT_PRIMITIVE), - LintId::of(types::BOX_COLLECTION), - LintId::of(types::REDUNDANT_ALLOCATION), - LintId::of(vec::USELESS_VEC), - LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH), -]) +store.register_group(true, "clippy::perf", Some("clippy_perf"), [ + Some(LintId::of(entry::MAP_ENTRY)), + Some(LintId::of(escape::BOXED_LOCAL)), + Some(LintId::of(format_args::FORMAT_IN_FORMAT_ARGS)), + Some(LintId::of(format_args::TO_STRING_IN_FORMAT_ARGS)), + Some(LintId::of(large_const_arrays::LARGE_CONST_ARRAYS)), + Some(LintId::of(large_enum_variant::LARGE_ENUM_VARIANT)), + Some(LintId::of(loops::MANUAL_MEMCPY)), + Some(LintId::of(loops::NEEDLESS_COLLECT)), + Some(LintId::of(methods::EXPECT_FUN_CALL)), + Some(LintId::of(methods::EXTEND_WITH_DRAIN)), + Some(LintId::of(methods::ITER_NTH)), + Some(LintId::of(methods::ITER_OVEREAGER_CLONED)), + Some(LintId::of(methods::MANUAL_STR_REPEAT)), + Some(LintId::of(methods::OR_FUN_CALL)), + Some(LintId::of(methods::SINGLE_CHAR_PATTERN)), + Some(LintId::of(methods::UNNECESSARY_TO_OWNED)), + Some(LintId::of(misc::CMP_OWNED)), + Some(LintId::of(redundant_clone::REDUNDANT_CLONE)), + Some(LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION)), + Some(LintId::of(stable_sort_primitive::STABLE_SORT_PRIMITIVE)), + Some(LintId::of(types::BOX_COLLECTION)), + Some(LintId::of(types::REDUNDANT_ALLOCATION)), + Some(LintId::of(vec::USELESS_VEC)), + Some(LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_restriction.rs b/clippy_lints/src/lib.register_restriction.rs index 5a89fdb05a99..92dea5b14119 100644 --- a/clippy_lints/src/lib.register_restriction.rs +++ b/clippy_lints/src/lib.register_restriction.rs @@ -2,72 +2,72 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![ - LintId::of(arithmetic::FLOAT_ARITHMETIC), - LintId::of(arithmetic::INTEGER_ARITHMETIC), - LintId::of(as_conversions::AS_CONVERSIONS), - LintId::of(asm_syntax::INLINE_ASM_X86_ATT_SYNTAX), - LintId::of(asm_syntax::INLINE_ASM_X86_INTEL_SYNTAX), - LintId::of(casts::FN_TO_NUMERIC_CAST_ANY), - LintId::of(create_dir::CREATE_DIR), - LintId::of(dbg_macro::DBG_MACRO), - LintId::of(default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK), - LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION), - LintId::of(disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS), - LintId::of(else_if_without_else::ELSE_IF_WITHOUT_ELSE), - LintId::of(exhaustive_items::EXHAUSTIVE_ENUMS), - LintId::of(exhaustive_items::EXHAUSTIVE_STRUCTS), - LintId::of(exit::EXIT), - LintId::of(float_literal::LOSSY_FLOAT_LITERAL), - LintId::of(if_then_some_else_none::IF_THEN_SOME_ELSE_NONE), - LintId::of(implicit_return::IMPLICIT_RETURN), - LintId::of(indexing_slicing::INDEXING_SLICING), - LintId::of(inherent_impl::MULTIPLE_INHERENT_IMPL), - LintId::of(integer_division::INTEGER_DIVISION), - LintId::of(let_underscore::LET_UNDERSCORE_MUST_USE), - LintId::of(literal_representation::DECIMAL_LITERAL_REPRESENTATION), - LintId::of(map_err_ignore::MAP_ERR_IGNORE), - LintId::of(matches::REST_PAT_IN_FULLY_BOUND_STRUCTS), - LintId::of(matches::WILDCARD_ENUM_MATCH_ARM), - LintId::of(mem_forget::MEM_FORGET), - LintId::of(methods::CLONE_ON_REF_PTR), - LintId::of(methods::EXPECT_USED), - LintId::of(methods::FILETYPE_IS_FILE), - LintId::of(methods::GET_UNWRAP), - LintId::of(methods::UNWRAP_USED), - LintId::of(misc::FLOAT_CMP_CONST), - LintId::of(misc_early::SEPARATED_LITERAL_SUFFIX), - LintId::of(misc_early::UNNEEDED_FIELD_PATTERN), - LintId::of(misc_early::UNSEPARATED_LITERAL_SUFFIX), - LintId::of(missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS), - LintId::of(missing_enforced_import_rename::MISSING_ENFORCED_IMPORT_RENAMES), - LintId::of(missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS), - LintId::of(module_style::MOD_MODULE_FILES), - LintId::of(module_style::SELF_NAMED_MODULE_FILES), - LintId::of(modulo_arithmetic::MODULO_ARITHMETIC), - LintId::of(panic_in_result_fn::PANIC_IN_RESULT_FN), - LintId::of(panic_unimplemented::PANIC), - LintId::of(panic_unimplemented::TODO), - LintId::of(panic_unimplemented::UNIMPLEMENTED), - LintId::of(panic_unimplemented::UNREACHABLE), - LintId::of(pattern_type_mismatch::PATTERN_TYPE_MISMATCH), - LintId::of(same_name_method::SAME_NAME_METHOD), - LintId::of(shadow::SHADOW_REUSE), - LintId::of(shadow::SHADOW_SAME), - LintId::of(shadow::SHADOW_UNRELATED), - LintId::of(single_char_lifetime_names::SINGLE_CHAR_LIFETIME_NAMES), - LintId::of(strings::STRING_ADD), - LintId::of(strings::STRING_SLICE), - LintId::of(strings::STRING_TO_STRING), - LintId::of(strings::STR_TO_STRING), - LintId::of(types::RC_BUFFER), - LintId::of(types::RC_MUTEX), - LintId::of(undocumented_unsafe_blocks::UNDOCUMENTED_UNSAFE_BLOCKS), - LintId::of(unicode::NON_ASCII_LITERAL), - LintId::of(unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS), - LintId::of(unwrap_in_result::UNWRAP_IN_RESULT), - LintId::of(verbose_file_reads::VERBOSE_FILE_READS), - LintId::of(write::PRINT_STDERR), - LintId::of(write::PRINT_STDOUT), - LintId::of(write::USE_DEBUG), -]) +store.register_group(true, "clippy::restriction", Some("clippy_restriction"), [ + Some(LintId::of(arithmetic::FLOAT_ARITHMETIC)), + Some(LintId::of(arithmetic::INTEGER_ARITHMETIC)), + Some(LintId::of(as_conversions::AS_CONVERSIONS)), + Some(LintId::of(asm_syntax::INLINE_ASM_X86_ATT_SYNTAX)), + Some(LintId::of(asm_syntax::INLINE_ASM_X86_INTEL_SYNTAX)), + Some(LintId::of(casts::FN_TO_NUMERIC_CAST_ANY)), + Some(LintId::of(create_dir::CREATE_DIR)), + Some(LintId::of(dbg_macro::DBG_MACRO)), + Some(LintId::of(default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK)), + Some(LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION)), + Some(LintId::of(disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS)), + Some(LintId::of(else_if_without_else::ELSE_IF_WITHOUT_ELSE)), + Some(LintId::of(exhaustive_items::EXHAUSTIVE_ENUMS)), + Some(LintId::of(exhaustive_items::EXHAUSTIVE_STRUCTS)), + Some(LintId::of(exit::EXIT)), + Some(LintId::of(float_literal::LOSSY_FLOAT_LITERAL)), + Some(LintId::of(if_then_some_else_none::IF_THEN_SOME_ELSE_NONE)), + Some(LintId::of(implicit_return::IMPLICIT_RETURN)), + Some(LintId::of(indexing_slicing::INDEXING_SLICING)), + Some(LintId::of(inherent_impl::MULTIPLE_INHERENT_IMPL)), + Some(LintId::of(integer_division::INTEGER_DIVISION)), + Some(LintId::of(let_underscore::LET_UNDERSCORE_MUST_USE)), + Some(LintId::of(literal_representation::DECIMAL_LITERAL_REPRESENTATION)), + Some(LintId::of(map_err_ignore::MAP_ERR_IGNORE)), + Some(LintId::of(matches::REST_PAT_IN_FULLY_BOUND_STRUCTS)), + Some(LintId::of(matches::WILDCARD_ENUM_MATCH_ARM)), + Some(LintId::of(mem_forget::MEM_FORGET)), + Some(LintId::of(methods::CLONE_ON_REF_PTR)), + Some(LintId::of(methods::EXPECT_USED)), + Some(LintId::of(methods::FILETYPE_IS_FILE)), + Some(LintId::of(methods::GET_UNWRAP)), + Some(LintId::of(methods::UNWRAP_USED)), + Some(LintId::of(misc::FLOAT_CMP_CONST)), + Some(LintId::of(misc_early::SEPARATED_LITERAL_SUFFIX)), + Some(LintId::of(misc_early::UNNEEDED_FIELD_PATTERN)), + Some(LintId::of(misc_early::UNSEPARATED_LITERAL_SUFFIX)), + Some(LintId::of(missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS)), + Some(LintId::of(missing_enforced_import_rename::MISSING_ENFORCED_IMPORT_RENAMES)), + Some(LintId::of(missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS)), + Some(LintId::of(module_style::MOD_MODULE_FILES)), + Some(LintId::of(module_style::SELF_NAMED_MODULE_FILES)), + Some(LintId::of(modulo_arithmetic::MODULO_ARITHMETIC)), + Some(LintId::of(panic_in_result_fn::PANIC_IN_RESULT_FN)), + Some(LintId::of(panic_unimplemented::PANIC)), + Some(LintId::of(panic_unimplemented::TODO)), + Some(LintId::of(panic_unimplemented::UNIMPLEMENTED)), + Some(LintId::of(panic_unimplemented::UNREACHABLE)), + Some(LintId::of(pattern_type_mismatch::PATTERN_TYPE_MISMATCH)), + Some(LintId::of(same_name_method::SAME_NAME_METHOD)), + Some(LintId::of(shadow::SHADOW_REUSE)), + Some(LintId::of(shadow::SHADOW_SAME)), + Some(LintId::of(shadow::SHADOW_UNRELATED)), + Some(LintId::of(single_char_lifetime_names::SINGLE_CHAR_LIFETIME_NAMES)), + Some(LintId::of(strings::STRING_ADD)), + Some(LintId::of(strings::STRING_SLICE)), + Some(LintId::of(strings::STRING_TO_STRING)), + Some(LintId::of(strings::STR_TO_STRING)), + Some(LintId::of(types::RC_BUFFER)), + Some(LintId::of(types::RC_MUTEX)), + Some(LintId::of(undocumented_unsafe_blocks::UNDOCUMENTED_UNSAFE_BLOCKS)), + Some(LintId::of(unicode::NON_ASCII_LITERAL)), + Some(LintId::of(unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS)), + Some(LintId::of(unwrap_in_result::UNWRAP_IN_RESULT)), + Some(LintId::of(verbose_file_reads::VERBOSE_FILE_READS)), + Some(LintId::of(write::PRINT_STDERR)), + Some(LintId::of(write::PRINT_STDOUT)), + Some(LintId::of(write::USE_DEBUG)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_style.rs b/clippy_lints/src/lib.register_style.rs index 05211476ff23..6648632f79ea 100644 --- a/clippy_lints/src/lib.register_style.rs +++ b/clippy_lints/src/lib.register_style.rs @@ -2,117 +2,117 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::style", Some("clippy_style"), vec![ - LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS), - LintId::of(assign_ops::ASSIGN_OP_PATTERN), - LintId::of(blacklisted_name::BLACKLISTED_NAME), - LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS), - LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON), - LintId::of(casts::FN_TO_NUMERIC_CAST), - LintId::of(casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION), - LintId::of(collapsible_if::COLLAPSIBLE_ELSE_IF), - LintId::of(collapsible_if::COLLAPSIBLE_IF), - LintId::of(collapsible_match::COLLAPSIBLE_MATCH), - LintId::of(comparison_chain::COMPARISON_CHAIN), - LintId::of(default::FIELD_REASSIGN_WITH_DEFAULT), - LintId::of(dereference::NEEDLESS_BORROW), - LintId::of(disallowed_methods::DISALLOWED_METHODS), - LintId::of(disallowed_types::DISALLOWED_TYPES), - LintId::of(doc::MISSING_SAFETY_DOC), - LintId::of(doc::NEEDLESS_DOCTEST_MAIN), - LintId::of(enum_variants::ENUM_VARIANT_NAMES), - LintId::of(enum_variants::MODULE_INCEPTION), - LintId::of(eq_op::OP_REF), - LintId::of(eta_reduction::REDUNDANT_CLOSURE), - LintId::of(float_literal::EXCESSIVE_PRECISION), - LintId::of(from_over_into::FROM_OVER_INTO), - LintId::of(from_str_radix_10::FROM_STR_RADIX_10), - LintId::of(functions::DOUBLE_MUST_USE), - LintId::of(functions::MUST_USE_UNIT), - LintId::of(functions::RESULT_UNIT_ERR), - LintId::of(inherent_to_string::INHERENT_TO_STRING), - LintId::of(init_numbered_fields::INIT_NUMBERED_FIELDS), - LintId::of(len_zero::COMPARISON_TO_EMPTY), - LintId::of(len_zero::LEN_WITHOUT_IS_EMPTY), - LintId::of(len_zero::LEN_ZERO), - LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING), - LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS), - LintId::of(loops::FOR_KV_MAP), - LintId::of(loops::NEEDLESS_RANGE_LOOP), - LintId::of(loops::SAME_ITEM_PUSH), - LintId::of(loops::WHILE_LET_ON_ITERATOR), - LintId::of(main_recursion::MAIN_RECURSION), - LintId::of(manual_async_fn::MANUAL_ASYNC_FN), - LintId::of(manual_bits::MANUAL_BITS), - LintId::of(manual_map::MANUAL_MAP), - LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE), - LintId::of(map_clone::MAP_CLONE), - LintId::of(match_result_ok::MATCH_RESULT_OK), - LintId::of(matches::INFALLIBLE_DESTRUCTURING_MATCH), - LintId::of(matches::MATCH_LIKE_MATCHES_MACRO), - LintId::of(matches::MATCH_OVERLAPPING_ARM), - LintId::of(matches::MATCH_REF_PATS), - LintId::of(matches::REDUNDANT_PATTERN_MATCHING), - LintId::of(matches::SINGLE_MATCH), - LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE), - LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT), - LintId::of(methods::BYTES_NTH), - LintId::of(methods::CHARS_LAST_CMP), - LintId::of(methods::CHARS_NEXT_CMP), - LintId::of(methods::INTO_ITER_ON_REF), - LintId::of(methods::ITER_CLONED_COLLECT), - LintId::of(methods::ITER_NEXT_SLICE), - LintId::of(methods::ITER_NTH_ZERO), - LintId::of(methods::ITER_SKIP_NEXT), - LintId::of(methods::MANUAL_SATURATING_ARITHMETIC), - LintId::of(methods::MAP_COLLECT_RESULT_UNIT), - LintId::of(methods::NEW_RET_NO_SELF), - LintId::of(methods::OK_EXPECT), - LintId::of(methods::OPTION_MAP_OR_NONE), - LintId::of(methods::RESULT_MAP_OR_INTO_OPTION), - LintId::of(methods::SHOULD_IMPLEMENT_TRAIT), - LintId::of(methods::SINGLE_CHAR_ADD_STR), - LintId::of(methods::STRING_EXTEND_CHARS), - LintId::of(methods::UNNECESSARY_FOLD), - LintId::of(methods::UNNECESSARY_LAZY_EVALUATIONS), - LintId::of(methods::UNWRAP_OR_ELSE_DEFAULT), - LintId::of(methods::WRONG_SELF_CONVENTION), - LintId::of(misc::TOPLEVEL_REF_ARG), - LintId::of(misc::ZERO_PTR), - LintId::of(misc_early::BUILTIN_TYPE_SHADOW), - LintId::of(misc_early::DOUBLE_NEG), - LintId::of(misc_early::DUPLICATE_UNDERSCORE_ARGUMENT), - LintId::of(misc_early::MIXED_CASE_HEX_LITERALS), - LintId::of(misc_early::REDUNDANT_PATTERN), - LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK), - LintId::of(mut_reference::UNNECESSARY_MUT_PASSED), - LintId::of(needless_late_init::NEEDLESS_LATE_INIT), - LintId::of(neg_multiply::NEG_MULTIPLY), - LintId::of(new_without_default::NEW_WITHOUT_DEFAULT), - LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST), - LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST), - LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS), - LintId::of(ptr::CMP_NULL), - LintId::of(ptr::PTR_ARG), - LintId::of(ptr_eq::PTR_EQ), - LintId::of(question_mark::QUESTION_MARK), - LintId::of(ranges::MANUAL_RANGE_CONTAINS), - LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES), - LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES), - LintId::of(returns::LET_AND_RETURN), - LintId::of(returns::NEEDLESS_RETURN), - LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS), - LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS), - LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS), - LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME), - LintId::of(try_err::TRY_ERR), - LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME), - LintId::of(unused_unit::UNUSED_UNIT), - LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS), - LintId::of(write::PRINTLN_EMPTY_STRING), - LintId::of(write::PRINT_LITERAL), - LintId::of(write::PRINT_WITH_NEWLINE), - LintId::of(write::WRITELN_EMPTY_STRING), - LintId::of(write::WRITE_LITERAL), - LintId::of(write::WRITE_WITH_NEWLINE), -]) +store.register_group(true, "clippy::style", Some("clippy_style"), [ + Some(LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS)), + Some(LintId::of(assign_ops::ASSIGN_OP_PATTERN)), + Some(LintId::of(blacklisted_name::BLACKLISTED_NAME)), + Some(LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS)), + Some(LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON)), + Some(LintId::of(casts::FN_TO_NUMERIC_CAST)), + Some(LintId::of(casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION)), + Some(LintId::of(collapsible_if::COLLAPSIBLE_ELSE_IF)), + Some(LintId::of(collapsible_if::COLLAPSIBLE_IF)), + Some(LintId::of(collapsible_match::COLLAPSIBLE_MATCH)), + Some(LintId::of(comparison_chain::COMPARISON_CHAIN)), + Some(LintId::of(default::FIELD_REASSIGN_WITH_DEFAULT)), + Some(LintId::of(dereference::NEEDLESS_BORROW)), + Some(LintId::of(disallowed_methods::DISALLOWED_METHODS)), + Some(LintId::of(disallowed_types::DISALLOWED_TYPES)), + Some(LintId::of(doc::MISSING_SAFETY_DOC)), + Some(LintId::of(doc::NEEDLESS_DOCTEST_MAIN)), + Some(LintId::of(enum_variants::ENUM_VARIANT_NAMES)), + Some(LintId::of(enum_variants::MODULE_INCEPTION)), + Some(LintId::of(eq_op::OP_REF)), + Some(LintId::of(eta_reduction::REDUNDANT_CLOSURE)), + Some(LintId::of(float_literal::EXCESSIVE_PRECISION)), + Some(LintId::of(from_over_into::FROM_OVER_INTO)), + Some(LintId::of(from_str_radix_10::FROM_STR_RADIX_10)), + Some(LintId::of(functions::DOUBLE_MUST_USE)), + Some(LintId::of(functions::MUST_USE_UNIT)), + Some(LintId::of(functions::RESULT_UNIT_ERR)), + Some(LintId::of(inherent_to_string::INHERENT_TO_STRING)), + Some(LintId::of(init_numbered_fields::INIT_NUMBERED_FIELDS)), + Some(LintId::of(len_zero::COMPARISON_TO_EMPTY)), + Some(LintId::of(len_zero::LEN_WITHOUT_IS_EMPTY)), + Some(LintId::of(len_zero::LEN_ZERO)), + Some(LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING)), + Some(LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS)), + Some(LintId::of(loops::FOR_KV_MAP)), + Some(LintId::of(loops::NEEDLESS_RANGE_LOOP)), + Some(LintId::of(loops::SAME_ITEM_PUSH)), + Some(LintId::of(loops::WHILE_LET_ON_ITERATOR)), + Some(LintId::of(main_recursion::MAIN_RECURSION)), + Some(LintId::of(manual_async_fn::MANUAL_ASYNC_FN)), + Some(LintId::of(manual_bits::MANUAL_BITS)), + Some(LintId::of(manual_map::MANUAL_MAP)), + Some(LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE)), + Some(LintId::of(map_clone::MAP_CLONE)), + Some(LintId::of(match_result_ok::MATCH_RESULT_OK)), + Some(LintId::of(matches::INFALLIBLE_DESTRUCTURING_MATCH)), + Some(LintId::of(matches::MATCH_LIKE_MATCHES_MACRO)), + Some(LintId::of(matches::MATCH_OVERLAPPING_ARM)), + Some(LintId::of(matches::MATCH_REF_PATS)), + Some(LintId::of(matches::REDUNDANT_PATTERN_MATCHING)), + Some(LintId::of(matches::SINGLE_MATCH)), + Some(LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE)), + Some(LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT)), + Some(LintId::of(methods::BYTES_NTH)), + Some(LintId::of(methods::CHARS_LAST_CMP)), + Some(LintId::of(methods::CHARS_NEXT_CMP)), + Some(LintId::of(methods::INTO_ITER_ON_REF)), + Some(LintId::of(methods::ITER_CLONED_COLLECT)), + Some(LintId::of(methods::ITER_NEXT_SLICE)), + Some(LintId::of(methods::ITER_NTH_ZERO)), + Some(LintId::of(methods::ITER_SKIP_NEXT)), + Some(LintId::of(methods::MANUAL_SATURATING_ARITHMETIC)), + Some(LintId::of(methods::MAP_COLLECT_RESULT_UNIT)), + Some(LintId::of(methods::NEW_RET_NO_SELF)), + Some(LintId::of(methods::OK_EXPECT)), + Some(LintId::of(methods::OPTION_MAP_OR_NONE)), + Some(LintId::of(methods::RESULT_MAP_OR_INTO_OPTION)), + Some(LintId::of(methods::SHOULD_IMPLEMENT_TRAIT)), + Some(LintId::of(methods::SINGLE_CHAR_ADD_STR)), + Some(LintId::of(methods::STRING_EXTEND_CHARS)), + Some(LintId::of(methods::UNNECESSARY_FOLD)), + Some(LintId::of(methods::UNNECESSARY_LAZY_EVALUATIONS)), + Some(LintId::of(methods::UNWRAP_OR_ELSE_DEFAULT)), + Some(LintId::of(methods::WRONG_SELF_CONVENTION)), + Some(LintId::of(misc::TOPLEVEL_REF_ARG)), + Some(LintId::of(misc::ZERO_PTR)), + Some(LintId::of(misc_early::BUILTIN_TYPE_SHADOW)), + Some(LintId::of(misc_early::DOUBLE_NEG)), + Some(LintId::of(misc_early::DUPLICATE_UNDERSCORE_ARGUMENT)), + Some(LintId::of(misc_early::MIXED_CASE_HEX_LITERALS)), + Some(LintId::of(misc_early::REDUNDANT_PATTERN)), + Some(LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK)), + Some(LintId::of(mut_reference::UNNECESSARY_MUT_PASSED)), + Some(LintId::of(needless_late_init::NEEDLESS_LATE_INIT)), + Some(LintId::of(neg_multiply::NEG_MULTIPLY)), + Some(LintId::of(new_without_default::NEW_WITHOUT_DEFAULT)), + Some(LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST)), + Some(LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST)), + Some(LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS)), + Some(LintId::of(ptr::CMP_NULL)), + Some(LintId::of(ptr::PTR_ARG)), + Some(LintId::of(ptr_eq::PTR_EQ)), + Some(LintId::of(question_mark::QUESTION_MARK)), + Some(LintId::of(ranges::MANUAL_RANGE_CONTAINS)), + Some(LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES)), + Some(LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES)), + Some(LintId::of(returns::LET_AND_RETURN)), + Some(LintId::of(returns::NEEDLESS_RETURN)), + Some(LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS)), + Some(LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS)), + Some(LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS)), + Some(LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME)), + Some(LintId::of(try_err::TRY_ERR)), + Some(LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME)), + Some(LintId::of(unused_unit::UNUSED_UNIT)), + Some(LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS)), + Some(LintId::of(write::PRINTLN_EMPTY_STRING)), + Some(LintId::of(write::PRINT_LITERAL)), + Some(LintId::of(write::PRINT_WITH_NEWLINE)), + Some(LintId::of(write::WRITELN_EMPTY_STRING)), + Some(LintId::of(write::WRITE_LITERAL)), + Some(LintId::of(write::WRITE_WITH_NEWLINE)), +].iter().copied().flatten().collect::>()) diff --git a/clippy_lints/src/lib.register_suspicious.rs b/clippy_lints/src/lib.register_suspicious.rs index 10f8ae4b7f7f..37b6225e6450 100644 --- a/clippy_lints/src/lib.register_suspicious.rs +++ b/clippy_lints/src/lib.register_suspicious.rs @@ -2,20 +2,20 @@ // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. -store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), vec![ - LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP), - LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS), - LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE), - LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS), - LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING), - LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING), - LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING), - LintId::of(loops::EMPTY_LOOP), - LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES), - LintId::of(loops::MUT_RANGE_BOUND), - LintId::of(methods::SUSPICIOUS_MAP), - LintId::of(mut_key::MUTABLE_KEY_TYPE), - LintId::of(octal_escapes::OCTAL_ESCAPES), - LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL), - LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL), -]) +store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), [ + Some(LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP)), + Some(LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS)), + Some(LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE)), + Some(LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS)), + Some(LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING)), + Some(LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING)), + Some(LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING)), + Some(LintId::of(loops::EMPTY_LOOP)), + Some(LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES)), + Some(LintId::of(loops::MUT_RANGE_BOUND)), + Some(LintId::of(methods::SUSPICIOUS_MAP)), + Some(LintId::of(mut_key::MUTABLE_KEY_TYPE)), + Some(LintId::of(octal_escapes::OCTAL_ESCAPES)), + Some(LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL)), + Some(LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL)), +].iter().copied().flatten().collect::>()) From bc43b89ed64fe08402ec01154567dbdf0df6b275 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 15 Feb 2022 00:28:04 +0100 Subject: [PATCH 4/7] Set version to `nightly` for `1.60.0` lints --- clippy_lints/src/borrow_as_ptr.rs | 2 +- clippy_lints/src/default_union_representation.rs | 2 +- clippy_lints/src/lib.register_all.rs | 4 ++-- clippy_lints/src/lib.register_correctness.rs | 2 +- clippy_lints/src/lib.register_pedantic.rs | 2 +- clippy_lints/src/lib.register_restriction.rs | 2 +- clippy_lints/src/lib.register_style.rs | 2 +- clippy_lints/src/manual_bits.rs | 2 +- clippy_lints/src/transmute/mod.rs | 2 +- clippy_lints/src/utils/internal_lints.rs | 5 +++-- tests/ui-internal/check_clippy_version_attribute.stderr | 4 ++-- 11 files changed, 15 insertions(+), 14 deletions(-) diff --git a/clippy_lints/src/borrow_as_ptr.rs b/clippy_lints/src/borrow_as_ptr.rs index 9f8eb488c29b..6c1f5ff3c193 100644 --- a/clippy_lints/src/borrow_as_ptr.rs +++ b/clippy_lints/src/borrow_as_ptr.rs @@ -36,7 +36,7 @@ declare_clippy_lint! { /// let mut val_mut = 1; /// let p_mut = std::ptr::addr_of_mut!(val_mut); /// ``` - #[clippy::version = "1.60.0"] + #[clippy::version = "nightly"] pub BORROW_AS_PTR, pedantic, "borrowing just to cast to a raw pointer" diff --git a/clippy_lints/src/default_union_representation.rs b/clippy_lints/src/default_union_representation.rs index 9b5da0bd8a66..bc3c31c53c28 100644 --- a/clippy_lints/src/default_union_representation.rs +++ b/clippy_lints/src/default_union_representation.rs @@ -43,7 +43,7 @@ declare_clippy_lint! { /// }; /// } /// ``` - #[clippy::version = "1.60.0"] + #[clippy::version = "nightly"] pub DEFAULT_UNION_REPRESENTATION, restriction, "unions without a `#[repr(C)]` attribute" diff --git a/clippy_lints/src/lib.register_all.rs b/clippy_lints/src/lib.register_all.rs index e45f25eab0e8..1fed7aba41a2 100644 --- a/clippy_lints/src/lib.register_all.rs +++ b/clippy_lints/src/lib.register_all.rs @@ -115,7 +115,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), [ Some(LintId::of(loops::WHILE_LET_ON_ITERATOR)), Some(LintId::of(main_recursion::MAIN_RECURSION)), Some(LintId::of(manual_async_fn::MANUAL_ASYNC_FN)), - Some(LintId::of(manual_bits::MANUAL_BITS)), + clippy_utils::nightly::is_nightly_run().then_some(LintId::of(manual_bits::MANUAL_BITS)), Some(LintId::of(manual_map::MANUAL_MAP)), Some(LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE)), Some(LintId::of(manual_strip::MANUAL_STRIP)), @@ -277,7 +277,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), [ Some(LintId::of(transmute::TRANSMUTE_INT_TO_FLOAT)), Some(LintId::of(transmute::TRANSMUTE_NUM_TO_BYTES)), Some(LintId::of(transmute::TRANSMUTE_PTR_TO_REF)), - Some(LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR)), + clippy_utils::nightly::is_nightly_run().then_some(LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR)), Some(LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE)), Some(LintId::of(transmute::WRONG_TRANSMUTE)), Some(LintId::of(transmuting_null::TRANSMUTING_NULL)), diff --git a/clippy_lints/src/lib.register_correctness.rs b/clippy_lints/src/lib.register_correctness.rs index 7cce7f29b60e..9de565afd9ba 100644 --- a/clippy_lints/src/lib.register_correctness.rs +++ b/clippy_lints/src/lib.register_correctness.rs @@ -58,7 +58,7 @@ store.register_group(true, "clippy::correctness", Some("clippy_correctness"), [ Some(LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT)), Some(LintId::of(swap::ALMOST_SWAPPED)), Some(LintId::of(to_string_in_display::TO_STRING_IN_DISPLAY)), - Some(LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR)), + clippy_utils::nightly::is_nightly_run().then_some(LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR)), Some(LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE)), Some(LintId::of(transmute::WRONG_TRANSMUTE)), Some(LintId::of(transmuting_null::TRANSMUTING_NULL)), diff --git a/clippy_lints/src/lib.register_pedantic.rs b/clippy_lints/src/lib.register_pedantic.rs index 7f3e4696405b..bfc7fb2c00e3 100644 --- a/clippy_lints/src/lib.register_pedantic.rs +++ b/clippy_lints/src/lib.register_pedantic.rs @@ -7,7 +7,7 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), [ Some(LintId::of(await_holding_invalid::AWAIT_HOLDING_LOCK)), Some(LintId::of(await_holding_invalid::AWAIT_HOLDING_REFCELL_REF)), Some(LintId::of(bit_mask::VERBOSE_BIT_MASK)), - Some(LintId::of(borrow_as_ptr::BORROW_AS_PTR)), + clippy_utils::nightly::is_nightly_run().then_some(LintId::of(borrow_as_ptr::BORROW_AS_PTR)), Some(LintId::of(bytecount::NAIVE_BYTECOUNT)), Some(LintId::of(case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS)), Some(LintId::of(casts::CAST_LOSSLESS)), diff --git a/clippy_lints/src/lib.register_restriction.rs b/clippy_lints/src/lib.register_restriction.rs index 92dea5b14119..1e082529c148 100644 --- a/clippy_lints/src/lib.register_restriction.rs +++ b/clippy_lints/src/lib.register_restriction.rs @@ -12,7 +12,7 @@ store.register_group(true, "clippy::restriction", Some("clippy_restriction"), [ Some(LintId::of(create_dir::CREATE_DIR)), Some(LintId::of(dbg_macro::DBG_MACRO)), Some(LintId::of(default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK)), - Some(LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION)), + clippy_utils::nightly::is_nightly_run().then_some(LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION)), Some(LintId::of(disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS)), Some(LintId::of(else_if_without_else::ELSE_IF_WITHOUT_ELSE)), Some(LintId::of(exhaustive_items::EXHAUSTIVE_ENUMS)), diff --git a/clippy_lints/src/lib.register_style.rs b/clippy_lints/src/lib.register_style.rs index 6648632f79ea..82996e749a5a 100644 --- a/clippy_lints/src/lib.register_style.rs +++ b/clippy_lints/src/lib.register_style.rs @@ -43,7 +43,7 @@ store.register_group(true, "clippy::style", Some("clippy_style"), [ Some(LintId::of(loops::WHILE_LET_ON_ITERATOR)), Some(LintId::of(main_recursion::MAIN_RECURSION)), Some(LintId::of(manual_async_fn::MANUAL_ASYNC_FN)), - Some(LintId::of(manual_bits::MANUAL_BITS)), + clippy_utils::nightly::is_nightly_run().then_some(LintId::of(manual_bits::MANUAL_BITS)), Some(LintId::of(manual_map::MANUAL_MAP)), Some(LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE)), Some(LintId::of(map_clone::MAP_CLONE)), diff --git a/clippy_lints/src/manual_bits.rs b/clippy_lints/src/manual_bits.rs index 809aa168a7a0..f297add38a1b 100644 --- a/clippy_lints/src/manual_bits.rs +++ b/clippy_lints/src/manual_bits.rs @@ -25,7 +25,7 @@ declare_clippy_lint! { /// ```rust /// usize::BITS; /// ``` - #[clippy::version = "1.60.0"] + #[clippy::version = "nightly"] pub MANUAL_BITS, style, "manual implementation of `size_of::() * 8` can be simplified with `T::BITS`" diff --git a/clippy_lints/src/transmute/mod.rs b/clippy_lints/src/transmute/mod.rs index 22a8c53a5852..d66470d45824 100644 --- a/clippy_lints/src/transmute/mod.rs +++ b/clippy_lints/src/transmute/mod.rs @@ -375,7 +375,7 @@ declare_clippy_lint! { /// struct Foo(u32, T); /// let _ = unsafe { core::mem::transmute::, Foo>(Foo(0u32, 0u32)) }; /// ``` - #[clippy::version = "1.60.0"] + #[clippy::version = "nightly"] pub TRANSMUTE_UNDEFINED_REPR, correctness, "transmute to or from a type with an undefined representation" diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index dc0f515bfe5c..11c90647ccc0 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -322,6 +322,7 @@ declare_clippy_lint! { /// /// Valid values are: /// * "pre 1.29.0" + /// * "nightly" /// * any valid semantic version pub INVALID_CLIPPY_VERSION_ATTRIBUTE, internal, @@ -491,7 +492,7 @@ fn check_invalid_clippy_version_attribute(cx: &LateContext<'_>, item: &'_ Item<' if let Some(value) = extract_clippy_version_value(cx, item) { // The `sym!` macro doesn't work as it only expects a single token. // It's better to keep it this way and have a direct `Symbol::intern` call here. - if value == Symbol::intern("pre 1.29.0") { + if value == Symbol::intern("pre 1.29.0") || value == Symbol::intern("nightly") { return; } @@ -502,7 +503,7 @@ fn check_invalid_clippy_version_attribute(cx: &LateContext<'_>, item: &'_ Item<' item.span, "this item has an invalid `clippy::version` attribute", None, - "please use a valid sematic version, see `doc/adding_lints.md`", + "please use a valid sematic version or `nightly`, see `doc/adding_lints.md`", ); } } else { diff --git a/tests/ui-internal/check_clippy_version_attribute.stderr b/tests/ui-internal/check_clippy_version_attribute.stderr index 9302e02ccb9c..e15463418f10 100644 --- a/tests/ui-internal/check_clippy_version_attribute.stderr +++ b/tests/ui-internal/check_clippy_version_attribute.stderr @@ -16,7 +16,7 @@ note: the lint level is defined here LL | #![deny(clippy::internal)] | ^^^^^^^^^^^^^^^^ = note: `#[deny(clippy::invalid_clippy_version_attribute)]` implied by `#[deny(clippy::internal)]` - = help: please use a valid sematic version, see `doc/adding_lints.md` + = help: please use a valid sematic version or `nightly`, see `doc/adding_lints.md` = note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info) error: this item has an invalid `clippy::version` attribute @@ -31,7 +31,7 @@ LL | | report_in_external_macro: true LL | | } | |_^ | - = help: please use a valid sematic version, see `doc/adding_lints.md` + = help: please use a valid sematic version or `nightly`, see `doc/adding_lints.md` = note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info) error: this lint is missing the `clippy::version` attribute or version value From 56a5ba986f432ff2a8011dd88c135534414072ab Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 15 Feb 2022 00:36:11 +0100 Subject: [PATCH 5/7] Suppress nightly lint emission in Clippy --- clippy_dev/src/update_lints.rs | 35 ++++++++++++++ clippy_lints/src/lib.nightly_lints.rs | 12 +++++ clippy_lints/src/lib.rs | 1 + clippy_utils/src/diagnostics.rs | 32 +++++++++++-- clippy_utils/src/nightly.rs | 66 +++++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 clippy_lints/src/lib.nightly_lints.rs diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index eca7487358ac..bff6aaab9b14 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -125,6 +125,11 @@ pub fn run(update_mode: UpdateMode) { update_mode, &gen_deprecated(deprecated_lints.iter()), ); + process_file( + "clippy_lints/src/lib.nightly_lints.rs", + update_mode, + &gen_nightly_lint_list(internal_lints.iter(), usable_lints.iter()), + ); let all_group_lints = usable_lints.iter().filter(|l| { matches!( @@ -320,6 +325,36 @@ fn gen_deprecated<'a>(lints: impl Iterator) -> String { output } +fn gen_nightly_lint_list<'a>( + internal_lints: impl Iterator, + usable_lints: impl Iterator, +) -> String { + let details: Vec<_> = internal_lints + .map(|l| (false, l)) + .chain(usable_lints.map(|l| (true, l))) + .filter(|(_, l)| l.version.as_ref().map_or(false, |v| v == "nightly")) + .map(|(p, l)| (p, &l.module, l.name.to_uppercase())) + .collect(); + + let mut output = GENERATED_FILE_COMMENT.to_string(); + output.push_str("clippy_utils::nightly::set_nightly_lints([\n"); + // The test lint "FOREVER_NIGHTLY_LINT" is in the `internal_warn` group which is + // not processed by `update_lints`. For testing purposes we still need the lint to be + // registered in the `nightly_lints` list. This manually adds this one lint. + output.push_str(" #[cfg(feature = \"internal\")]\n"); + output.push_str(" LintId::of(utils::internal_lints::FOREVER_NIGHTLY_LINT),\n"); + + for (is_public, module_name, lint_name) in details { + if !is_public { + output.push_str(" #[cfg(feature = \"internal\")]\n"); + } + output.push_str(&format!(" LintId::of({}::{}),\n", module_name, lint_name)); + } + output.push_str("])\n"); + + output +} + /// Generates the code for registering lints #[must_use] fn gen_register_lint_list<'a>( diff --git a/clippy_lints/src/lib.nightly_lints.rs b/clippy_lints/src/lib.nightly_lints.rs new file mode 100644 index 000000000000..fb5b89e5b96f --- /dev/null +++ b/clippy_lints/src/lib.nightly_lints.rs @@ -0,0 +1,12 @@ +// This file was generated by `cargo dev update_lints`. +// Use that command to update this file and do not edit by hand. +// Manual edits will be overwritten. + +clippy_utils::nightly::set_nightly_lints([ + #[cfg(feature = "internal")] + LintId::of(utils::internal_lints::FOREVER_NIGHTLY_LINT), + LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR), + LintId::of(borrow_as_ptr::BORROW_AS_PTR), + LintId::of(manual_bits::MANUAL_BITS), + LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION), +]) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index f2661a82c0d2..c1d9d18539bb 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -467,6 +467,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: register_removed_non_tool_lints(store); include!("lib.deprecated.rs"); + include!("lib.nightly_lints.rs"); include!("lib.register_lints.rs"); include!("lib.register_restriction.rs"); diff --git a/clippy_utils/src/diagnostics.rs b/clippy_utils/src/diagnostics.rs index ca222c3d6699..67b49e60ddd2 100644 --- a/clippy_utils/src/diagnostics.rs +++ b/clippy_utils/src/diagnostics.rs @@ -8,6 +8,8 @@ //! Thank you! //! ~The `INTERNAL_METADATA_COLLECTOR` lint +use crate::nightly::LintLevelProvider; + use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir::HirId; use rustc_lint::{LateContext, Lint, LintContext}; @@ -46,7 +48,11 @@ fn docs_link(diag: &mut DiagnosticBuilder<'_>, lint: &'static Lint) { /// 17 | std::mem::forget(seven); /// | ^^^^^^^^^^^^^^^^^^^^^^^ /// ``` -pub fn span_lint(cx: &T, lint: &'static Lint, sp: impl Into, msg: &str) { +pub fn span_lint(cx: &T, lint: &'static Lint, sp: impl Into, msg: &str) { + if crate::nightly::suppress_lint(cx, lint) { + return; + } + cx.struct_span_lint(lint, sp, |diag| { let mut diag = diag.build(msg); docs_link(&mut diag, lint); @@ -74,7 +80,7 @@ pub fn span_lint(cx: &T, lint: &'static Lint, sp: impl Into( +pub fn span_lint_and_help<'a, T: LintContext + LintLevelProvider>( cx: &'a T, lint: &'static Lint, span: Span, @@ -117,7 +123,7 @@ pub fn span_lint_and_help<'a, T: LintContext>( /// 10 | forget(&SomeStruct); /// | ^^^^^^^^^^^ /// ``` -pub fn span_lint_and_note<'a, T: LintContext>( +pub fn span_lint_and_note<'a, T: LintContext + LintLevelProvider>( cx: &'a T, lint: &'static Lint, span: impl Into, @@ -125,6 +131,10 @@ pub fn span_lint_and_note<'a, T: LintContext>( note_span: Option, note: &str, ) { + if crate::nightly::suppress_lint(cx, lint) { + return; + } + cx.struct_span_lint(lint, span, |diag| { let mut diag = diag.build(msg); if let Some(note_span) = note_span { @@ -143,10 +153,14 @@ pub fn span_lint_and_note<'a, T: LintContext>( /// If you change the signature, remember to update the internal lint `CollapsibleCalls` pub fn span_lint_and_then(cx: &C, lint: &'static Lint, sp: S, msg: &str, f: F) where - C: LintContext, + C: LintContext + LintLevelProvider, S: Into, F: FnOnce(&mut DiagnosticBuilder<'_>), { + if crate::nightly::suppress_lint(cx, lint) { + return; + } + cx.struct_span_lint(lint, sp, |diag| { let mut diag = diag.build(msg); f(&mut diag); @@ -156,6 +170,10 @@ where } pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) { + if crate::nightly::suppress_lint(cx, lint) { + return; + } + cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| { let mut diag = diag.build(msg); docs_link(&mut diag, lint); @@ -171,6 +189,10 @@ pub fn span_lint_hir_and_then( msg: &str, f: impl FnOnce(&mut DiagnosticBuilder<'_>), ) { + if crate::nightly::suppress_lint(cx, lint) { + return; + } + cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| { let mut diag = diag.build(msg); f(&mut diag); @@ -199,7 +221,7 @@ pub fn span_lint_hir_and_then( /// = note: `-D fold-any` implied by `-D warnings` /// ``` #[cfg_attr(feature = "internal", allow(clippy::collapsible_span_lint_calls))] -pub fn span_lint_and_sugg<'a, T: LintContext>( +pub fn span_lint_and_sugg<'a, T: LintContext + LintLevelProvider>( cx: &'a T, lint: &'static Lint, sp: Span, diff --git a/clippy_utils/src/nightly.rs b/clippy_utils/src/nightly.rs index b5a4dbcc8b69..8d2ecfcd19ec 100644 --- a/clippy_utils/src/nightly.rs +++ b/clippy_utils/src/nightly.rs @@ -3,9 +3,13 @@ use std::lazy::SyncOnceCell; +use rustc_data_structures::stable_set::FxHashSet; +use rustc_lint::{EarlyContext, LateContext, Level, Lint, LintId}; +use rustc_middle::lint::{LevelAndSource, LintLevelSource}; use rustc_session::Session; static IS_NIGHTLY_RUN: SyncOnceCell = SyncOnceCell::new(); +static NIGHTLY_LINTS: SyncOnceCell> = SyncOnceCell::new(); /// This function is used to determine if nightly lints should be enabled or disabled /// in this Clippy run. @@ -33,3 +37,65 @@ pub fn eval_is_nightly_run(sess: &Session) { pub fn is_nightly_run() -> bool { *IS_NIGHTLY_RUN.get().unwrap_or(&false) } + +/// This function takes a list of all nightly lints that will be surpressed before +/// the emission if nightly lints are disabled. +/// +/// It's only allowed to call this once. This is done by [`clippy_lints::lib`] +#[doc(hidden)] +pub fn set_nightly_lints(lints: [LintId; N]) { + // The from trait for HashMaps is only implemented for the normal hasher. Here we have to add each + // item individually + let mut nightly_lints = FxHashSet::default(); + lints.iter().copied().for_each(|lint| { + nightly_lints.insert(lint); + }); + NIGHTLY_LINTS + .set(nightly_lints) + .expect("`NIGHTLY_LINTS` should only be set once."); +} + +/// Returns true if the lint is a registered nightly lint. Note that a lint will still be a +/// registered nightly lint if nightly lints are enabled as usual. +/// +/// Please use [`is_nightly_run`] to determine if Clippy's nightly features +/// should be enabled. +#[inline] +pub fn is_nightly_lint(lint: &'static Lint) -> bool { + NIGHTLY_LINTS + .get() + .map_or(false, |lints| lints.contains(&LintId::of(lint))) +} + +/// This function checks if the given lint is a nightly lint and should be suppressed in the current +/// context. +pub fn suppress_lint(cx: &T, lint: &'static Lint) -> bool { + if !is_nightly_run() && is_nightly_lint(lint) { + let (_, level_src) = cx.get_lint_level(lint); + if level_src == LintLevelSource::Default + || level_src == LintLevelSource::CommandLine(sym!(warnings), Level::Deny) + { + return true; + } + } + + false +} + +/// This trait is used to retrieve the lint level for the lint based on the +/// current linting context. +pub trait LintLevelProvider { + fn get_lint_level(&self, lint: &'static Lint) -> LevelAndSource; +} + +impl LintLevelProvider for LateContext<'_> { + fn get_lint_level(&self, lint: &'static Lint) -> LevelAndSource { + self.tcx.lint_level_at_node(lint, self.last_node_with_lint_attrs) + } +} + +impl LintLevelProvider for EarlyContext<'_> { + fn get_lint_level(&self, lint: &'static Lint) -> LevelAndSource { + self.builder.lint_level(lint) + } +} From fc36a7c546dd975142061fc718c8c4708bdd5aed Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 15 Feb 2022 00:38:37 +0100 Subject: [PATCH 6/7] Add internal nightly lint to test nightly features --- clippy_lints/src/lib.rs | 1 + clippy_lints/src/utils/internal_lints.rs | 33 +++++++++++++++++++ .../clippy_nightly_lints_disabled.rs | 8 +++++ .../clippy_nightly_lints_enabled.rs | 8 +++++ .../clippy_nightly_lints_enabled.stderr | 10 ++++++ 5 files changed, 60 insertions(+) create mode 100644 tests/ui-internal/clippy_nightly_lints_disabled.rs create mode 100644 tests/ui-internal/clippy_nightly_lints_enabled.rs create mode 100644 tests/ui-internal/clippy_nightly_lints_enabled.stderr diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index c1d9d18539bb..c246f425dd26 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -498,6 +498,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: { store.register_early_pass(|| Box::new(utils::internal_lints::ClippyLintsInternal)); store.register_early_pass(|| Box::new(utils::internal_lints::ProduceIce)); + store.register_early_pass(|| Box::new(utils::internal_lints::ForeverNightlyLint)); store.register_late_pass(|| Box::new(utils::inspector::DeepCodeInspector)); store.register_late_pass(|| Box::new(utils::internal_lints::CollapsibleCalls)); store.register_late_pass(|| Box::new(utils::internal_lints::CompilerLintFunctions::new())); diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 11c90647ccc0..849c9b9f3f76 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -338,6 +338,21 @@ declare_clippy_lint! { "found clippy lint without `clippy::version` attribute" } +declare_clippy_lint! { + /// ### What it does + /// Not an actual lint. This lint is only meant for testing lints with the + /// version set to `nightly` + /// + /// ### Why is this bad? + /// This lint will never be seen by the end user. This text is therefore just + /// waisted storage space ^^ + /// + #[clippy::version = "nightly"] + pub FOREVER_NIGHTLY_LINT, + internal_warn, + "achivement: you found a nightly lint (+1xp)" +} + declare_lint_pass!(ClippyLintsInternal => [CLIPPY_LINTS_INTERNAL]); impl EarlyLintPass for ClippyLintsInternal { @@ -652,6 +667,24 @@ fn is_trigger_fn(fn_kind: FnKind<'_>) -> bool { } } +declare_lint_pass!(ForeverNightlyLint => [FOREVER_NIGHTLY_LINT]); + +impl EarlyLintPass for ForeverNightlyLint { + fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: Span, _: NodeId) { + match fn_kind { + FnKind::Fn(_, ident, ..) if ident.name.as_str() == "trigger_forever_nightly_lint" => { + span_lint( + cx, + FOREVER_NIGHTLY_LINT, + ident.span, + "this triggered a lint that should only be available on nightly", + ); + }, + _ => {}, + } + } +} + declare_lint_pass!(CollapsibleCalls => [COLLAPSIBLE_SPAN_LINT_CALLS]); impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls { diff --git a/tests/ui-internal/clippy_nightly_lints_disabled.rs b/tests/ui-internal/clippy_nightly_lints_disabled.rs new file mode 100644 index 000000000000..c4054c83a96a --- /dev/null +++ b/tests/ui-internal/clippy_nightly_lints_disabled.rs @@ -0,0 +1,8 @@ +// rustc-env:CLIPPY_NIGHTLY=0 + +// This should trigger `clippy::forever_nightly_lint` +// The lint is warn by default + +fn trigger_forever_nightly_lint() {} + +fn main() {} diff --git a/tests/ui-internal/clippy_nightly_lints_enabled.rs b/tests/ui-internal/clippy_nightly_lints_enabled.rs new file mode 100644 index 000000000000..3bb51cd69ccc --- /dev/null +++ b/tests/ui-internal/clippy_nightly_lints_enabled.rs @@ -0,0 +1,8 @@ +// rustc-env:CLIPPY_NIGHTLY=1 + +// This should trigger `clippy::forever_nightly_lint` +// The lint is warn by default + +fn trigger_forever_nightly_lint() {} + +fn main() {} diff --git a/tests/ui-internal/clippy_nightly_lints_enabled.stderr b/tests/ui-internal/clippy_nightly_lints_enabled.stderr new file mode 100644 index 000000000000..22d3ddb3ed31 --- /dev/null +++ b/tests/ui-internal/clippy_nightly_lints_enabled.stderr @@ -0,0 +1,10 @@ +error: this triggered a lint that should only be available on nightly + --> $DIR/clippy_nightly_lints_enabled.rs:6:4 + | +LL | fn trigger_forever_nightly_lint() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::forever-nightly-lint` implied by `-D warnings` + +error: aborting due to previous error + From 0c7e481c345f8a046a9a9f1be6646cd2817282bb Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 15 Feb 2022 15:30:23 +0100 Subject: [PATCH 7/7] Fix CI and force inline for nightly functions --- clippy_dev/src/update_lints.rs | 3 ++- clippy_lints/src/lib.nightly_lints.rs | 4 ++-- clippy_utils/src/nightly.rs | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index bff6aaab9b14..90c88a7b1c9f 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -329,12 +329,13 @@ fn gen_nightly_lint_list<'a>( internal_lints: impl Iterator, usable_lints: impl Iterator, ) -> String { - let details: Vec<_> = internal_lints + let mut details: Vec<_> = internal_lints .map(|l| (false, l)) .chain(usable_lints.map(|l| (true, l))) .filter(|(_, l)| l.version.as_ref().map_or(false, |v| v == "nightly")) .map(|(p, l)| (p, &l.module, l.name.to_uppercase())) .collect(); + details.sort_unstable(); let mut output = GENERATED_FILE_COMMENT.to_string(); output.push_str("clippy_utils::nightly::set_nightly_lints([\n"); diff --git a/clippy_lints/src/lib.nightly_lints.rs b/clippy_lints/src/lib.nightly_lints.rs index fb5b89e5b96f..22ccf47c49d1 100644 --- a/clippy_lints/src/lib.nightly_lints.rs +++ b/clippy_lints/src/lib.nightly_lints.rs @@ -5,8 +5,8 @@ clippy_utils::nightly::set_nightly_lints([ #[cfg(feature = "internal")] LintId::of(utils::internal_lints::FOREVER_NIGHTLY_LINT), - LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR), LintId::of(borrow_as_ptr::BORROW_AS_PTR), - LintId::of(manual_bits::MANUAL_BITS), LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION), + LintId::of(manual_bits::MANUAL_BITS), + LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR), ]) diff --git a/clippy_utils/src/nightly.rs b/clippy_utils/src/nightly.rs index 8d2ecfcd19ec..43061e126993 100644 --- a/clippy_utils/src/nightly.rs +++ b/clippy_utils/src/nightly.rs @@ -69,6 +69,7 @@ pub fn is_nightly_lint(lint: &'static Lint) -> bool { /// This function checks if the given lint is a nightly lint and should be suppressed in the current /// context. +#[inline] pub fn suppress_lint(cx: &T, lint: &'static Lint) -> bool { if !is_nightly_run() && is_nightly_lint(lint) { let (_, level_src) = cx.get_lint_level(lint);