Skip to content

Commit 2873823

Browse files
Add ui test for mixed_attributes_style
1 parent 9f4a58f commit 2873823

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

tests/ui/mixed_attributes_style.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#![warn(clippy::mixed_attributes_style)]
2+
3+
#[allow(unused)] //~ ERROR: item has both inner and outer attributes
4+
fn foo1() {
5+
#![allow(unused)]
6+
}
7+
8+
#[allow(unused)]
9+
#[allow(unused)]
10+
fn foo2() {}
11+
12+
fn foo3() {
13+
#![allow(unused)]
14+
#![allow(unused)]
15+
}
16+
17+
/// linux
18+
//~^ ERROR: item has both inner and outer attributes
19+
fn foo4() {
20+
//! windows
21+
}
22+
23+
/// linux
24+
/// windows
25+
fn foo5() {}
26+
27+
fn foo6() {
28+
//! linux
29+
//! windows
30+
}
31+
32+
#[allow(unused)] //~ ERROR: item has both inner and outer attributes
33+
mod bar {
34+
#![allow(unused)]
35+
}
36+
37+
fn main() {
38+
// test code goes here
39+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error: item has both inner and outer attributes
2+
--> tests/ui/mixed_attributes_style.rs:3:1
3+
|
4+
LL | / #[allow(unused)]
5+
LL | | fn foo1() {
6+
LL | | #![allow(unused)]
7+
| |_____________________^
8+
|
9+
= note: `-D clippy::mixed-attributes-style` implied by `-D warnings`
10+
= help: to override `-D warnings` add `#[allow(clippy::mixed_attributes_style)]`
11+
12+
error: item has both inner and outer attributes
13+
--> tests/ui/mixed_attributes_style.rs:17:1
14+
|
15+
LL | / /// linux
16+
LL | |
17+
LL | | fn foo4() {
18+
LL | | //! windows
19+
| |_______________^
20+
21+
error: item has both inner and outer attributes
22+
--> tests/ui/mixed_attributes_style.rs:32:1
23+
|
24+
LL | / #[allow(unused)]
25+
LL | | mod bar {
26+
LL | | #![allow(unused)]
27+
| |_____________________^
28+
29+
error: aborting due to 3 previous errors
30+

0 commit comments

Comments
 (0)