rust-clippy/tests/ui/mismatched_target_os_unix.fixed

63 lines
1 KiB
Rust
Raw Normal View History

2020-04-22 21:01:25 +00:00
// run-rustfix
#![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() {}
2020-04-26 19:26:19 +00:00
#[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
2020-04-26 19:26:19 +00:00
#[cfg(all(not(any(target_os = "solaris", target_os = "linux")), target_os = "freebsd"))]
2020-04-22 21:01:25 +00:00
fn list() {}
// correct use, should be ignored
#[cfg(target_os = "freebsd")]
2020-04-26 19:26:19 +00:00
fn correct() {}
2020-04-22 21:01:25 +00:00
fn main() {}