Add test for linting on 'cfg_attr(,)'.
This commit is contained in:
parent
02877ac09b
commit
af710c9e79
@ -0,0 +1,13 @@
|
|||||||
|
// Check that `#[cfg_attr($PREDICATE,)]` triggers the `unused_attribute` lint.
|
||||||
|
|
||||||
|
// compile-flags: --cfg TRUE
|
||||||
|
|
||||||
|
#![deny(unused)]
|
||||||
|
|
||||||
|
#[cfg_attr(FALSE,)] //~ ERROR unused attribute
|
||||||
|
fn _f() {}
|
||||||
|
|
||||||
|
#[cfg_attr(TRUE,)] //~ ERROR unused attribute
|
||||||
|
fn _g() {}
|
||||||
|
|
||||||
|
fn main() {}
|
@ -0,0 +1,21 @@
|
|||||||
|
error: unused attribute
|
||||||
|
--> $DIR/cfg-attr-empty-is-unused.rs:7:1
|
||||||
|
|
|
||||||
|
LL | #[cfg_attr(FALSE,)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: lint level defined here
|
||||||
|
--> $DIR/cfg-attr-empty-is-unused.rs:5:9
|
||||||
|
|
|
||||||
|
LL | #![deny(unused)]
|
||||||
|
| ^^^^^^
|
||||||
|
= note: #[deny(unused_attributes)] implied by #[deny(unused)]
|
||||||
|
|
||||||
|
error: unused attribute
|
||||||
|
--> $DIR/cfg-attr-empty-is-unused.rs:10:1
|
||||||
|
|
|
||||||
|
LL | #[cfg_attr(TRUE,)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user