diff options
| author | Fabian Drinck <fabian.drinck@rwth-aachen.de> | 2019-03-17 11:55:32 +0100 |
|---|---|---|
| committer | Fabian Drinck <fabian.drinck@rwth-aachen.de> | 2019-03-30 22:37:02 +0100 |
| commit | 4a619aa1261c995abedc446226a7701c2c9e1c79 (patch) | |
| tree | 76a85af680cd9ef3985807a98ce2f01ba530a419 | |
| parent | 0f3b1c035837fc5e101d5a2d8c49b1d5128927b5 (diff) | |
| download | rust-4a619aa1261c995abedc446226a7701c2c9e1c79.tar.gz rust-4a619aa1261c995abedc446226a7701c2c9e1c79.zip | |
Add glob import to redundancy test
| -rw-r--r-- | src/test/ui/lint/use-redundant.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/lint/use-redundant.stderr | 33 |
2 files changed, 36 insertions, 6 deletions
diff --git a/src/test/ui/lint/use-redundant.rs b/src/test/ui/lint/use-redundant.rs index 7abf5e498b5..328f8232baf 100644 --- a/src/test/ui/lint/use-redundant.rs +++ b/src/test/ui/lint/use-redundant.rs @@ -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 {}; } diff --git a/src/test/ui/lint/use-redundant.stderr b/src/test/ui/lint/use-redundant.stderr index b25ffc6073f..82d2312779e 100644 --- a/src/test/ui/lint/use-redundant.stderr +++ b/src/test/ui/lint/use-redundant.stderr @@ -1,15 +1,36 @@ +warning: unused import: `m1::*` + --> $DIR/use-redundant.rs:17:5 + | +LL | use m1::*; + | ^^^^^ + | +note: lint level defined here + --> $DIR/use-redundant.rs:2:9 + | +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:15:9 + --> $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 | -note: lint level defined here - --> $DIR/use-redundant.rs:2:9 - | -LL | #![warn(unused_imports)] - | ^^^^^^^^^^^^^^ +LL | use m1::*; + | ----- the item `S` was already imported here +... +LL | use m1::S; + | ^^^^^ |
