-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn'tT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion
Description
Lint name: mismatched_target_os
I tried this code:
fn main() {
// Clippy throws error
//#[cfg(linux)]
//println!("Hello, Linux!");
// Clippy doesn't care
if cfg!(linux) {
println!("Hello, Linux!");
}
}
I expected to see the error operating system used in target family position
here like you would see if you used the attribute #[cfg(linux)]
Instead, clippy doesn't give any error.
Meta
Rust version (rustc -Vv
):
rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-pc-windows-msvc
release: 1.52.1
LLVM version: 12.0.0
fanzeyi
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn'tT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion