Add glob import to redundancy test

This commit is contained in:
Fabian Drinck 2019-03-17 11:55:32 +01:00
parent 0f3b1c0358
commit 4a619aa126
2 changed files with 37 additions and 7 deletions

View File

@ -11,8 +11,17 @@ fn baz() -> Bar {
3
}
mod m1 { pub struct S {} }
mod m2 { pub struct S {} }
use m1::*;
use m2::*;
fn main() {
use crate::foo::Bar; //~ WARNING redundant import
let _a: Bar = 3;
baz();
use m1::S; //~ WARNING redundant import
let _s = S {};
}

View File

@ -1,11 +1,8 @@
warning: the item `Bar` is imported redundantly
--> $DIR/use-redundant.rs:15:9
warning: unused import: `m1::*`
--> $DIR/use-redundant.rs:17:5
|
LL | use crate::foo::Bar;
| --------------- the item `Bar` was already imported here
...
LL | use crate::foo::Bar;
| ^^^^^^^^^^^^^^^
LL | use m1::*;
| ^^^^^
|
note: lint level defined here
--> $DIR/use-redundant.rs:2:9
@ -13,3 +10,27 @@ note: lint level defined here
LL | #![warn(unused_imports)]
| ^^^^^^^^^^^^^^
warning: unused import: `m2::*`
--> $DIR/use-redundant.rs:18:5
|
LL | use m2::*;
| ^^^^^
warning: the item `Bar` is imported redundantly
--> $DIR/use-redundant.rs:21:9
|
LL | use crate::foo::Bar;
| --------------- the item `Bar` was already imported here
...
LL | use crate::foo::Bar;
| ^^^^^^^^^^^^^^^
warning: the item `S` is imported redundantly
--> $DIR/use-redundant.rs:25:9
|
LL | use m1::*;
| ----- the item `S` was already imported here
...
LL | use m1::S;
| ^^^^^