File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -5285,10 +5285,13 @@ pub impl Resolver {
5285
5285
for module_. import_resolutions. each_value |& import_resolution| {
5286
5286
// Ignore dummy spans for things like automatically injected
5287
5287
// imports for the prelude, and also don't warn about the same
5288
- // import statement being unused more than once.
5288
+ // import statement being unused more than once. Furthermore, if
5289
+ // the import is public, then we can't be sure whether it's unused
5290
+ // or not so don't warn about it.
5289
5291
if !import_resolution. state. used &&
5290
5292
!import_resolution. state. warned &&
5291
- import_resolution. span != dummy_sp( ) {
5293
+ import_resolution. span != dummy_sp( ) &&
5294
+ import_resolution. privacy != Public {
5292
5295
import_resolution. state. warned = true ;
5293
5296
match self . unused_import_lint_level {
5294
5297
warn => {
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ mod foo {
31
31
}
32
32
33
33
mod bar {
34
+ // Don't ignore on 'pub use' because we're not sure if it's used or not
35
+ pub use core:: cmp:: Eq ;
36
+
34
37
pub mod c {
35
38
use foo:: Point ;
36
39
use foo:: Square ; //~ ERROR unused import
You can’t perform that action at this time.
0 commit comments