-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
hidden_glob_reexports
is valid on use
items.
Lint Name
useless_attribute
Reproducer
I tried this code:
#![allow(dead_code)]
#![allow(unused_imports)]
mod foo1 {
pub struct Foo;
pub use Foo as Bar;
}
mod foo2 {
pub struct Foo;
}
pub use foo1::*;
// #[allow(clippy::useless_attribute)]
#[allow(hidden_glob_reexports)]
use foo2::Foo as Bar;
I saw this happen:
error: useless lint attribute
--> src/lib.rs:16:1
|
16 | #[allow(hidden_glob_reexports)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(hidden_glob_reexports)]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
= note: `#[deny(clippy::useless_attribute)]` on by default
error: could not compile `ice` (lib) due to previous error
I expected to see this happen: No errors because hidden_glob_reexports
lint would be generated without it:
warning: private item shadows public glob re-export
--> src/lib.rs:17:5
|
17 | use foo2::Foo as Bar;
| ^^^^^^^^^^^^^^^^
|
note: the name `Bar` in the type namespace is supposed to be publicly re-exported here
--> src/lib.rs:13:9
|
13 | pub use foo1::*;
| ^^^^^^^
note: but the private item here shadows it
--> src/lib.rs:17:5
|
17 | use foo2::Foo as Bar;
| ^^^^^^^^^^^^^^^^
= note: `#[warn(hidden_glob_reexports)]` on by default
Version
rustc 1.75.0-nightly (e0d7ed1f4 2023-10-01)
binary: rustc
commit-hash: e0d7ed1f453fb54578cc96dfea859b0e7be15016
commit-date: 2023-10-01
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.2
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have