about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRebecca Turner <rbt@sent.as>2024-05-02 11:56:38 -0700
committerRebecca Turner <rbt@sent.as>2024-05-02 11:57:56 -0700
commite9761bdc015430b818ee771b2acf00a00b40bd97 (patch)
treec192ff45cdcf8adb69f21d4b41b954ee95334576
parent17d2ab8f6247ea325bdc7e1c9943a0dcaf31568d (diff)
downloadrust-e9761bdc015430b818ee771b2acf00a00b40bd97.tar.gz
rust-e9761bdc015430b818ee771b2acf00a00b40bd97.zip
useless_attribute: allow dead_code
Closes https://github.com/rust-lang/rust-clippy/issues/4467
-rw-r--r--clippy_lints/src/attrs/useless_attribute.rs1
-rw-r--r--tests/ui/useless_attribute.fixed4
-rw-r--r--tests/ui/useless_attribute.rs4
3 files changed, 9 insertions, 0 deletions
diff --git a/clippy_lints/src/attrs/useless_attribute.rs b/clippy_lints/src/attrs/useless_attribute.rs
index 40572731bb1..720e4e7932d 100644
--- a/clippy_lints/src/attrs/useless_attribute.rs
+++ b/clippy_lints/src/attrs/useless_attribute.rs
@@ -26,6 +26,7 @@ pub(super) fn check(cx: &LateContext<'_>, item: &Item<'_>, attrs: &[Attribute])
                                 || is_word(lint, sym!(unused))
                                 || is_word(lint, sym!(unused_import_braces))
                                 || is_word(lint, sym!(unused_braces))
+                                || is_word(lint, sym!(dead_code))
                                 || extract_clippy_lint(lint).map_or(false, |s| {
                                     matches!(
                                         s.as_str(),
diff --git a/tests/ui/useless_attribute.fixed b/tests/ui/useless_attribute.fixed
index cb1c0346404..5fafc05cdde 100644
--- a/tests/ui/useless_attribute.fixed
+++ b/tests/ui/useless_attribute.fixed
@@ -92,3 +92,7 @@ use module::{Struct};
 fn main() {
     test_indented_attr();
 }
+
+// Regression test for https://github.com/rust-lang/rust-clippy/issues/4467
+#[allow(dead_code)]
+use std::collections as puppy_doggy;
diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs
index 44a52cba043..c9de7677ff8 100644
--- a/tests/ui/useless_attribute.rs
+++ b/tests/ui/useless_attribute.rs
@@ -92,3 +92,7 @@ use module::{Struct};
 fn main() {
     test_indented_attr();
 }
+
+// Regression test for https://github.com/rust-lang/rust-clippy/issues/4467
+#[allow(dead_code)]
+use std::collections as puppy_doggy;