rust/tests/ui/mismatched_target_os.fixed

77 lines
1.2 KiB
Rust
Raw Normal View History

2020-04-22 16:01:25 -05:00
// run-rustfix
#![warn(clippy::mismatched_target_os)]
#![allow(unused)]
// unix
2020-04-22 16:01:25 -05:00
#[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 = "redox")]
fn redox() {}
#[cfg(target_os = "solaris")]
fn solaris() {}
#[cfg(target_os = "vxworks")]
fn vxworks() {}
// non-unix
#[cfg(target_os = "cloudabi")]
fn cloudabi() {}
#[cfg(target_os = "hermit")]
fn hermit() {}
#[cfg(target_os = "wasi")]
fn wasi() {}
#[cfg(target_os = "none")]
fn none() {}
// list with conditions
2020-04-22 16:01:25 -05:00
#[cfg(all(not(any(windows, target_os = "linux")), target_os = "freebsd"))]
fn list() {}
// windows is a valid target family, should be ignored
#[cfg(windows)]
fn windows() {}
// correct use, should be ignored
#[cfg(target_os = "freebsd")]
fn freebsd() {}
fn main() {}