Skip to content

Commit f83d3a8

Browse files
Add ui test for unneeded_clippy_cfg_attr
1 parent bc4bfdb commit f83d3a8

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

tests/ui/unnecessary_clippy_cfg.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@no-rustfix
2+
3+
#![warn(clippy::unnecessary_clippy_cfg)]
4+
#![cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
5+
#![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
6+
#![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
7+
8+
#[cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
9+
#[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
10+
#[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
11+
pub struct Bar;
12+
13+
fn main() {}
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
error: no need to put clippy lints behind a `clippy` cfg
2+
--> $DIR/unnecessary_clippy_cfg.rs:8:1
3+
|
4+
LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg)]`
6+
|
7+
= note: `-D clippy::unnecessary-clippy-cfg` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_clippy_cfg)]`
9+
10+
error: no need to put clippy lints behind a `clippy` cfg
11+
--> $DIR/unnecessary_clippy_cfg.rs:9:36
12+
|
13+
LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
14+
| ^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: write instead: `#[deny(clippy::non_minimal_cfg)]`
17+
18+
error: no need to put clippy lints behind a `clippy` cfg
19+
--> $DIR/unnecessary_clippy_cfg.rs:10:36
20+
|
21+
LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
22+
| ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
23+
|
24+
= note: write instead: `#[deny(clippy::non_minimal_cfg,clippy::maybe_misused_cfg)]`
25+
26+
error: no need to put clippy lints behind a `clippy` cfg
27+
--> $DIR/unnecessary_clippy_cfg.rs:4:1
28+
|
29+
LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
30+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg)]`
31+
32+
error: no need to put clippy lints behind a `clippy` cfg
33+
--> $DIR/unnecessary_clippy_cfg.rs:5:37
34+
|
35+
LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
36+
| ^^^^^^^^^^^^^^^^^^^^^^^
37+
|
38+
= note: write instead: `#![deny(clippy::non_minimal_cfg)]`
39+
40+
error: no need to put clippy lints behind a `clippy` cfg
41+
--> $DIR/unnecessary_clippy_cfg.rs:6:37
42+
|
43+
LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
44+
| ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
45+
|
46+
= note: write instead: `#![deny(clippy::non_minimal_cfg,clippy::maybe_misused_cfg)]`
47+
48+
error: aborting due to 6 previous errors
49+

0 commit comments

Comments
 (0)