mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Add ui test for new duplicated_attributes
lint
This commit is contained in:
parent
f34804d807
commit
749e225cd6
2 changed files with 140 additions and 0 deletions
17
tests/ui/duplicated_attributes.rs
Normal file
17
tests/ui/duplicated_attributes.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
#![warn(clippy::duplicated_attributes)]
|
||||
#![cfg(any(unix, windows))]
|
||||
#![allow(dead_code)]
|
||||
#![allow(dead_code)] //~ ERROR: duplicated attribute
|
||||
#![cfg(any(unix, windows))]
|
||||
//~^ ERROR: duplicated attribute
|
||||
//~| ERROR: duplicated attribute
|
||||
|
||||
#[cfg(any(unix, windows, target_os = "linux"))]
|
||||
#[allow(dead_code)]
|
||||
#[allow(dead_code)] //~ ERROR: duplicated attribute
|
||||
#[cfg(any(unix, windows, target_os = "linux"))]
|
||||
//~^ ERROR: duplicated attribute
|
||||
//~| ERROR: duplicated attribute
|
||||
fn foo() {}
|
||||
|
||||
fn main() {}
|
123
tests/ui/duplicated_attributes.stderr
Normal file
123
tests/ui/duplicated_attributes.stderr
Normal file
|
@ -0,0 +1,123 @@
|
|||
error: duplicated attribute
|
||||
--> tests/ui/duplicated_attributes.rs:4:10
|
||||
|
|
||||
LL | #![allow(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: first defined here
|
||||
--> tests/ui/duplicated_attributes.rs:3:10
|
||||
|
|
||||
LL | #![allow(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
help: remove this attribute
|
||||
--> tests/ui/duplicated_attributes.rs:4:10
|
||||
|
|
||||
LL | #![allow(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
= note: `-D clippy::duplicated-attributes` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]`
|
||||
|
||||
error: duplicated attribute
|
||||
--> tests/ui/duplicated_attributes.rs:5:12
|
||||
|
|
||||
LL | #![cfg(any(unix, windows))]
|
||||
| ^^^^
|
||||
|
|
||||
note: first defined here
|
||||
--> tests/ui/duplicated_attributes.rs:2:12
|
||||
|
|
||||
LL | #![cfg(any(unix, windows))]
|
||||
| ^^^^
|
||||
help: remove this attribute
|
||||
--> tests/ui/duplicated_attributes.rs:5:12
|
||||
|
|
||||
LL | #![cfg(any(unix, windows))]
|
||||
| ^^^^
|
||||
|
||||
error: duplicated attribute
|
||||
--> tests/ui/duplicated_attributes.rs:5:18
|
||||
|
|
||||
LL | #![cfg(any(unix, windows))]
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: first defined here
|
||||
--> tests/ui/duplicated_attributes.rs:2:18
|
||||
|
|
||||
LL | #![cfg(any(unix, windows))]
|
||||
| ^^^^^^^
|
||||
help: remove this attribute
|
||||
--> tests/ui/duplicated_attributes.rs:5:18
|
||||
|
|
||||
LL | #![cfg(any(unix, windows))]
|
||||
| ^^^^^^^
|
||||
|
||||
error: duplicated attribute
|
||||
--> tests/ui/duplicated_attributes.rs:11:9
|
||||
|
|
||||
LL | #[allow(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: first defined here
|
||||
--> tests/ui/duplicated_attributes.rs:10:9
|
||||
|
|
||||
LL | #[allow(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
help: remove this attribute
|
||||
--> tests/ui/duplicated_attributes.rs:11:9
|
||||
|
|
||||
LL | #[allow(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: duplicated attribute
|
||||
--> tests/ui/duplicated_attributes.rs:12:11
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^
|
||||
|
|
||||
note: first defined here
|
||||
--> tests/ui/duplicated_attributes.rs:9:11
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^
|
||||
help: remove this attribute
|
||||
--> tests/ui/duplicated_attributes.rs:12:11
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^
|
||||
|
||||
error: duplicated attribute
|
||||
--> tests/ui/duplicated_attributes.rs:12:17
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: first defined here
|
||||
--> tests/ui/duplicated_attributes.rs:9:17
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^^^^
|
||||
help: remove this attribute
|
||||
--> tests/ui/duplicated_attributes.rs:12:17
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^^^^
|
||||
|
||||
error: duplicated attribute
|
||||
--> tests/ui/duplicated_attributes.rs:12:26
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: first defined here
|
||||
--> tests/ui/duplicated_attributes.rs:9:26
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
help: remove this attribute
|
||||
--> tests/ui/duplicated_attributes.rs:12:26
|
||||
|
|
||||
LL | #[cfg(any(unix, windows, target_os = "linux"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
Loading…
Reference in a new issue