forked from rust-lang/rust-clippy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#12303 - GuillaumeGomez:unneedeed_clippy_cfg_a…
…ttr, r=flip1995 Add `unnecessary_clippy_cfg` lint Follow-up of rust-lang#12292. r? `@flip1995` changelog: Add `unnecessary_clippy_cfg` lint
- Loading branch information
Showing
5 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|