-
Notifications
You must be signed in to change notification settings - Fork 13.4k
report unused_import
for empty reexports even it is pub
#116033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
|
||
pub mod alloc; | ||
pub mod small_c_string; | ||
#[allow(unused_imports)] | ||
pub mod thread_local; | ||
|
||
#[cfg(test)] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#![allow(dead_code)] | ||
#![allow(unused_imports)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, it's under the tests directory and none of the re-exports have been used, so it will be detected. Therefore, adding By the way, once this PR is merged, it will throw There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, if some code is only used for tests it is better to put it under |
||
|
||
#[macro_use] | ||
mod macros; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#![deny(unused_imports)] | ||
|
||
mod a {} | ||
|
||
pub use a::*; | ||
//~^ ERROR: unused import: `a::*` | ||
|
||
mod b { | ||
mod c { | ||
#[derive(Clone)] | ||
pub struct D; | ||
} | ||
pub use self::c::*; // don't show unused import lint | ||
} | ||
|
||
pub use b::*; // don't show unused import lint | ||
|
||
mod d { | ||
const D: i32 = 1; | ||
} | ||
|
||
pub use d::*; | ||
//~^ ERROR: unused import: `d::*` | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error: unused import: `a::*` | ||
--> $DIR/pub-reexport-empty.rs:5:9 | ||
| | ||
LL | pub use a::*; | ||
| ^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/pub-reexport-empty.rs:1:9 | ||
| | ||
LL | #![deny(unused_imports)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: unused import: `d::*` | ||
--> $DIR/pub-reexport-empty.rs:22:9 | ||
| | ||
LL | pub use d::*; | ||
| ^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
Uh oh!
There was an error while loading. Please reload this page.