Add UI test for UNIQUE_CFG_CONDITION

This commit is contained in:
Guillaume Gomez 2023-05-09 12:13:49 +02:00
parent ab66a86815
commit fcf19481aa
3 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,14 @@
//@run-rustfix
#![allow(unused)]
#[cfg(windows)]
fn hermit() {}
#[cfg(windows)]
fn wasi() {}
#[cfg(all(unix, not(windows)))]
fn the_end() {}
fn main() {}

View File

@ -0,0 +1,14 @@
//@run-rustfix
#![allow(unused)]
#[cfg(all(windows))]
fn hermit() {}
#[cfg(any(windows))]
fn wasi() {}
#[cfg(all(any(unix), all(not(windows))))]
fn the_end() {}
fn main() {}

View File

@ -0,0 +1,28 @@
error: unneeded sub `cfg` when there is only one condition
--> $DIR/non_minimal_cfg.rs:5:7
|
LL | #[cfg(all(windows))]
| ^^^^^^^^^^^^ help: try: `windows`
|
= note: `-D clippy::non-minimal-cfg` implied by `-D warnings`
error: unneeded sub `cfg` when there is only one condition
--> $DIR/non_minimal_cfg.rs:8:7
|
LL | #[cfg(any(windows))]
| ^^^^^^^^^^^^ help: try: `windows`
error: unneeded sub `cfg` when there is only one condition
--> $DIR/non_minimal_cfg.rs:11:11
|
LL | #[cfg(all(any(unix), all(not(windows))))]
| ^^^^^^^^^ help: try: `unix`
error: unneeded sub `cfg` when there is only one condition
--> $DIR/non_minimal_cfg.rs:11:22
|
LL | #[cfg(all(any(unix), all(not(windows))))]
| ^^^^^^^^^^^^^^^^^ help: try: `not(windows)`
error: aborting due to 4 previous errors