Add ui test for unneeded_clippy_cfg_attr
This commit is contained in:
parent
f35d87f211
commit
cf6a14cea1
23
tests/ui/unnecessary_clippy_cfg.rs
Normal file
23
tests/ui/unnecessary_clippy_cfg.rs
Normal file
@ -0,0 +1,23 @@
|
||||
//@no-rustfix
|
||||
|
||||
#![warn(clippy::unnecessary_clippy_cfg)]
|
||||
#![cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
#![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
#![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
#![cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
|
||||
#[cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
#[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
#[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
#[cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
//~^ ERROR: no need to put clippy lints behind a `clippy` cfg
|
||||
pub struct Bar;
|
||||
|
||||
fn main() {}
|
61
tests/ui/unnecessary_clippy_cfg.stderr
Normal file
61
tests/ui/unnecessary_clippy_cfg.stderr
Normal file
@ -0,0 +1,61 @@
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:13:1
|
||||
|
|
||||
LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg)]`
|
||||
|
|
||||
= note: `-D clippy::unnecessary-clippy-cfg` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_clippy_cfg)]`
|
||||
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:15:36
|
||||
|
|
||||
LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: write instead: `#[deny(clippy::non_minimal_cfg)]`
|
||||
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:17:36
|
||||
|
|
||||
LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: write instead: `#[deny(clippy::non_minimal_cfg,clippy::maybe_misused_cfg)]`
|
||||
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:19:1
|
||||
|
|
||||
LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg)]`
|
||||
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:4:1
|
||||
|
|
||||
LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg)]`
|
||||
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:6:37
|
||||
|
|
||||
LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: write instead: `#![deny(clippy::non_minimal_cfg)]`
|
||||
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:8:37
|
||||
|
|
||||
LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: write instead: `#![deny(clippy::non_minimal_cfg,clippy::maybe_misused_cfg)]`
|
||||
|
||||
error: no need to put clippy lints behind a `clippy` cfg
|
||||
--> tests/ui/unnecessary_clippy_cfg.rs:10:1
|
||||
|
|
||||
LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg, clippy::maybe_misused_cfg)]`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
Loading…
Reference in New Issue
Block a user