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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
415 B
Rust
Raw Normal View History

2020-01-23 00:00:00 +00:00
//@ check-pass
2024-04-11 18:10:34 +00:00
#![warn(unused_imports, redundant_imports)]
use crate::foo::Bar;
mod foo {
pub type Bar = i32;
}
fn baz() -> Bar {
3
}
2019-03-17 10:55:32 +00:00
mod m1 { pub struct S {} }
mod m2 { pub struct S {} }
use m1::*; //~ WARNING unused import
use m2::*; //~ WARNING unused import
2019-03-17 10:55:32 +00:00
fn main() {
2024-04-11 18:10:34 +00:00
use crate::foo::Bar; //~ WARNING imported redundantly
let _a: Bar = 3;
baz();
2019-03-17 10:55:32 +00:00
use m1::S;
2019-03-17 10:55:32 +00:00
let _s = S {};
}