Skip to content

Commit 9934593

Browse files
Silence unused_imports if import comes from glob
1 parent 5974fe8 commit 9934593

File tree

5 files changed

+5
-37
lines changed

5 files changed

+5
-37
lines changed

compiler/rustc_resolve/src/imports.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,8 +1375,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
13751375
target_bindings[ns].get(),
13761376
) {
13771377
Ok(other_binding) => {
1378-
is_redundant =
1379-
binding.res() == other_binding.res() && !other_binding.is_ambiguity();
1378+
is_redundant = binding.res() == other_binding.res()
1379+
&& !other_binding.is_ambiguity()
1380+
&& !other_binding.is_glob_import();
13801381
if is_redundant {
13811382
redundant_span[ns] =
13821383
Some((other_binding.span, other_binding.is_import()));

tests/ui/lint/use-redundant/use-redundant-glob-parent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub mod bar {
99
use bar::*;
1010

1111
pub fn warning() -> Foo {
12-
use bar::Foo; //~ WARNING imported redundantly
12+
use bar::Foo; //FIXME(unused_imports): ~ WARNING imported redundantly
1313
Foo(Bar('a'))
1414
}
1515

tests/ui/lint/use-redundant/use-redundant-glob-parent.stderr

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/ui/lint/use-redundant/use-redundant-glob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub mod bar {
88

99
pub fn warning() -> bar::Foo {
1010
use bar::*;
11-
use bar::Foo; //~ WARNING imported redundantly
11+
use bar::Foo; //FIXME(unused_imports): ~ WARNING imported redundantly
1212
Foo(Bar('a'))
1313
}
1414

tests/ui/lint/use-redundant/use-redundant-glob.stderr

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)