Fix warning about unused imports in import lists

Before, if anything in a list was used, the entire list was considered to be
used. This corrects this and also warns on a span of the actual unused import
instead of the entire list.
This commit is contained in:
Alex Crichton 2013-03-26 16:08:59 -04:00
parent 7a6cd2b21e
commit cc83049a56
2 changed files with 15 additions and 11 deletions

View file

@ -17,14 +17,19 @@ use core::either::Right; //~ ERROR unused import
use core::util::*; // shouldn't get errors for not using
// everything imported
// Should only get one error instead of two errors here
// Should get errors for both 'Some' and 'None'
use core::option::{Some, None}; //~ ERROR unused import
//^~ ERROR unused import
use core::io::ReaderUtil; //~ ERROR unused import
// Be sure that if we just bring some methods into scope that they're also
// counted as being used.
use core::io::WriterUtil;
// Make sure this import is warned about when at least one of its imported names
// is unused
use core::vec::{filter, map}; //~ ERROR unused import
mod foo {
pub struct Point{x: int, y: int}
pub struct Square{p: Point, h: uint, w: uint}
@ -51,4 +56,7 @@ fn main() {
let a = 3;
ignore(a);
io::stdout().write_str(~"a");
let _a = do map(~[2]) |&x| {
x + 2
};
}