rust/tests/ui/lint/use-redundant/use-redundant.rs

28 lines
395 B
Rust
Raw Normal View History

2020-01-22 18:00:00 -06:00
// check-pass
2019-03-17 05:38:38 -05:00
#![warn(unused_imports)]
use crate::foo::Bar;
mod foo {
pub type Bar = i32;
}
fn baz() -> Bar {
3
}
2019-03-17 05:55:32 -05:00
mod m1 { pub struct S {} }
mod m2 { pub struct S {} }
use m1::*; //~ WARNING unused import
use m2::*; //~ WARNING unused import
2019-03-17 05:55:32 -05:00
fn main() {
use crate::foo::Bar; //~ WARNING imported redundantly
let _a: Bar = 3;
baz();
2019-03-17 05:55:32 -05:00
use m1::S;
2019-03-17 05:55:32 -05:00
let _s = S {};
}