Skip to content

Commit fcf1948

Browse files
Add UI test for UNIQUE_CFG_CONDITION
1 parent ab66a86 commit fcf1948

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

Diff for: tests/ui/non_minimal_cfg.fixed

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@run-rustfix
2+
3+
#![allow(unused)]
4+
5+
#[cfg(windows)]
6+
fn hermit() {}
7+
8+
#[cfg(windows)]
9+
fn wasi() {}
10+
11+
#[cfg(all(unix, not(windows)))]
12+
fn the_end() {}
13+
14+
fn main() {}

Diff for: tests/ui/non_minimal_cfg.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@run-rustfix
2+
3+
#![allow(unused)]
4+
5+
#[cfg(all(windows))]
6+
fn hermit() {}
7+
8+
#[cfg(any(windows))]
9+
fn wasi() {}
10+
11+
#[cfg(all(any(unix), all(not(windows))))]
12+
fn the_end() {}
13+
14+
fn main() {}

Diff for: tests/ui/non_minimal_cfg.stderr

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error: unneeded sub `cfg` when there is only one condition
2+
--> $DIR/non_minimal_cfg.rs:5:7
3+
|
4+
LL | #[cfg(all(windows))]
5+
| ^^^^^^^^^^^^ help: try: `windows`
6+
|
7+
= note: `-D clippy::non-minimal-cfg` implied by `-D warnings`
8+
9+
error: unneeded sub `cfg` when there is only one condition
10+
--> $DIR/non_minimal_cfg.rs:8:7
11+
|
12+
LL | #[cfg(any(windows))]
13+
| ^^^^^^^^^^^^ help: try: `windows`
14+
15+
error: unneeded sub `cfg` when there is only one condition
16+
--> $DIR/non_minimal_cfg.rs:11:11
17+
|
18+
LL | #[cfg(all(any(unix), all(not(windows))))]
19+
| ^^^^^^^^^ help: try: `unix`
20+
21+
error: unneeded sub `cfg` when there is only one condition
22+
--> $DIR/non_minimal_cfg.rs:11:22
23+
|
24+
LL | #[cfg(all(any(unix), all(not(windows))))]
25+
| ^^^^^^^^^^^^^^^^^ help: try: `not(windows)`
26+
27+
error: aborting due to 4 previous errors
28+

0 commit comments

Comments
 (0)