mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 12:13:43 +00:00
Add ui tests for DEPRECATED_CLIPPY_CFG_ATTR
This commit is contained in:
parent
e0f82af3dd
commit
cd6f03a3e8
13
tests/ui/cfg_attr_cargo_clippy.fixed
Normal file
13
tests/ui/cfg_attr_cargo_clippy.fixed
Normal file
@ -0,0 +1,13 @@
|
||||
#![warn(clippy::deprecated_clippy_cfg_attr)]
|
||||
#![allow(clippy::non_minimal_cfg)]
|
||||
#![cfg_attr(clippy, doc = "a")] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
|
||||
#[cfg_attr(clippy, derive(Debug))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg_attr(not(clippy), derive(Debug))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(clippy)] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(not(clippy))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(any(clippy))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(all(clippy))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
pub struct Bar;
|
||||
|
||||
fn main() {}
|
13
tests/ui/cfg_attr_cargo_clippy.rs
Normal file
13
tests/ui/cfg_attr_cargo_clippy.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#![warn(clippy::deprecated_clippy_cfg_attr)]
|
||||
#![allow(clippy::non_minimal_cfg)]
|
||||
#![cfg_attr(feature = "cargo-clippy", doc = "a")] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
|
||||
#[cfg_attr(feature = "cargo-clippy", derive(Debug))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg_attr(not(feature = "cargo-clippy"), derive(Debug))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(feature = "cargo-clippy")] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(not(feature = "cargo-clippy"))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(any(feature = "cargo-clippy"))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
#[cfg(all(feature = "cargo-clippy"))] //~ ERROR: `feature = "cargo-clippy"` was
|
||||
pub struct Bar;
|
||||
|
||||
fn main() {}
|
47
tests/ui/cfg_attr_cargo_clippy.stderr
Normal file
47
tests/ui/cfg_attr_cargo_clippy.stderr
Normal file
@ -0,0 +1,47 @@
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> $DIR/cfg_attr_cargo_clippy.rs:5:12
|
||||
|
|
||||
LL | #[cfg_attr(feature = "cargo-clippy", derive(Debug))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
|
||||
= note: `-D clippy::deprecated-clippy-cfg-attr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::deprecated_clippy_cfg_attr)]`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> $DIR/cfg_attr_cargo_clippy.rs:6:16
|
||||
|
|
||||
LL | #[cfg_attr(not(feature = "cargo-clippy"), derive(Debug))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> $DIR/cfg_attr_cargo_clippy.rs:7:7
|
||||
|
|
||||
LL | #[cfg(feature = "cargo-clippy")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> $DIR/cfg_attr_cargo_clippy.rs:8:11
|
||||
|
|
||||
LL | #[cfg(not(feature = "cargo-clippy"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> $DIR/cfg_attr_cargo_clippy.rs:9:11
|
||||
|
|
||||
LL | #[cfg(any(feature = "cargo-clippy"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> $DIR/cfg_attr_cargo_clippy.rs:10:11
|
||||
|
|
||||
LL | #[cfg(all(feature = "cargo-clippy"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> $DIR/cfg_attr_cargo_clippy.rs:3:13
|
||||
|
|
||||
LL | #![cfg_attr(feature = "cargo-clippy", doc = "a")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
@ -6,7 +6,7 @@
|
||||
#![feature(rustc_private)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(dead_code))]
|
||||
#![cfg_attr(clippy, allow(dead_code))]
|
||||
#[rustfmt::skip]
|
||||
#[allow(unused_imports)]
|
||||
#[allow(unused_extern_crates)]
|
||||
|
@ -6,7 +6,7 @@
|
||||
#![feature(rustc_private)]
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
|
||||
#[cfg_attr(clippy, allow(dead_code))]
|
||||
#[rustfmt::skip]
|
||||
#[allow(unused_imports)]
|
||||
#[allow(unused_extern_crates)]
|
||||
|
@ -10,8 +10,8 @@ LL | #[allow(dead_code)]
|
||||
error: useless lint attribute
|
||||
--> $DIR/useless_attribute.rs:9:1
|
||||
|
|
||||
LL | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code)`
|
||||
LL | #[cfg_attr(clippy, allow(dead_code))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(clippy, allow(dead_code)`
|
||||
|
||||
error: useless lint attribute
|
||||
--> $DIR/useless_attribute.rs:20:5
|
||||
|
Loading…
Reference in New Issue
Block a user