about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-03 08:57:34 +0000
committerbors <bors@rust-lang.org>2024-06-03 08:57:34 +0000
commit4f3180adac9ff2da34c319fe17baa19e2580d09b (patch)
treed756186e1757b19d901f8c2b1a0e4374c15acea1
parent61d3e14718eab691d655a427af3d34c2a8bbd797 (diff)
parentf950961c4270e9954e9c087417b53ab25b9ab48d (diff)
downloadrust-4f3180adac9ff2da34c319fe17baa19e2580d09b.tar.gz
rust-4f3180adac9ff2da34c319fe17baa19e2580d09b.zip
Auto merge of #12875 - y21:deprecate_cfg_lints, r=flip1995
Deprecate `maybe_misused_cfg` and `mismatched_target_os`

All cases that these two lints would catch are now caught by cargo/rustc's own check-cfg feature.

This was previously discussed on zulip: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Deprecate.20maybe_misused_cfg.20and.20mismatched_target_os

For the most part, this PR was automated with `cargo dev deprecate`

r? `@flip1995` cc `@Urgau`

changelog: deprecate [`maybe_misused_cfg`] and [`mismatched_target_os`]
-rw-r--r--clippy_lints/src/attrs/maybe_misused_cfg.rs51
-rw-r--r--clippy_lints/src/attrs/mismatched_target_os.rs90
-rw-r--r--clippy_lints/src/attrs/mod.rs71
-rw-r--r--clippy_lints/src/declared_lints.rs2
-rw-r--r--clippy_lints/src/deprecated_lints.rs26
-rw-r--r--clippy_lints/src/lib.deprecated.rs8
-rw-r--r--tests/ui/cfg_features.fixed29
-rw-r--r--tests/ui/cfg_features.rs29
-rw-r--r--tests/ui/cfg_features.stderr53
-rw-r--r--tests/ui/deprecated.rs2
-rw-r--r--tests/ui/deprecated.stderr14
-rw-r--r--tests/ui/mismatched_target_os_non_unix.fixed25
-rw-r--r--tests/ui/mismatched_target_os_non_unix.rs25
-rw-r--r--tests/ui/mismatched_target_os_non_unix.stderr37
-rw-r--r--tests/ui/mismatched_target_os_unix.fixed60
-rw-r--r--tests/ui/mismatched_target_os_unix.rs60
-rw-r--r--tests/ui/mismatched_target_os_unix.stderr184
-rw-r--r--tests/ui/unnecessary_clippy_cfg.rs8
-rw-r--r--tests/ui/unnecessary_clippy_cfg.stderr28
19 files changed, 67 insertions, 735 deletions
diff --git a/clippy_lints/src/attrs/maybe_misused_cfg.rs b/clippy_lints/src/attrs/maybe_misused_cfg.rs
deleted file mode 100644
index e6b2e835be8..00000000000
--- a/clippy_lints/src/attrs/maybe_misused_cfg.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use super::{Attribute, MAYBE_MISUSED_CFG};
-use clippy_utils::diagnostics::span_lint_and_sugg;
-use rustc_ast::{MetaItemKind, NestedMetaItem};
-use rustc_errors::Applicability;
-use rustc_lint::EarlyContext;
-use rustc_span::sym;
-
-pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) {
-    if attr.has_name(sym::cfg)
-        && let Some(items) = attr.meta_item_list()
-    {
-        check_nested_misused_cfg(cx, &items);
-    }
-}
-
-fn check_nested_misused_cfg(cx: &EarlyContext<'_>, items: &[NestedMetaItem]) {
-    for item in items {
-        if let NestedMetaItem::MetaItem(meta) = item {
-            if let Some(ident) = meta.ident()
-                && ident.name.as_str() == "features"
-                && let Some(val) = meta.value_str()
-            {
-                span_lint_and_sugg(
-                    cx,
-                    MAYBE_MISUSED_CFG,
-                    meta.span,
-                    "'feature' may be misspelled as 'features'",
-                    "did you mean",
-                    format!("feature = \"{val}\""),
-                    Applicability::MaybeIncorrect,
-                );
-            }
-            if let MetaItemKind::List(list) = &meta.kind {
-                check_nested_misused_cfg(cx, list);
-            // If this is not a list, then we check for `cfg(test)`.
-            } else if let Some(ident) = meta.ident()
-                && matches!(ident.name.as_str(), "tests" | "Test")
-            {
-                span_lint_and_sugg(
-                    cx,
-                    MAYBE_MISUSED_CFG,
-                    meta.span,
-                    format!("'test' may be misspelled as '{}'", ident.name.as_str()),
-                    "did you mean",
-                    "test".to_string(),
-                    Applicability::MaybeIncorrect,
-                );
-            }
-        }
-    }
-}
diff --git a/clippy_lints/src/attrs/mismatched_target_os.rs b/clippy_lints/src/attrs/mismatched_target_os.rs
deleted file mode 100644
index b1cc0a763c5..00000000000
--- a/clippy_lints/src/attrs/mismatched_target_os.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-use super::{Attribute, MISMATCHED_TARGET_OS};
-use clippy_utils::diagnostics::span_lint_and_then;
-use rustc_ast::{MetaItemKind, NestedMetaItem};
-use rustc_errors::Applicability;
-use rustc_lint::EarlyContext;
-use rustc_span::{sym, Span};
-
-static UNIX_SYSTEMS: &[&str] = &[
-    "android",
-    "dragonfly",
-    "emscripten",
-    "freebsd",
-    "fuchsia",
-    "haiku",
-    "illumos",
-    "ios",
-    "l4re",
-    "linux",
-    "macos",
-    "netbsd",
-    "openbsd",
-    "redox",
-    "solaris",
-    "vxworks",
-];
-
-// NOTE: windows is excluded from the list because it's also a valid target family.
-static NON_UNIX_SYSTEMS: &[&str] = &["hermit", "none", "wasi"];
-
-pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) {
-    fn find_os(name: &str) -> Option<&'static str> {
-        UNIX_SYSTEMS
-            .iter()
-            .chain(NON_UNIX_SYSTEMS.iter())
-            .find(|&&os| os == name)
-            .copied()
-    }
-
-    fn is_unix(name: &str) -> bool {
-        UNIX_SYSTEMS.iter().any(|&os| os == name)
-    }
-
-    fn find_mismatched_target_os(items: &[NestedMetaItem]) -> Vec<(&str, Span)> {
-        let mut mismatched = Vec::new();
-
-        for item in items {
-            if let NestedMetaItem::MetaItem(meta) = item {
-                match &meta.kind {
-                    MetaItemKind::List(list) => {
-                        mismatched.extend(find_mismatched_target_os(list));
-                    },
-                    MetaItemKind::Word => {
-                        if let Some(ident) = meta.ident()
-                            && let Some(os) = find_os(ident.name.as_str())
-                        {
-                            mismatched.push((os, ident.span));
-                        }
-                    },
-                    MetaItemKind::NameValue(..) => {},
-                }
-            }
-        }
-
-        mismatched
-    }
-
-    if attr.has_name(sym::cfg)
-        && let Some(list) = attr.meta_item_list()
-        && let mismatched = find_mismatched_target_os(&list)
-        && !mismatched.is_empty()
-    {
-        let mess = "operating system used in target family position";
-
-        span_lint_and_then(cx, MISMATCHED_TARGET_OS, attr.span, mess, |diag| {
-            // Avoid showing the unix suggestion multiple times in case
-            // we have more than one mismatch for unix-like systems
-            let mut unix_suggested = false;
-
-            for (os, span) in mismatched {
-                let sugg = format!("target_os = \"{os}\"");
-                diag.span_suggestion(span, "try", sugg, Applicability::MaybeIncorrect);
-
-                if !unix_suggested && is_unix(os) {
-                    diag.help("did you mean `unix`?");
-                    unix_suggested = true;
-                }
-            }
-        });
-    }
-}
diff --git a/clippy_lints/src/attrs/mod.rs b/clippy_lints/src/attrs/mod.rs
index a24bd5ed44b..83c828e8e22 100644
--- a/clippy_lints/src/attrs/mod.rs
+++ b/clippy_lints/src/attrs/mod.rs
@@ -7,8 +7,6 @@ mod deprecated_semver;
 mod duplicated_attributes;
 mod empty_line_after;
 mod inline_always;
-mod maybe_misused_cfg;
-mod mismatched_target_os;
 mod mixed_attributes_style;
 mod non_minimal_cfg;
 mod should_panic_without_expect;
@@ -272,39 +270,6 @@ declare_clippy_lint! {
 
 declare_clippy_lint! {
     /// ### What it does
-    /// Checks for cfg attributes having operating systems used in target family position.
-    ///
-    /// ### Why is this bad?
-    /// The configuration option will not be recognised and the related item will not be included
-    /// by the conditional compilation engine.
-    ///
-    /// ### Example
-    /// ```no_run
-    /// #[cfg(linux)]
-    /// fn conditional() { }
-    /// ```
-    ///
-    /// Use instead:
-    /// ```no_run
-    /// # mod hidden {
-    /// #[cfg(target_os = "linux")]
-    /// fn conditional() { }
-    /// # }
-    ///
-    /// // or
-    ///
-    /// #[cfg(unix)]
-    /// fn conditional() { }
-    /// ```
-    /// Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details.
-    #[clippy::version = "1.45.0"]
-    pub MISMATCHED_TARGET_OS,
-    correctness,
-    "usage of `cfg(operating_system)` instead of `cfg(target_os = \"operating_system\")`"
-}
-
-declare_clippy_lint! {
-    /// ### What it does
     /// Checks for attributes that allow lints without a reason.
     ///
     /// (This requires the `lint_reasons` feature)
@@ -393,38 +358,6 @@ declare_clippy_lint! {
 
 declare_clippy_lint! {
     /// ### What it does
-    /// Checks for `#[cfg(features = "...")]` and suggests to replace it with
-    /// `#[cfg(feature = "...")]`.
-    ///
-    /// It also checks if `cfg(test)` was misspelled.
-    ///
-    /// ### Why is this bad?
-    /// Misspelling `feature` as `features` or `test` as `tests` can be sometimes hard to spot. It
-    /// may cause conditional compilation not work quietly.
-    ///
-    /// ### Example
-    /// ```no_run
-    /// #[cfg(features = "some-feature")]
-    /// fn conditional() { }
-    /// #[cfg(tests)]
-    /// mod tests { }
-    /// ```
-    ///
-    /// Use instead:
-    /// ```no_run
-    /// #[cfg(feature = "some-feature")]
-    /// fn conditional() { }
-    /// #[cfg(test)]
-    /// mod tests { }
-    /// ```
-    #[clippy::version = "1.69.0"]
-    pub MAYBE_MISUSED_CFG,
-    suspicious,
-    "prevent from misusing the wrong attr name"
-}
-
-declare_clippy_lint! {
-    /// ### What it does
     /// Checks for `#[cfg_attr(feature = "cargo-clippy", ...)]` and for
     /// `#[cfg(feature = "cargo-clippy")]` and suggests to replace it with
     /// `#[cfg_attr(clippy, ...)]` or `#[cfg(clippy)]`.
@@ -612,11 +545,9 @@ pub struct EarlyAttributes {
 
 impl_lint_pass!(EarlyAttributes => [
     DEPRECATED_CFG_ATTR,
-    MISMATCHED_TARGET_OS,
     EMPTY_LINE_AFTER_OUTER_ATTR,
     EMPTY_LINE_AFTER_DOC_COMMENTS,
     NON_MINIMAL_CFG,
-    MAYBE_MISUSED_CFG,
     DEPRECATED_CLIPPY_CFG_ATTR,
     UNNECESSARY_CLIPPY_CFG,
 ]);
@@ -629,9 +560,7 @@ impl EarlyLintPass for EarlyAttributes {
     fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) {
         deprecated_cfg_attr::check(cx, attr, &self.msrv);
         deprecated_cfg_attr::check_clippy(cx, attr);
-        mismatched_target_os::check(cx, attr);
         non_minimal_cfg::check(cx, attr);
-        maybe_misused_cfg::check(cx, attr);
     }
 
     extract_msrv_attr!(EarlyContext);
diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs
index 13adc46a53f..a4948e36fbe 100644
--- a/clippy_lints/src/declared_lints.rs
+++ b/clippy_lints/src/declared_lints.rs
@@ -58,8 +58,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
     crate::attrs::EMPTY_LINE_AFTER_DOC_COMMENTS_INFO,
     crate::attrs::EMPTY_LINE_AFTER_OUTER_ATTR_INFO,
     crate::attrs::INLINE_ALWAYS_INFO,
-    crate::attrs::MAYBE_MISUSED_CFG_INFO,
-    crate::attrs::MISMATCHED_TARGET_OS_INFO,
     crate::attrs::MIXED_ATTRIBUTES_STYLE_INFO,
     crate::attrs::NON_MINIMAL_CFG_INFO,
     crate::attrs::SHOULD_PANIC_WITHOUT_EXPECT_INFO,
diff --git a/clippy_lints/src/deprecated_lints.rs b/clippy_lints/src/deprecated_lints.rs
index 9aa5af3190f..a0900f46f6a 100644
--- a/clippy_lints/src/deprecated_lints.rs
+++ b/clippy_lints/src/deprecated_lints.rs
@@ -215,3 +215,29 @@ declare_deprecated_lint! {
     pub WRONG_PUB_SELF_CONVENTION,
     "set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"
 }
+
+declare_deprecated_lint! {
+    /// ### What it does
+    /// Nothing. This lint has been deprecated.
+    ///
+    /// ### Deprecation reason
+    /// This lint has been superseded by rustc's own [`unexpected_cfgs`] lint that is able to detect the `#[cfg(features)]` and `#[cfg(tests)]` typos.
+    ///
+    /// [`unexpected_cfgs`]: https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#unexpected-cfgs
+    #[clippy::version = "1.80.0"]
+    pub MAYBE_MISUSED_CFG,
+    "this lint has been replaced by `unexpected_cfgs`"
+}
+
+declare_deprecated_lint! {
+    /// ### What it does
+    /// Nothing. This lint has been deprecated.
+    ///
+    /// ### Deprecation reason
+    /// This lint has been superseded by rustc's own [`unexpected_cfgs`] lint that is able to detect invalid `#[cfg(linux)]` attributes.
+    ///
+    /// [`unexpected_cfgs`]: https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#unexpected-cfgs
+    #[clippy::version = "1.80.0"]
+    pub MISMATCHED_TARGET_OS,
+    "this lint has been replaced by `unexpected_cfgs`"
+}
diff --git a/clippy_lints/src/lib.deprecated.rs b/clippy_lints/src/lib.deprecated.rs
index 80bde1b1138..0d21261822d 100644
--- a/clippy_lints/src/lib.deprecated.rs
+++ b/clippy_lints/src/lib.deprecated.rs
@@ -67,4 +67,12 @@
         "clippy::wrong_pub_self_convention",
         "set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items",
     );
+    store.register_removed(
+        "clippy::maybe_misused_cfg",
+        "this lint has been replaced by `unexpected_cfgs`",
+    );
+    store.register_removed(
+        "clippy::mismatched_target_os",
+        "this lint has been replaced by `unexpected_cfgs`",
+    );
 }
diff --git a/tests/ui/cfg_features.fixed b/tests/ui/cfg_features.fixed
deleted file mode 100644
index 0fe38f169f9..00000000000
--- a/tests/ui/cfg_features.fixed
+++ /dev/null
@@ -1,29 +0,0 @@
-#![warn(clippy::maybe_misused_cfg)]
-
-fn main() {
-    #[cfg(feature = "not-really-a-feature")]
-    //~^ ERROR: 'feature' may be misspelled as 'features'
-    //~| NOTE: `-D clippy::maybe-misused-cfg` implied by `-D warnings`
-    let _ = 1 + 2;
-
-    #[cfg(all(feature = "right", feature = "wrong"))]
-    //~^ ERROR: 'feature' may be misspelled as 'features'
-    let _ = 1 + 2;
-
-    #[cfg(all(feature = "wrong1", any(feature = "right", feature = "wrong2", feature, features)))]
-    //~^ ERROR: 'feature' may be misspelled as 'features'
-    //~| ERROR: 'feature' may be misspelled as 'features'
-    let _ = 1 + 2;
-
-    #[cfg(test)]
-    //~^ ERROR: 'test' may be misspelled as 'tests'
-    let _ = 2;
-    #[cfg(test)]
-    //~^ ERROR: 'test' may be misspelled as 'Test'
-    let _ = 2;
-
-    #[cfg(all(test, test))]
-    //~^ ERROR: 'test' may be misspelled as 'tests'
-    //~| ERROR: 'test' may be misspelled as 'Test'
-    let _ = 2;
-}
diff --git a/tests/ui/cfg_features.rs b/tests/ui/cfg_features.rs
deleted file mode 100644
index 9c0db035eac..00000000000
--- a/tests/ui/cfg_features.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#![warn(clippy::maybe_misused_cfg)]
-
-fn main() {
-    #[cfg(features = "not-really-a-feature")]
-    //~^ ERROR: 'feature' may be misspelled as 'features'
-    //~| NOTE: `-D clippy::maybe-misused-cfg` implied by `-D warnings`
-    let _ = 1 + 2;
-
-    #[cfg(all(feature = "right", features = "wrong"))]
-    //~^ ERROR: 'feature' may be misspelled as 'features'
-    let _ = 1 + 2;
-
-    #[cfg(all(features = "wrong1", any(feature = "right", features = "wrong2", feature, features)))]
-    //~^ ERROR: 'feature' may be misspelled as 'features'
-    //~| ERROR: 'feature' may be misspelled as 'features'
-    let _ = 1 + 2;
-
-    #[cfg(tests)]
-    //~^ ERROR: 'test' may be misspelled as 'tests'
-    let _ = 2;
-    #[cfg(Test)]
-    //~^ ERROR: 'test' may be misspelled as 'Test'
-    let _ = 2;
-
-    #[cfg(all(tests, Test))]
-    //~^ ERROR: 'test' may be misspelled as 'tests'
-    //~| ERROR: 'test' may be misspelled as 'Test'
-    let _ = 2;
-}
diff --git a/tests/ui/cfg_features.stderr b/tests/ui/cfg_features.stderr
deleted file mode 100644
index d576271f1a2..00000000000
--- a/tests/ui/cfg_features.stderr
+++ /dev/null
@@ -1,53 +0,0 @@
-error: 'feature' may be misspelled as 'features'
-  --> tests/ui/cfg_features.rs:4:11
-   |
-LL |     #[cfg(features = "not-really-a-feature")]
-   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `feature = "not-really-a-feature"`
-   |
-   = note: `-D clippy::maybe-misused-cfg` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::maybe_misused_cfg)]`
-
-error: 'feature' may be misspelled as 'features'
-  --> tests/ui/cfg_features.rs:9:34
-   |
-LL |     #[cfg(all(feature = "right", features = "wrong"))]
-   |                                  ^^^^^^^^^^^^^^^^^^ help: did you mean: `feature = "wrong"`
-
-error: 'feature' may be misspelled as 'features'
-  --> tests/ui/cfg_features.rs:13:15
-   |
-LL |     #[cfg(all(features = "wrong1", any(feature = "right", features = "wrong2", feature, features)))]
-   |               ^^^^^^^^^^^^^^^^^^^ help: did you mean: `feature = "wrong1"`
-
-error: 'feature' may be misspelled as 'features'
-  --> tests/ui/cfg_features.rs:13:59
-   |
-LL |     #[cfg(all(features = "wrong1", any(feature = "right", features = "wrong2", feature, features)))]
-   |                                                           ^^^^^^^^^^^^^^^^^^^ help: did you mean: `feature = "wrong2"`
-
-error: 'test' may be misspelled as 'tests'
-  --> tests/ui/cfg_features.rs:18:11
-   |
-LL |     #[cfg(tests)]
-   |           ^^^^^ help: did you mean: `test`
-
-error: 'test' may be misspelled as 'Test'
-  --> tests/ui/cfg_features.rs:21:11
-   |
-LL |     #[cfg(Test)]
-   |           ^^^^ help: did you mean: `test`
-
-error: 'test' may be misspelled as 'tests'
-  --> tests/ui/cfg_features.rs:25:15
-   |
-LL |     #[cfg(all(tests, Test))]
-   |               ^^^^^ help: did you mean: `test`
-
-error: 'test' may be misspelled as 'Test'
-  --> tests/ui/cfg_features.rs:25:22
-   |
-LL |     #[cfg(all(tests, Test))]
-   |                      ^^^^ help: did you mean: `test`
-
-error: aborting due to 8 previous errors
-
diff --git a/tests/ui/deprecated.rs b/tests/ui/deprecated.rs
index 07270bd7636..d3c34fb3716 100644
--- a/tests/ui/deprecated.rs
+++ b/tests/ui/deprecated.rs
@@ -18,5 +18,7 @@
 #![warn(clippy::filter_map)]
 #![warn(clippy::pub_enum_variant_names)]
 #![warn(clippy::wrong_pub_self_convention)]
+#![warn(clippy::maybe_misused_cfg)]
+#![warn(clippy::mismatched_target_os)]
 
 fn main() {}
diff --git a/tests/ui/deprecated.stderr b/tests/ui/deprecated.stderr
index a9cf04bea52..49b90c70c06 100644
--- a/tests/ui/deprecated.stderr
+++ b/tests/ui/deprecated.stderr
@@ -97,5 +97,17 @@ error: lint `clippy::wrong_pub_self_convention` has been removed: set the `avoid
 LL | #![warn(clippy::wrong_pub_self_convention)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 16 previous errors
+error: lint `clippy::maybe_misused_cfg` has been removed: this lint has been replaced by `unexpected_cfgs`
+  --> tests/ui/deprecated.rs:21:9
+   |
+LL | #![warn(clippy::maybe_misused_cfg)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: lint `clippy::mismatched_target_os` has been removed: this lint has been replaced by `unexpected_cfgs`
+  --> tests/ui/deprecated.rs:22:9
+   |
+LL | #![warn(clippy::mismatched_target_os)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 18 previous errors
 
diff --git a/tests/ui/mismatched_target_os_non_unix.fixed b/tests/ui/mismatched_target_os_non_unix.fixed
deleted file mode 100644
index de02b2bee31..00000000000
--- a/tests/ui/mismatched_target_os_non_unix.fixed
+++ /dev/null
@@ -1,25 +0,0 @@
-#![warn(clippy::mismatched_target_os)]
-#![allow(unused)]
-
-#[cfg(target_os = "hermit")]
-fn hermit() {}
-
-#[cfg(target_os = "wasi")]
-fn wasi() {}
-
-#[cfg(target_os = "none")]
-fn none() {}
-
-// list with conditions
-#[cfg(all(not(windows), target_os = "wasi"))]
-fn list() {}
-
-// windows is a valid target family, should be ignored
-#[cfg(windows)]
-fn windows() {}
-
-// correct use, should be ignored
-#[cfg(target_os = "hermit")]
-fn correct() {}
-
-fn main() {}
diff --git a/tests/ui/mismatched_target_os_non_unix.rs b/tests/ui/mismatched_target_os_non_unix.rs
deleted file mode 100644
index a960518751b..00000000000
--- a/tests/ui/mismatched_target_os_non_unix.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-#![warn(clippy::mismatched_target_os)]
-#![allow(unused)]
-
-#[cfg(hermit)]
-fn hermit() {}
-
-#[cfg(wasi)]
-fn wasi() {}
-
-#[cfg(none)]
-fn none() {}
-
-// list with conditions
-#[cfg(all(not(windows), wasi))]
-fn list() {}
-
-// windows is a valid target family, should be ignored
-#[cfg(windows)]
-fn windows() {}
-
-// correct use, should be ignored
-#[cfg(target_os = "hermit")]
-fn correct() {}
-
-fn main() {}
diff --git a/tests/ui/mismatched_target_os_non_unix.stderr b/tests/ui/mismatched_target_os_non_unix.stderr
deleted file mode 100644
index 7f7a4e9d6f6..00000000000
--- a/tests/ui/mismatched_target_os_non_unix.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_non_unix.rs:4:1
-   |
-LL | #[cfg(hermit)]
-   | ^^^^^^------^^
-   |       |
-   |       help: try: `target_os = "hermit"`
-   |
-   = note: `-D clippy::mismatched-target-os` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::mismatched_target_os)]`
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_non_unix.rs:7:1
-   |
-LL | #[cfg(wasi)]
-   | ^^^^^^----^^
-   |       |
-   |       help: try: `target_os = "wasi"`
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_non_unix.rs:10:1
-   |
-LL | #[cfg(none)]
-   | ^^^^^^----^^
-   |       |
-   |       help: try: `target_os = "none"`
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_non_unix.rs:14:1
-   |
-LL | #[cfg(all(not(windows), wasi))]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^----^^^
-   |                         |
-   |                         help: try: `target_os = "wasi"`
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/mismatched_target_os_unix.fixed b/tests/ui/mismatched_target_os_unix.fixed
deleted file mode 100644
index b945c4d9619..00000000000
--- a/tests/ui/mismatched_target_os_unix.fixed
+++ /dev/null
@@ -1,60 +0,0 @@
-#![warn(clippy::mismatched_target_os)]
-#![allow(unused)]
-
-#[cfg(target_os = "linux")]
-fn linux() {}
-
-#[cfg(target_os = "freebsd")]
-fn freebsd() {}
-
-#[cfg(target_os = "dragonfly")]
-fn dragonfly() {}
-
-#[cfg(target_os = "openbsd")]
-fn openbsd() {}
-
-#[cfg(target_os = "netbsd")]
-fn netbsd() {}
-
-#[cfg(target_os = "macos")]
-fn macos() {}
-
-#[cfg(target_os = "ios")]
-fn ios() {}
-
-#[cfg(target_os = "android")]
-fn android() {}
-
-#[cfg(target_os = "emscripten")]
-fn emscripten() {}
-
-#[cfg(target_os = "fuchsia")]
-fn fuchsia() {}
-
-#[cfg(target_os = "haiku")]
-fn haiku() {}
-
-#[cfg(target_os = "illumos")]
-fn illumos() {}
-
-#[cfg(target_os = "l4re")]
-fn l4re() {}
-
-#[cfg(target_os = "redox")]
-fn redox() {}
-
-#[cfg(target_os = "solaris")]
-fn solaris() {}
-
-#[cfg(target_os = "vxworks")]
-fn vxworks() {}
-
-// list with conditions
-#[cfg(all(not(any(target_os = "solaris", target_os = "linux")), target_os = "freebsd"))]
-fn list() {}
-
-// correct use, should be ignored
-#[cfg(target_os = "freebsd")]
-fn correct() {}
-
-fn main() {}
diff --git a/tests/ui/mismatched_target_os_unix.rs b/tests/ui/mismatched_target_os_unix.rs
deleted file mode 100644
index 34307facd65..00000000000
--- a/tests/ui/mismatched_target_os_unix.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-#![warn(clippy::mismatched_target_os)]
-#![allow(unused)]
-
-#[cfg(linux)]
-fn linux() {}
-
-#[cfg(freebsd)]
-fn freebsd() {}
-
-#[cfg(dragonfly)]
-fn dragonfly() {}
-
-#[cfg(openbsd)]
-fn openbsd() {}
-
-#[cfg(netbsd)]
-fn netbsd() {}
-
-#[cfg(macos)]
-fn macos() {}
-
-#[cfg(ios)]
-fn ios() {}
-
-#[cfg(android)]
-fn android() {}
-
-#[cfg(emscripten)]
-fn emscripten() {}
-
-#[cfg(fuchsia)]
-fn fuchsia() {}
-
-#[cfg(haiku)]
-fn haiku() {}
-
-#[cfg(illumos)]
-fn illumos() {}
-
-#[cfg(l4re)]
-fn l4re() {}
-
-#[cfg(redox)]
-fn redox() {}
-
-#[cfg(solaris)]
-fn solaris() {}
-
-#[cfg(vxworks)]
-fn vxworks() {}
-
-// list with conditions
-#[cfg(all(not(any(solaris, linux)), freebsd))]
-fn list() {}
-
-// correct use, should be ignored
-#[cfg(target_os = "freebsd")]
-fn correct() {}
-
-fn main() {}
diff --git a/tests/ui/mismatched_target_os_unix.stderr b/tests/ui/mismatched_target_os_unix.stderr
deleted file mode 100644
index 3071bad1324..00000000000
--- a/tests/ui/mismatched_target_os_unix.stderr
+++ /dev/null
@@ -1,184 +0,0 @@
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:4:1
-   |
-LL | #[cfg(linux)]
-   | ^^^^^^-----^^
-   |       |
-   |       help: try: `target_os = "linux"`
-   |
-   = help: did you mean `unix`?
-   = note: `-D clippy::mismatched-target-os` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::mismatched_target_os)]`
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:7:1
-   |
-LL | #[cfg(freebsd)]
-   | ^^^^^^-------^^
-   |       |
-   |       help: try: `target_os = "freebsd"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:10:1
-   |
-LL | #[cfg(dragonfly)]
-   | ^^^^^^---------^^
-   |       |
-   |       help: try: `target_os = "dragonfly"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:13:1
-   |
-LL | #[cfg(openbsd)]
-   | ^^^^^^-------^^
-   |       |
-   |       help: try: `target_os = "openbsd"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:16:1
-   |
-LL | #[cfg(netbsd)]
-   | ^^^^^^------^^
-   |       |
-   |       help: try: `target_os = "netbsd"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:19:1
-   |
-LL | #[cfg(macos)]
-   | ^^^^^^-----^^
-   |       |
-   |       help: try: `target_os = "macos"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:22:1
-   |
-LL | #[cfg(ios)]
-   | ^^^^^^---^^
-   |       |
-   |       help: try: `target_os = "ios"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:25:1
-   |
-LL | #[cfg(android)]
-   | ^^^^^^-------^^
-   |       |
-   |       help: try: `target_os = "android"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:28:1
-   |
-LL | #[cfg(emscripten)]
-   | ^^^^^^----------^^
-   |       |
-   |       help: try: `target_os = "emscripten"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:31:1
-   |
-LL | #[cfg(fuchsia)]
-   | ^^^^^^-------^^
-   |       |
-   |       help: try: `target_os = "fuchsia"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:34:1
-   |
-LL | #[cfg(haiku)]
-   | ^^^^^^-----^^
-   |       |
-   |       help: try: `target_os = "haiku"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:37:1
-   |
-LL | #[cfg(illumos)]
-   | ^^^^^^-------^^
-   |       |
-   |       help: try: `target_os = "illumos"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:40:1
-   |
-LL | #[cfg(l4re)]
-   | ^^^^^^----^^
-   |       |
-   |       help: try: `target_os = "l4re"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:43:1
-   |
-LL | #[cfg(redox)]
-   | ^^^^^^-----^^
-   |       |
-   |       help: try: `target_os = "redox"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:46:1
-   |
-LL | #[cfg(solaris)]
-   | ^^^^^^-------^^
-   |       |
-   |       help: try: `target_os = "solaris"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:49:1
-   |
-LL | #[cfg(vxworks)]
-   | ^^^^^^-------^^
-   |       |
-   |       help: try: `target_os = "vxworks"`
-   |
-   = help: did you mean `unix`?
-
-error: operating system used in target family position
-  --> tests/ui/mismatched_target_os_unix.rs:53:1
-   |
-LL | #[cfg(all(not(any(solaris, linux)), freebsd))]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: did you mean `unix`?
-help: try
-   |
-LL | #[cfg(all(not(any(target_os = "solaris", linux)), freebsd))]
-   |                   ~~~~~~~~~~~~~~~~~~~~~
-help: try
-   |
-LL | #[cfg(all(not(any(solaris, target_os = "linux")), freebsd))]
-   |                            ~~~~~~~~~~~~~~~~~~~
-help: try
-   |
-LL | #[cfg(all(not(any(solaris, linux)), target_os = "freebsd"))]
-   |                                     ~~~~~~~~~~~~~~~~~~~~~
-
-error: aborting due to 17 previous errors
-
diff --git a/tests/ui/unnecessary_clippy_cfg.rs b/tests/ui/unnecessary_clippy_cfg.rs
index ff960520f5e..9915f8b843e 100644
--- a/tests/ui/unnecessary_clippy_cfg.rs
+++ b/tests/ui/unnecessary_clippy_cfg.rs
@@ -5,18 +5,18 @@
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
 #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
-#![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+#![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
-#![cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+#![cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
 
 #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
 #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
-#[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+#[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
-#[cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+#[cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
 //~^ ERROR: no need to put clippy lints behind a `clippy` cfg
 pub struct Bar;
 
diff --git a/tests/ui/unnecessary_clippy_cfg.stderr b/tests/ui/unnecessary_clippy_cfg.stderr
index 3d58c9eb5da..16a86165295 100644
--- a/tests/ui/unnecessary_clippy_cfg.stderr
+++ b/tests/ui/unnecessary_clippy_cfg.stderr
@@ -18,16 +18,16 @@ LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 error: no need to put clippy lints behind a `clippy` cfg
   --> tests/ui/unnecessary_clippy_cfg.rs:17:36
    |
-LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
-   |                                    ^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
+   |                                    ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: write instead: `#[deny(clippy::non_minimal_cfg,clippy::maybe_misused_cfg)]`
+   = note: write instead: `#[deny(clippy::non_minimal_cfg)]`
 
 error: no need to put clippy lints behind a `clippy` cfg
   --> tests/ui/unnecessary_clippy_cfg.rs:19:1
    |
-LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg)]`
+LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg)]`
 
 error: no need to put clippy lints behind a `clippy` cfg
   --> tests/ui/unnecessary_clippy_cfg.rs:4:1
@@ -46,21 +46,21 @@ LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 error: no need to put clippy lints behind a `clippy` cfg
   --> tests/ui/unnecessary_clippy_cfg.rs:8:37
    |
-LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
-   |                                     ^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: write instead: `#![deny(clippy::non_minimal_cfg,clippy::maybe_misused_cfg)]`
+   = note: write instead: `#![deny(clippy::non_minimal_cfg)]`
 
 error: no need to put clippy lints behind a `clippy` cfg
   --> tests/ui/unnecessary_clippy_cfg.rs:10:1
    |
-LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg)]`
+LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg)]`
 
 error: duplicated attribute
   --> tests/ui/unnecessary_clippy_cfg.rs:8:26
    |
-LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
    |                          ^^^^^^^^^
    |
 note: first defined here
@@ -71,7 +71,7 @@ LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 help: remove this attribute
   --> tests/ui/unnecessary_clippy_cfg.rs:8:26
    |
-LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
    |                          ^^^^^^^^^
    = note: `-D clippy::duplicated-attributes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]`
@@ -79,7 +79,7 @@ LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_
 error: duplicated attribute
   --> tests/ui/unnecessary_clippy_cfg.rs:17:25
    |
-LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
    |                         ^^^^^^^^^
    |
 note: first defined here
@@ -90,7 +90,7 @@ LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
 help: remove this attribute
   --> tests/ui/unnecessary_clippy_cfg.rs:17:25
    |
-LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
+LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
    |                         ^^^^^^^^^
 
 error: aborting due to 10 previous errors