-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
169 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// run-rustfix | ||
|
||
#![warn(clippy::mismatched_target_os)] | ||
#![allow(unused)] | ||
|
||
#[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 | ||
#[cfg(all(not(any(windows, target_os = "cloudabi")), target_os = "wasi"))] | ||
fn list() {} | ||
|
||
// windows is a valid target family, should be ignored | ||
#[cfg(windows)] | ||
fn windows() {} | ||
|
||
// correct use, should be ignored | ||
#[cfg(target_os = "hermit")] | ||
fn correct() {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// run-rustfix | ||
|
||
#![warn(clippy::mismatched_target_os)] | ||
#![allow(unused)] | ||
|
||
#[cfg(cloudabi)] | ||
fn cloudabi() {} | ||
|
||
#[cfg(hermit)] | ||
fn hermit() {} | ||
|
||
#[cfg(wasi)] | ||
fn wasi() {} | ||
|
||
#[cfg(none)] | ||
fn none() {} | ||
|
||
// list with conditions | ||
#[cfg(all(not(any(windows, cloudabi)), wasi))] | ||
fn list() {} | ||
|
||
// windows is a valid target family, should be ignored | ||
#[cfg(windows)] | ||
fn windows() {} | ||
|
||
// correct use, should be ignored | ||
#[cfg(target_os = "hermit")] | ||
fn correct() {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
error: operating system used in target family position | ||
--> $DIR/mismatched_target_os_non_unix.rs:6:1 | ||
| | ||
LL | #[cfg(cloudabi)] | ||
| ^^^^^^--------^^ | ||
| | | ||
| help: try: `target_os = "cloudabi"` | ||
| | ||
= note: `-D clippy::mismatched-target-os` implied by `-D warnings` | ||
|
||
error: operating system used in target family position | ||
--> $DIR/mismatched_target_os_non_unix.rs:9:1 | ||
| | ||
LL | #[cfg(hermit)] | ||
| ^^^^^^------^^ | ||
| | | ||
| help: try: `target_os = "hermit"` | ||
|
||
error: operating system used in target family position | ||
--> $DIR/mismatched_target_os_non_unix.rs:12:1 | ||
| | ||
LL | #[cfg(wasi)] | ||
| ^^^^^^----^^ | ||
| | | ||
| help: try: `target_os = "wasi"` | ||
|
||
error: operating system used in target family position | ||
--> $DIR/mismatched_target_os_non_unix.rs:15:1 | ||
| | ||
LL | #[cfg(none)] | ||
| ^^^^^^----^^ | ||
| | | ||
| help: try: `target_os = "none"` | ||
|
||
error: operating system used in target family position | ||
--> $DIR/mismatched_target_os_non_unix.rs:19:1 | ||
| | ||
LL | #[cfg(all(not(any(windows, cloudabi)), wasi))] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
help: try | ||
| | ||
LL | #[cfg(all(not(any(windows, target_os = "cloudabi")), wasi))] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
help: try | ||
| | ||
LL | #[cfg(all(not(any(windows, cloudabi)), target_os = "wasi"))] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 5 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.