auto merge of #5179 : alexcrichton/rust/default-warn-unused-import, r=graydon

I've found that unused imports can often start cluttering a project after a long time, and it's very useful to keep them under control. I don't like how Go forces a compiler error by default and it can't be changed, but I certainly want to know about them so I think that a warn is a good default.

Now that the `unused_imports` lint option is a bit smarter, I think it's possible to change the default level to warn. This commit also removes all unused imports throughout the compiler and libraries (500+).

The only odd things that I ran into were that some `use` statements had to have `#[cfg(notest)]` or `#[cfg(test)]` based on where they were. The ones with `notest` were mostly in core for modules like `cmp` whereas `cfg(test)` was for tests that weren't part of a normal `mod test` module.
This commit is contained in:
bors 2013-03-05 00:57:46 -08:00
commit 75c5bc90d2
220 changed files with 161 additions and 731 deletions

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::either::*;
enum X = Either<(uint,uint),extern fn()>;
pub impl &X {
fn with(blk: fn(x: &Either<(uint,uint),extern fn()>)) {

View file

@ -11,7 +11,6 @@
//buggy.rs
extern mod std;
use std::oldmap::HashMap;
use std::oldmap;
fn main() {
let buggy_map :HashMap<uint, &uint> =

View file

@ -1,9 +1,5 @@
extern mod std;
use std::ebml::reader;
use std::ebml::writer;
use std::serialize;
fn main() {
let foo = ~3;
let _pfoo = &foo;

View file

@ -13,7 +13,6 @@
// we let an impl method can have more permissive bounds than the trait
// method it's implementing, the return type might be less specific than
// needed. Just punt and make it invariant.
use core::iter::BaseIter;
trait A {
fn b<C:Copy + Const,D>(x: C) -> C;

View file

@ -10,7 +10,6 @@
// Tests that an impl method's bounds aren't *more* restrictive
// than the trait method it's implementing
use core::iter::BaseIter;
trait A {
fn b<C:Copy,D>(x: C) -> C;

View file

@ -10,7 +10,6 @@
// Tests that ty params get matched correctly when comparing
// an impl against a trait
use core::iter::BaseIter;
trait A {
fn b<C:Copy,D>(x: C) -> C;

View file

@ -13,8 +13,6 @@
// See middle::ty::type_contents() for more information.
extern mod std;
use core::cmp::Ord;
use core::option::swap_unwrap;
struct List { key: int, next: Option<~List> }

View file

@ -11,8 +11,6 @@
mod argparse {
extern mod std;
use core::either::{Either, Left, Right};
pub struct Flag {
name: &str,
desc: &str,