]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/lib.rs
Fix regression in case of proc-macro attribute expansion
[rust.git] / clippy_lints / src / lib.rs
index 3054f11c17698afee1ee1f00a0c06c8cc6db3c57..7fcd9b7734c7ecaa338dc843b3242c2c4d4e62b5 100644 (file)
@@ -1,5 +1,6 @@
 // error-pattern:cargo-clippy
 
+#![feature(bind_by_move_pattern_guards)] // proposed to be stabilized in Rust v1.39
 #![feature(box_syntax)]
 #![feature(box_patterns)]
 #![feature(never_type)]
 #[allow(unused_extern_crates)]
 extern crate rustc_data_structures;
 #[allow(unused_extern_crates)]
+extern crate rustc_driver;
+#[allow(unused_extern_crates)]
 extern crate rustc_errors;
 #[allow(unused_extern_crates)]
 extern crate rustc_mir;
 #[allow(unused_extern_crates)]
-extern crate rustc_plugin;
-#[allow(unused_extern_crates)]
 extern crate rustc_target;
 #[allow(unused_extern_crates)]
 extern crate rustc_typeck;
@@ -320,7 +321,7 @@ pub fn register_pre_expansion_lints(
 }
 
 #[doc(hidden)]
-pub fn read_conf(reg: &rustc_plugin::Registry<'_>) -> Conf {
+pub fn read_conf(reg: &rustc_driver::plugin::Registry<'_>) -> Conf {
     match utils::conf::file_from_args(reg.args()) {
         Ok(file_name) => {
             // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
@@ -382,7 +383,7 @@ pub fn read_conf(reg: &rustc_plugin::Registry<'_>) -> Conf {
 /// Used in `./src/driver.rs`.
 #[allow(clippy::too_many_lines)]
 #[rustfmt::skip]
-pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
+pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Conf) {
     let mut store = reg.sess.lint_store.borrow_mut();
     register_removed_non_tool_lints(&mut store);
 
@@ -666,6 +667,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         replace_consts::REPLACE_CONSTS,
         shadow::SHADOW_UNRELATED,
         strings::STRING_ADD_ASSIGN,
+        trait_bounds::TYPE_REPETITION_IN_BOUNDS,
         types::CAST_POSSIBLE_TRUNCATION,
         types::CAST_POSSIBLE_WRAP,
         types::CAST_PRECISION_LOSS,
@@ -792,15 +794,19 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         methods::ITER_CLONED_COLLECT,
         methods::ITER_NTH,
         methods::ITER_SKIP_NEXT,
+        methods::MANUAL_SATURATING_ARITHMETIC,
         methods::NEW_RET_NO_SELF,
         methods::OK_EXPECT,
+        methods::OPTION_AND_THEN_SOME,
         methods::OPTION_MAP_OR_NONE,
         methods::OR_FUN_CALL,
         methods::SEARCH_IS_SOME,
         methods::SHOULD_IMPLEMENT_TRAIT,
         methods::SINGLE_CHAR_PATTERN,
         methods::STRING_EXTEND_CHARS,
+        methods::SUSPICIOUS_MAP,
         methods::TEMPORARY_CSTRING_AS_PTR,
+        methods::UNINIT_ASSUMED_INIT,
         methods::UNNECESSARY_FILTER_MAP,
         methods::UNNECESSARY_FOLD,
         methods::USELESS_ASREF,
@@ -810,7 +816,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         misc::CMP_OWNED,
         misc::FLOAT_CMP,
         misc::MODULO_ONE,
-        misc::REDUNDANT_PATTERN,
         misc::SHORT_CIRCUIT_STATEMENT,
         misc::TOPLEVEL_REF_ARG,
         misc::ZERO_PTR,
@@ -819,6 +824,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
         misc_early::MIXED_CASE_HEX_LITERALS,
         misc_early::REDUNDANT_CLOSURE_CALL,
+        misc_early::REDUNDANT_PATTERN,
         misc_early::UNNEEDED_FIELD_PATTERN,
         misc_early::ZERO_PREFIXED_LITERAL,
         mut_reference::UNNECESSARY_MUT_PASSED,
@@ -870,7 +876,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         swap::ALMOST_SWAPPED,
         swap::MANUAL_SWAP,
         temporary_assignment::TEMPORARY_ASSIGNMENT,
-        trait_bounds::TYPE_REPETITION_IN_BOUNDS,
         transmute::CROSSPOINTER_TRANSMUTE,
         transmute::TRANSMUTE_BYTES_TO_STR,
         transmute::TRANSMUTE_INT_TO_BOOL,
@@ -955,6 +960,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         methods::INTO_ITER_ON_REF,
         methods::ITER_CLONED_COLLECT,
         methods::ITER_SKIP_NEXT,
+        methods::MANUAL_SATURATING_ARITHMETIC,
         methods::NEW_RET_NO_SELF,
         methods::OK_EXPECT,
         methods::OPTION_MAP_OR_NONE,
@@ -962,13 +968,13 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         methods::STRING_EXTEND_CHARS,
         methods::UNNECESSARY_FOLD,
         methods::WRONG_SELF_CONVENTION,
-        misc::REDUNDANT_PATTERN,
         misc::TOPLEVEL_REF_ARG,
         misc::ZERO_PTR,
         misc_early::BUILTIN_TYPE_SHADOW,
         misc_early::DOUBLE_NEG,
         misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
         misc_early::MIXED_CASE_HEX_LITERALS,
+        misc_early::REDUNDANT_PATTERN,
         misc_early::UNNEEDED_FIELD_PATTERN,
         mut_reference::UNNECESSARY_MUT_PASSED,
         neg_multiply::NEG_MULTIPLY,
@@ -1032,7 +1038,9 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         methods::CLONE_ON_COPY,
         methods::FILTER_NEXT,
         methods::FLAT_MAP_IDENTITY,
+        methods::OPTION_AND_THEN_SOME,
         methods::SEARCH_IS_SOME,
+        methods::SUSPICIOUS_MAP,
         methods::UNNECESSARY_FILTER_MAP,
         methods::USELESS_ASREF,
         misc::SHORT_CIRCUIT_STATEMENT,
@@ -1056,7 +1064,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         reference::REF_IN_DEREF,
         swap::MANUAL_SWAP,
         temporary_assignment::TEMPORARY_ASSIGNMENT,
-        trait_bounds::TYPE_REPETITION_IN_BOUNDS,
         transmute::CROSSPOINTER_TRANSMUTE,
         transmute::TRANSMUTE_BYTES_TO_STR,
         transmute::TRANSMUTE_INT_TO_BOOL,
@@ -1113,6 +1120,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         methods::CLONE_DOUBLE_REF,
         methods::INTO_ITER_ON_ARRAY,
         methods::TEMPORARY_CSTRING_AS_PTR,
+        methods::UNINIT_ASSUMED_INIT,
         minmax::MIN_MAX,
         misc::CMP_NAN,
         misc::FLOAT_CMP,