useless_attribute: allow hidden_glob_reexports
Closes https://github.com/rust-lang/rust-clippy/issues/11595
This commit is contained in:
parent
e9761bdc01
commit
96e69d9b43
@ -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(),
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user