about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/attrs/useless_attribute.rs3
-rw-r--r--tests/ui/useless_attribute.fixed21
-rw-r--r--tests/ui/useless_attribute.rs21
3 files changed, 44 insertions, 1 deletions
diff --git a/clippy_lints/src/attrs/useless_attribute.rs b/clippy_lints/src/attrs/useless_attribute.rs
index 720e4e7932d..00f324e4de5 100644
--- a/clippy_lints/src/attrs/useless_attribute.rs
+++ b/clippy_lints/src/attrs/useless_attribute.rs
@@ -26,7 +26,8 @@ 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))
+                                || is_word(lint, sym::dead_code)
+                                || is_word(lint, sym!(hidden_glob_reexports))
                                 || 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 5fafc05cdde..401c384c39c 100644
--- a/tests/ui/useless_attribute.fixed
+++ b/tests/ui/useless_attribute.fixed
@@ -96,3 +96,24 @@ fn main() {
 // Regression test for https://github.com/rust-lang/rust-clippy/issues/4467
 #[allow(dead_code)]
 use std::collections as puppy_doggy;
+
+// Regression test for https://github.com/rust-lang/rust-clippy/issues/11595
+pub mod hidden_glob_reexports {
+    #![allow(unreachable_pub)]
+
+    mod my_prelude {
+        pub struct MyCoolTypeInternal;
+        pub use MyCoolTypeInternal as MyCoolType;
+    }
+
+    mod my_uncool_type {
+        pub(crate) struct MyUncoolType;
+    }
+
+    // This exports `MyCoolType`.
+    pub use my_prelude::*;
+
+    // This hides `my_prelude::MyCoolType`.
+    #[allow(hidden_glob_reexports)]
+    use my_uncool_type::MyUncoolType as MyCoolType;
+}
diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs
index c9de7677ff8..6629942ff5e 100644
--- a/tests/ui/useless_attribute.rs
+++ b/tests/ui/useless_attribute.rs
@@ -96,3 +96,24 @@ fn main() {
 // Regression test for https://github.com/rust-lang/rust-clippy/issues/4467
 #[allow(dead_code)]
 use std::collections as puppy_doggy;
+
+// Regression test for https://github.com/rust-lang/rust-clippy/issues/11595
+pub mod hidden_glob_reexports {
+    #![allow(unreachable_pub)]
+
+    mod my_prelude {
+        pub struct MyCoolTypeInternal;
+        pub use MyCoolTypeInternal as MyCoolType;
+    }
+
+    mod my_uncool_type {
+        pub(crate) struct MyUncoolType;
+    }
+
+    // This exports `MyCoolType`.
+    pub use my_prelude::*;
+
+    // This hides `my_prelude::MyCoolType`.
+    #[allow(hidden_glob_reexports)]
+    use my_uncool_type::MyUncoolType as MyCoolType;
+}