Add ui test for mixed_attributes_style

This commit is contained in:
Guillaume Gomez 2024-02-26 12:25:28 +01:00
parent 9f4a58f616
commit 28738234ac
2 changed files with 69 additions and 0 deletions

View file

@ -0,0 +1,39 @@
#![warn(clippy::mixed_attributes_style)]
#[allow(unused)] //~ ERROR: item has both inner and outer attributes
fn foo1() {
#![allow(unused)]
}
#[allow(unused)]
#[allow(unused)]
fn foo2() {}
fn foo3() {
#![allow(unused)]
#![allow(unused)]
}
/// linux
//~^ ERROR: item has both inner and outer attributes
fn foo4() {
//! windows
}
/// linux
/// windows
fn foo5() {}
fn foo6() {
//! linux
//! windows
}
#[allow(unused)] //~ ERROR: item has both inner and outer attributes
mod bar {
#![allow(unused)]
}
fn main() {
// test code goes here
}

View file

@ -0,0 +1,30 @@
error: item has both inner and outer attributes
--> tests/ui/mixed_attributes_style.rs:3:1
|
LL | / #[allow(unused)]
LL | | fn foo1() {
LL | | #![allow(unused)]
| |_____________________^
|
= note: `-D clippy::mixed-attributes-style` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::mixed_attributes_style)]`
error: item has both inner and outer attributes
--> tests/ui/mixed_attributes_style.rs:17:1
|
LL | / /// linux
LL | |
LL | | fn foo4() {
LL | | //! windows
| |_______________^
error: item has both inner and outer attributes
--> tests/ui/mixed_attributes_style.rs:32:1
|
LL | / #[allow(unused)]
LL | | mod bar {
LL | | #![allow(unused)]
| |_____________________^
error: aborting due to 3 previous errors