Skip to content

Commit 0ddd6b9

Browse files
Add glob import to redundancy test
1 parent aac7295 commit 0ddd6b9

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,17 @@ fn baz() -> Bar {
1111
3
1212
}
1313

14+
mod m1 { pub struct S {} }
15+
mod m2 { pub struct S {} }
16+
17+
use m1::*;
18+
use m2::*;
19+
1420
fn main() {
1521
use crate::foo::Bar; //~ WARNING redundant import
1622
let _a: Bar = 3;
1723
baz();
24+
25+
use m1::S; //~ WARNING redundant import
26+
let _s = S {};
1827
}

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

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
1+
warning: unused import: `m1::*`
2+
--> $DIR/use-redundant.rs:17:5
3+
|
4+
LL | use m1::*;
5+
| ^^^^^
6+
|
7+
note: lint level defined here
8+
--> $DIR/use-redundant.rs:2:9
9+
|
10+
LL | #![warn(unused_imports)]
11+
| ^^^^^^^^^^^^^^
12+
13+
warning: unused import: `m2::*`
14+
--> $DIR/use-redundant.rs:18:5
15+
|
16+
LL | use m2::*;
17+
| ^^^^^
18+
119
warning: the item `Bar` is imported redundantly
2-
--> $DIR/use-redundant.rs:15:9
20+
--> $DIR/use-redundant.rs:21:9
321
|
422
LL | use crate::foo::Bar;
523
| --------------- the item `Bar` was already imported here
624
...
725
LL | use crate::foo::Bar;
826
| ^^^^^^^^^^^^^^^
27+
28+
warning: the item `S` is imported redundantly
29+
--> $DIR/use-redundant.rs:25:9
930
|
10-
note: lint level defined here
11-
--> $DIR/use-redundant.rs:2:9
12-
|
13-
LL | #![warn(unused_imports)]
14-
| ^^^^^^^^^^^^^^
31+
LL | use m1::*;
32+
| ----- the item `S` was already imported here
33+
...
34+
LL | use m1::S;
35+
| ^^^^^
1536

0 commit comments

Comments
 (0)