Skip to content

Commit f950961

Browse files
committed
deprecate mismatched_target_os
1 parent 4aa20d2 commit f950961

13 files changed

+25
-519
lines changed

clippy_lints/src/attrs/mismatched_target_os.rs

-90
This file was deleted.

clippy_lints/src/attrs/mod.rs

-36
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 mismatched_target_os;
1110
mod mixed_attributes_style;
1211
mod non_minimal_cfg;
1312
mod should_panic_without_expect;
@@ -269,39 +268,6 @@ declare_clippy_lint! {
269268
"usage of `cfg_attr(rustfmt)` instead of tool attributes"
270269
}
271270

272-
declare_clippy_lint! {
273-
/// ### What it does
274-
/// Checks for cfg attributes having operating systems used in target family position.
275-
///
276-
/// ### Why is this bad?
277-
/// The configuration option will not be recognised and the related item will not be included
278-
/// by the conditional compilation engine.
279-
///
280-
/// ### Example
281-
/// ```no_run
282-
/// #[cfg(linux)]
283-
/// fn conditional() { }
284-
/// ```
285-
///
286-
/// Use instead:
287-
/// ```no_run
288-
/// # mod hidden {
289-
/// #[cfg(target_os = "linux")]
290-
/// fn conditional() { }
291-
/// # }
292-
///
293-
/// // or
294-
///
295-
/// #[cfg(unix)]
296-
/// fn conditional() { }
297-
/// ```
298-
/// Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details.
299-
#[clippy::version = "1.45.0"]
300-
pub MISMATCHED_TARGET_OS,
301-
correctness,
302-
"usage of `cfg(operating_system)` instead of `cfg(target_os = \"operating_system\")`"
303-
}
304-
305271
declare_clippy_lint! {
306272
/// ### What it does
307273
/// Checks for attributes that allow lints without a reason.
@@ -579,7 +545,6 @@ pub struct EarlyAttributes {
579545

580546
impl_lint_pass!(EarlyAttributes => [
581547
DEPRECATED_CFG_ATTR,
582-
MISMATCHED_TARGET_OS,
583548
EMPTY_LINE_AFTER_OUTER_ATTR,
584549
EMPTY_LINE_AFTER_DOC_COMMENTS,
585550
NON_MINIMAL_CFG,
@@ -595,7 +560,6 @@ impl EarlyLintPass for EarlyAttributes {
595560
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) {
596561
deprecated_cfg_attr::check(cx, attr, &self.msrv);
597562
deprecated_cfg_attr::check_clippy(cx, attr);
598-
mismatched_target_os::check(cx, attr);
599563
non_minimal_cfg::check(cx, attr);
600564
}
601565

clippy_lints/src/declared_lints.rs

-1
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::MISMATCHED_TARGET_OS_INFO,
6261
crate::attrs::MIXED_ATTRIBUTES_STYLE_INFO,
6362
crate::attrs::NON_MINIMAL_CFG_INFO,
6463
crate::attrs::SHOULD_PANIC_WITHOUT_EXPECT_INFO,

clippy_lints/src/deprecated_lints.rs

+13
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,16 @@ declare_deprecated_lint! {
228228
pub MAYBE_MISUSED_CFG,
229229
"this lint has been replaced by `unexpected_cfgs`"
230230
}
231+
232+
declare_deprecated_lint! {
233+
/// ### What it does
234+
/// Nothing. This lint has been deprecated.
235+
///
236+
/// ### Deprecation reason
237+
/// This lint has been superseded by rustc's own [`unexpected_cfgs`] lint that is able to detect invalid `#[cfg(linux)]` attributes.
238+
///
239+
/// [`unexpected_cfgs`]: https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#unexpected-cfgs
240+
#[clippy::version = "1.80.0"]
241+
pub MISMATCHED_TARGET_OS,
242+
"this lint has been replaced by `unexpected_cfgs`"
243+
}

clippy_lints/src/lib.deprecated.rs

+4
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,8 @@
7171
"clippy::maybe_misused_cfg",
7272
"this lint has been replaced by `unexpected_cfgs`",
7373
);
74+
store.register_removed(
75+
"clippy::mismatched_target_os",
76+
"this lint has been replaced by `unexpected_cfgs`",
77+
);
7478
}

tests/ui/deprecated.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
#![warn(clippy::pub_enum_variant_names)]
2020
#![warn(clippy::wrong_pub_self_convention)]
2121
#![warn(clippy::maybe_misused_cfg)]
22+
#![warn(clippy::mismatched_target_os)]
2223

2324
fn main() {}

tests/ui/deprecated.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,11 @@ error: lint `clippy::maybe_misused_cfg` has been removed: this lint has been rep
103103
LL | #![warn(clippy::maybe_misused_cfg)]
104104
| ^^^^^^^^^^^^^^^^^^^^^^^^^
105105

106-
error: aborting due to 17 previous errors
106+
error: lint `clippy::mismatched_target_os` has been removed: this lint has been replaced by `unexpected_cfgs`
107+
--> tests/ui/deprecated.rs:22:9
108+
|
109+
LL | #![warn(clippy::mismatched_target_os)]
110+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111+
112+
error: aborting due to 18 previous errors
107113

tests/ui/mismatched_target_os_non_unix.fixed

-25
This file was deleted.

tests/ui/mismatched_target_os_non_unix.rs

-25
This file was deleted.

tests/ui/mismatched_target_os_non_unix.stderr

-37
This file was deleted.

tests/ui/mismatched_target_os_unix.fixed

-60
This file was deleted.

0 commit comments

Comments
 (0)