From db0cbbacb774e7c645c740b27914aec313ed0a7e Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 2 May 2024 11:57:27 -0700 Subject: [PATCH] useless_attribute: allow ambiguous_glob_exports Closes https://github.com/rust-lang/rust-clippy/issues/10878 --- clippy_lints/src/attrs/useless_attribute.rs | 1 + tests/ui/useless_attribute.fixed | 17 +++++++++++++++++ tests/ui/useless_attribute.rs | 17 +++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/clippy_lints/src/attrs/useless_attribute.rs b/clippy_lints/src/attrs/useless_attribute.rs index 00f324e4de5..f6f4d780440 100644 --- a/clippy_lints/src/attrs/useless_attribute.rs +++ b/clippy_lints/src/attrs/useless_attribute.rs @@ -28,6 +28,7 @@ pub(super) fn check(cx: &LateContext<'_>, item: &Item<'_>, attrs: &[Attribute]) || is_word(lint, sym!(unused_braces)) || is_word(lint, sym::dead_code) || is_word(lint, sym!(hidden_glob_reexports)) + || is_word(lint, sym!(ambiguous_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 401c384c39c..231fc0a892a 100644 --- a/tests/ui/useless_attribute.fixed +++ b/tests/ui/useless_attribute.fixed @@ -117,3 +117,20 @@ pub mod hidden_glob_reexports { #[allow(hidden_glob_reexports)] use my_uncool_type::MyUncoolType as MyCoolType; } + +// Regression test for https://github.com/rust-lang/rust-clippy/issues/10878 +pub mod ambiguous_glob_exports { + #![allow(unreachable_pub)] + + mod my_prelude { + pub struct MyType; + } + + mod my_type { + pub struct MyType; + } + + #[allow(ambiguous_glob_reexports)] + pub use my_prelude::*; + pub use my_type::*; +} diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs index 6629942ff5e..8dfcd2110a4 100644 --- a/tests/ui/useless_attribute.rs +++ b/tests/ui/useless_attribute.rs @@ -117,3 +117,20 @@ mod my_uncool_type { #[allow(hidden_glob_reexports)] use my_uncool_type::MyUncoolType as MyCoolType; } + +// Regression test for https://github.com/rust-lang/rust-clippy/issues/10878 +pub mod ambiguous_glob_exports { + #![allow(unreachable_pub)] + + mod my_prelude { + pub struct MyType; + } + + mod my_type { + pub struct MyType; + } + + #[allow(ambiguous_glob_reexports)] + pub use my_prelude::*; + pub use my_type::*; +}