Skip to content

Commit 87e727a

Browse files
Handle glob import in redundancy check
1 parent ab2522a commit 87e727a

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
@@ -1297,7 +1297,10 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
12971297
directive.span,
12981298
) {
12991299
Ok(other_binding) => {
1300-
is_redundant[ns] = Some(binding.def() == other_binding.def());
1300+
is_redundant[ns] = Some(
1301+
binding.def() == other_binding.def()
1302+
&& !other_binding.is_ambiguity()
1303+
);
13011304
redundant_span[ns] =
13021305
Some((other_binding.span, other_binding.is_import()));
13031306
}

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)