Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4aa20d2

Browse files
committed
deprecate maybe_misused_cfg
1 parent 28e887f commit 4aa20d2

12 files changed

+43
-217
lines changed

clippy_lints/src/attrs/maybe_misused_cfg.rs

Lines changed: 0 additions & 51 deletions
This file was deleted.

clippy_lints/src/attrs/mod.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ mod deprecated_semver;
77
mod duplicated_attributes;
88
mod empty_line_after;
99
mod inline_always;
10-
mod maybe_misused_cfg;
1110
mod mismatched_target_os;
1211
mod mixed_attributes_style;
1312
mod non_minimal_cfg;
@@ -391,38 +390,6 @@ declare_clippy_lint! {
391390
"ensure that all `cfg(any())` and `cfg(all())` have more than one condition"
392391
}
393392

394-
declare_clippy_lint! {
395-
/// ### What it does
396-
/// Checks for `#[cfg(features = "...")]` and suggests to replace it with
397-
/// `#[cfg(feature = "...")]`.
398-
///
399-
/// It also checks if `cfg(test)` was misspelled.
400-
///
401-
/// ### Why is this bad?
402-
/// Misspelling `feature` as `features` or `test` as `tests` can be sometimes hard to spot. It
403-
/// may cause conditional compilation not work quietly.
404-
///
405-
/// ### Example
406-
/// ```no_run
407-
/// #[cfg(features = "some-feature")]
408-
/// fn conditional() { }
409-
/// #[cfg(tests)]
410-
/// mod tests { }
411-
/// ```
412-
///
413-
/// Use instead:
414-
/// ```no_run
415-
/// #[cfg(feature = "some-feature")]
416-
/// fn conditional() { }
417-
/// #[cfg(test)]
418-
/// mod tests { }
419-
/// ```
420-
#[clippy::version = "1.69.0"]
421-
pub MAYBE_MISUSED_CFG,
422-
suspicious,
423-
"prevent from misusing the wrong attr name"
424-
}
425-
426393
declare_clippy_lint! {
427394
/// ### What it does
428395
/// Checks for `#[cfg_attr(feature = "cargo-clippy", ...)]` and for
@@ -616,7 +583,6 @@ impl_lint_pass!(EarlyAttributes => [
616583
EMPTY_LINE_AFTER_OUTER_ATTR,
617584
EMPTY_LINE_AFTER_DOC_COMMENTS,
618585
NON_MINIMAL_CFG,
619-
MAYBE_MISUSED_CFG,
620586
DEPRECATED_CLIPPY_CFG_ATTR,
621587
UNNECESSARY_CLIPPY_CFG,
622588
]);
@@ -631,7 +597,6 @@ impl EarlyLintPass for EarlyAttributes {
631597
deprecated_cfg_attr::check_clippy(cx, attr);
632598
mismatched_target_os::check(cx, attr);
633599
non_minimal_cfg::check(cx, attr);
634-
maybe_misused_cfg::check(cx, attr);
635600
}
636601

637602
extract_msrv_attr!(EarlyContext);

clippy_lints/src/declared_lints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
5858
crate::attrs::EMPTY_LINE_AFTER_DOC_COMMENTS_INFO,
5959
crate::attrs::EMPTY_LINE_AFTER_OUTER_ATTR_INFO,
6060
crate::attrs::INLINE_ALWAYS_INFO,
61-
crate::attrs::MAYBE_MISUSED_CFG_INFO,
6261
crate::attrs::MISMATCHED_TARGET_OS_INFO,
6362
crate::attrs::MIXED_ATTRIBUTES_STYLE_INFO,
6463
crate::attrs::NON_MINIMAL_CFG_INFO,

clippy_lints/src/deprecated_lints.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,16 @@ declare_deprecated_lint! {
215215
pub WRONG_PUB_SELF_CONVENTION,
216216
"set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"
217217
}
218+
219+
declare_deprecated_lint! {
220+
/// ### What it does
221+
/// Nothing. This lint has been deprecated.
222+
///
223+
/// ### Deprecation reason
224+
/// This lint has been superseded by rustc's own [`unexpected_cfgs`] lint that is able to detect the `#[cfg(features)]` and `#[cfg(tests)]` typos.
225+
///
226+
/// [`unexpected_cfgs`]: https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#unexpected-cfgs
227+
#[clippy::version = "1.80.0"]
228+
pub MAYBE_MISUSED_CFG,
229+
"this lint has been replaced by `unexpected_cfgs`"
230+
}

clippy_lints/src/lib.deprecated.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@
6767
"clippy::wrong_pub_self_convention",
6868
"set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items",
6969
);
70+
store.register_removed(
71+
"clippy::maybe_misused_cfg",
72+
"this lint has been replaced by `unexpected_cfgs`",
73+
);
7074
}

tests/ui/cfg_features.fixed

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/cfg_features.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/cfg_features.stderr

Lines changed: 0 additions & 53 deletions
This file was deleted.

tests/ui/deprecated.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
#![warn(clippy::filter_map)]
1919
#![warn(clippy::pub_enum_variant_names)]
2020
#![warn(clippy::wrong_pub_self_convention)]
21+
#![warn(clippy::maybe_misused_cfg)]
2122

2223
fn main() {}

tests/ui/deprecated.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,11 @@ error: lint `clippy::wrong_pub_self_convention` has been removed: set the `avoid
9797
LL | #![warn(clippy::wrong_pub_self_convention)]
9898
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9999

100-
error: aborting due to 16 previous errors
100+
error: lint `clippy::maybe_misused_cfg` has been removed: this lint has been replaced by `unexpected_cfgs`
101+
--> tests/ui/deprecated.rs:21:9
102+
|
103+
LL | #![warn(clippy::maybe_misused_cfg)]
104+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
105+
106+
error: aborting due to 17 previous errors
101107

0 commit comments

Comments
 (0)