diff options
| author | Rebecca Turner <rbt@sent.as> | 2024-05-02 11:57:27 -0700 |
|---|---|---|
| committer | Rebecca Turner <rbt@sent.as> | 2024-05-02 14:48:18 -0700 |
| commit | db0cbbacb774e7c645c740b27914aec313ed0a7e (patch) | |
| tree | 36b2088c2e936b98b64b9785e7b30d65c79fb205 | |
| parent | 96e69d9b43f1de81ead394c76b5552ab4daf88f1 (diff) | |
| download | rust-db0cbbacb774e7c645c740b27914aec313ed0a7e.tar.gz rust-db0cbbacb774e7c645c740b27914aec313ed0a7e.zip | |
useless_attribute: allow ambiguous_glob_exports
Closes https://github.com/rust-lang/rust-clippy/issues/10878
| -rw-r--r-- | clippy_lints/src/attrs/useless_attribute.rs | 1 | ||||
| -rw-r--r-- | tests/ui/useless_attribute.fixed | 17 | ||||
| -rw-r--r-- | tests/ui/useless_attribute.rs | 17 |
3 files changed, 35 insertions, 0 deletions
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 @@ 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::*; +} |
