useless_attribute: allow hidden_glob_reexports

Closes https://github.com/rust-lang/rust-clippy/issues/11595
This commit is contained in:
Rebecca Turner 2024-05-02 11:57:06 -07:00
parent e9761bdc01
commit 96e69d9b43
No known key found for this signature in database
3 changed files with 44 additions and 1 deletions

View File

@ -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(),

View File

@ -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;
}

View File

@ -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;
}