Skip to content

Commit c244c41

Browse files
Handle glob import in redundancy check
1 parent df80eae commit c244c41

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/librustc_resolve/resolve_imports.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,10 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
12941294
directive.span,
12951295
) {
12961296
Ok(other_binding) => {
1297-
is_redundant[ns] = Some(binding.def() == other_binding.def());
1297+
is_redundant[ns] = Some(
1298+
binding.def() == other_binding.def()
1299+
&& !other_binding.is_ambiguity()
1300+
);
12981301
redundant_span[ns] =
12991302
Some((other_binding.span, other_binding.is_import()));
13001303
}

src/test/ui/lint/use-redundant.stderr

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,3 @@ LL | use crate::foo::Bar;
2525
LL | use crate::foo::Bar;
2626
| ^^^^^^^^^^^^^^^
2727

28-
warning: the item `S` is imported redundantly
29-
--> $DIR/use-redundant.rs:25:9
30-
|
31-
LL | use m1::*;
32-
| ----- the item `S` is already imported here
33-
...
34-
LL | use m1::S;
35-
| ^^^^^
36-

0 commit comments

Comments
 (0)