1 #![deny(unused_imports)]
6 use std::mem::*; // shouldn't get errors for not using
9 //~^ ERROR unused import: `std::fmt::{}`
11 // Should get errors for both 'Some' and 'None'
12 use std::option::Option::{Some, None};
13 //~^ ERROR unused imports: `None`, `Some`
15 use test::A; //~ ERROR unused import: `test::A`
16 // Be sure that if we just bring some methods into scope that they're also
17 // counted as being used.
19 // But only when actually used: do not get confused by the method with the same name.
20 use test::B2; //~ ERROR unused import: `test::B2`
22 // Make sure this import is warned about when at least one of its imported names
24 use test2::{foo, bar}; //~ ERROR unused import: `bar`
32 pub trait A { fn a(&self) {} }
33 pub trait B { fn b(&self) {} }
34 pub trait B2 { fn b(&self) {} }
41 pub struct Point{pub x: isize, pub y: isize}
42 pub struct Square{pub p: Point, pub h: usize, pub w: usize}
46 // Don't ignore on 'pub use' because we're not sure if it's used or not
47 pub use std::cmp::PartialEq;
52 use foo::Square; //~ ERROR unused import: `foo::Square`
53 pub fn cc(_p: Point) -> super::Square {
54 fn f() -> super::Square {
61 #[allow(unused_imports)]
63 use std::cmp::PartialEq;
68 use self::g; //~ ERROR unused import: `self::g`
69 //~^ ERROR the item `g` is imported redundantly
76 #[allow(unused_variables)]
78 use test2::foo; //~ ERROR unused import: `test2::foo`
79 //~^ ERROR the item `foo` is imported redundantly
84 cal(foo::Point{x:3, y:9});