diff --git a/tests/ui-cargo/mixed_attributes_style/fail/Cargo.stderr b/tests/ui-cargo/mixed_attributes_style/fail/Cargo.stderr new file mode 100644 index 000000000000..4fafd29bb502 --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/fail/Cargo.stderr @@ -0,0 +1,12 @@ +error: item has both inner and outer attributes + --> src/submodule.rs:1:1 + | +1 | / #[allow(unused)] +2 | | mod foo { +3 | | #![allow(dead_code)] + | |________________________^ + | + = note: `-D clippy::mixed-attributes-style` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::mixed_attributes_style)]` + +error: could not compile `mixed_attributes_style` (bin "mixed_attributes_style") due to 1 previous error diff --git a/tests/ui-cargo/mixed_attributes_style/fail/Cargo.toml b/tests/ui-cargo/mixed_attributes_style/fail/Cargo.toml new file mode 100644 index 000000000000..13c9996c9bde --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/fail/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "mixed_attributes_style" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] diff --git a/tests/ui-cargo/mixed_attributes_style/fail/src/main.rs b/tests/ui-cargo/mixed_attributes_style/fail/src/main.rs new file mode 100644 index 000000000000..f6a2037ad0be --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/fail/src/main.rs @@ -0,0 +1,2 @@ +mod submodule; +fn main() {} diff --git a/tests/ui-cargo/mixed_attributes_style/fail/src/submodule.rs b/tests/ui-cargo/mixed_attributes_style/fail/src/submodule.rs new file mode 100644 index 000000000000..acfc561835f8 --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/fail/src/submodule.rs @@ -0,0 +1,4 @@ +#[allow(unused)] +mod foo { + #![allow(dead_code)] +} diff --git a/tests/ui-cargo/mixed_attributes_style/pass/Cargo.stderr b/tests/ui-cargo/mixed_attributes_style/pass/Cargo.stderr new file mode 100644 index 000000000000..4fafd29bb502 --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/pass/Cargo.stderr @@ -0,0 +1,12 @@ +error: item has both inner and outer attributes + --> src/submodule.rs:1:1 + | +1 | / #[allow(unused)] +2 | | mod foo { +3 | | #![allow(dead_code)] + | |________________________^ + | + = note: `-D clippy::mixed-attributes-style` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::mixed_attributes_style)]` + +error: could not compile `mixed_attributes_style` (bin "mixed_attributes_style") due to 1 previous error diff --git a/tests/ui-cargo/mixed_attributes_style/pass/Cargo.toml b/tests/ui-cargo/mixed_attributes_style/pass/Cargo.toml new file mode 100644 index 000000000000..13c9996c9bde --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/pass/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "mixed_attributes_style" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] diff --git a/tests/ui-cargo/mixed_attributes_style/pass/src/main.rs b/tests/ui-cargo/mixed_attributes_style/pass/src/main.rs new file mode 100644 index 000000000000..8ea851e0910a --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/pass/src/main.rs @@ -0,0 +1,4 @@ +// Issue #12436 +#![allow(clippy::mixed_attributes_style)] +mod submodule; +fn main() {} diff --git a/tests/ui-cargo/mixed_attributes_style/pass/src/submodule.rs b/tests/ui-cargo/mixed_attributes_style/pass/src/submodule.rs new file mode 100644 index 000000000000..acfc561835f8 --- /dev/null +++ b/tests/ui-cargo/mixed_attributes_style/pass/src/submodule.rs @@ -0,0 +1,4 @@ +#[allow(unused)] +mod foo { + #![allow(dead_code)] +}