mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Add UI test for UNIQUE_CFG_CONDITION
This commit is contained in:
parent
ab66a86815
commit
fcf19481aa
14
tests/ui/non_minimal_cfg.fixed
Normal file
14
tests/ui/non_minimal_cfg.fixed
Normal 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() {}
|
14
tests/ui/non_minimal_cfg.rs
Normal file
14
tests/ui/non_minimal_cfg.rs
Normal 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() {}
|
28
tests/ui/non_minimal_cfg.stderr
Normal file
28
tests/ui/non_minimal_cfg.stderr
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user