about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-05 00:57:46 -0800
committerbors <bors@rust-lang.org>2013-03-05 00:57:46 -0800
commit75c5bc90d2d3fb3e495b38c49c7cc96797795c72 (patch)
treeb01a9f1428b1b3ed4fa126a9c8d5cbbe8056f3ce
parent71f09813c86ad4d78d7760f4fcc8659f12532e63 (diff)
parentcb4ab76e4a17e0efc6b506af15fd1df654c043ff (diff)
downloadrust-75c5bc90d2d3fb3e495b38c49c7cc96797795c72.tar.gz
rust-75c5bc90d2d3fb3e495b38c49c7cc96797795c72.zip
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. 
-rw-r--r--src/compiletest/common.rs2
-rw-r--r--src/compiletest/compiletest.rc1
-rw-r--r--src/compiletest/errors.rs2
-rw-r--r--src/compiletest/procsrv.rs3
-rw-r--r--src/compiletest/runtest.rs2
-rw-r--r--src/compiletest/util.rs2
-rw-r--r--src/libcore/bool.rs6
-rw-r--r--src/libcore/char.rs8
-rw-r--r--src/libcore/dvec.rs1
-rw-r--r--src/libcore/either.rs1
-rw-r--r--src/libcore/flate.rs3
-rw-r--r--src/libcore/hash.rs1
-rw-r--r--src/libcore/hashmap.rs3
-rw-r--r--src/libcore/io.rs7
-rw-r--r--src/libcore/iter-trait/dlist.rs2
-rw-r--r--src/libcore/libc.rs1
-rw-r--r--src/libcore/logging.rs9
-rw-r--r--src/libcore/managed.rs5
-rw-r--r--src/libcore/nil.rs1
-rw-r--r--src/libcore/num/f32.rs5
-rw-r--r--src/libcore/num/f64.rs6
-rw-r--r--src/libcore/num/float.rs10
-rw-r--r--src/libcore/num/int-template.rs12
-rw-r--r--src/libcore/num/num.rs3
-rw-r--r--src/libcore/num/uint-template.rs12
-rw-r--r--src/libcore/num/uint-template/uint.rs88
-rw-r--r--src/libcore/option.rs6
-rw-r--r--src/libcore/os.rs2
-rw-r--r--src/libcore/owned.rs2
-rw-r--r--src/libcore/path.rs2
-rw-r--r--src/libcore/pipes.rs2
-rw-r--r--src/libcore/ptr.rs24
-rw-r--r--src/libcore/repr.rs10
-rw-r--r--src/libcore/result.rs1
-rw-r--r--src/libcore/run.rs2
-rw-r--r--src/libcore/stackwalk.rs2
-rw-r--r--src/libcore/str.rs7
-rw-r--r--src/libcore/sys.rs2
-rw-r--r--src/libcore/task/local_data.rs1
-rw-r--r--src/libcore/task/mod.rs8
-rw-r--r--src/libcore/task/spawn.rs2
-rw-r--r--src/libcore/to_str.rs2
-rw-r--r--src/libcore/tuple.rs3
-rw-r--r--src/libcore/unstable.rs9
-rw-r--r--src/libcore/unstable/at_exit.rs4
-rw-r--r--src/libcore/unstable/extfmt.rs3
-rw-r--r--src/libcore/unstable/finally.rs3
-rw-r--r--src/libcore/unstable/global.rs10
-rw-r--r--src/libcore/unstable/lang.rs3
-rw-r--r--src/libcore/unstable/weak_task.rs1
-rw-r--r--src/libcore/util.rs2
-rw-r--r--src/libcore/vec.rs1
-rw-r--r--src/librustc/back/link.rs7
-rw-r--r--src/librustc/back/rpath.rs11
-rw-r--r--src/librustc/driver/driver.rs6
-rw-r--r--src/librustc/driver/session.rs5
-rw-r--r--src/librustc/front/core_inject.rs1
-rw-r--r--src/librustc/front/test.rs4
-rw-r--r--src/librustc/lib/llvm.rs5
-rw-r--r--src/librustc/metadata/creader.rs3
-rw-r--r--src/librustc/metadata/csearch.rs5
-rw-r--r--src/librustc/metadata/cstore.rs4
-rw-r--r--src/librustc/metadata/decoder.rs7
-rw-r--r--src/librustc/metadata/encoder.rs5
-rw-r--r--src/librustc/metadata/tydecode.rs2
-rw-r--r--src/librustc/middle/astencode.rs14
-rw-r--r--src/librustc/middle/borrowck/check_loans.rs3
-rw-r--r--src/librustc/middle/borrowck/gather_loans.rs1
-rw-r--r--src/librustc/middle/borrowck/mod.rs11
-rw-r--r--src/librustc/middle/borrowck/preserve.rs1
-rw-r--r--src/librustc/middle/check_const.rs1
-rw-r--r--src/librustc/middle/check_match.rs3
-rw-r--r--src/librustc/middle/const_eval.rs1
-rw-r--r--src/librustc/middle/freevars.rs1
-rw-r--r--src/librustc/middle/kind.rs2
-rw-r--r--src/librustc/middle/lang_items.rs2
-rw-r--r--src/librustc/middle/lint.rs5
-rw-r--r--src/librustc/middle/mem_categorization.rs2
-rw-r--r--src/librustc/middle/pat_util.rs3
-rw-r--r--src/librustc/middle/region.rs4
-rw-r--r--src/librustc/middle/resolve.rs6
-rw-r--r--src/librustc/middle/trans/base.rs10
-rw-r--r--src/librustc/middle/trans/build.rs5
-rw-r--r--src/librustc/middle/trans/cabi_x86_64.rs1
-rw-r--r--src/librustc/middle/trans/callee.rs2
-rw-r--r--src/librustc/middle/trans/closure.rs5
-rw-r--r--src/librustc/middle/trans/common.rs4
-rw-r--r--src/librustc/middle/trans/controlflow.rs1
-rw-r--r--src/librustc/middle/trans/datum.rs3
-rw-r--r--src/librustc/middle/trans/debuginfo.rs4
-rw-r--r--src/librustc/middle/trans/expr.rs2
-rw-r--r--src/librustc/middle/trans/foreign.rs4
-rw-r--r--src/librustc/middle/trans/inline.rs3
-rw-r--r--src/librustc/middle/trans/meth.rs4
-rw-r--r--src/librustc/middle/trans/monomorphize.rs1
-rw-r--r--src/librustc/middle/trans/reachable.rs1
-rw-r--r--src/librustc/middle/trans/reflect.rs2
-rw-r--r--src/librustc/middle/trans/shape.rs15
-rw-r--r--src/librustc/middle/trans/tvec.rs2
-rw-r--r--src/librustc/middle/trans/type_of.rs2
-rw-r--r--src/librustc/middle/trans/type_use.rs2
-rw-r--r--src/librustc/middle/trans/uniq.rs2
-rw-r--r--src/librustc/middle/ty.rs1
-rw-r--r--src/librustc/middle/typeck/astconv.rs3
-rw-r--r--src/librustc/middle/typeck/check/_match.rs2
-rw-r--r--src/librustc/middle/typeck/check/method.rs5
-rw-r--r--src/librustc/middle/typeck/check/mod.rs3
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs2
-rw-r--r--src/librustc/middle/typeck/check/regionmanip.rs1
-rw-r--r--src/librustc/middle/typeck/check/vtable.rs2
-rw-r--r--src/librustc/middle/typeck/check/writeback.rs1
-rw-r--r--src/librustc/middle/typeck/coherence.rs4
-rw-r--r--src/librustc/middle/typeck/collect.rs2
-rw-r--r--src/librustc/middle/typeck/infer/coercion.rs1
-rw-r--r--src/librustc/middle/typeck/infer/glb.rs1
-rw-r--r--src/librustc/middle/typeck/infer/mod.rs9
-rw-r--r--src/librustc/middle/typeck/infer/region_inference.rs4
-rw-r--r--src/librustc/middle/typeck/infer/resolve.rs1
-rw-r--r--src/librustc/middle/typeck/infer/sub.rs1
-rw-r--r--src/librustc/middle/typeck/infer/to_str.rs1
-rw-r--r--src/librustc/middle/typeck/infer/unify.rs3
-rw-r--r--src/librustc/middle/typeck/mod.rs12
-rw-r--r--src/librustc/middle/typeck/rscope.rs1
-rw-r--r--src/librustc/rustc.rc15
-rw-r--r--src/librustc/util/common.rs4
-rw-r--r--src/librustc/util/ppaux.rs4
-rw-r--r--src/librustdoc/astsrv.rs10
-rw-r--r--src/librustdoc/attr_parser.rs6
-rw-r--r--src/librustdoc/attr_pass.rs2
-rw-r--r--src/librustdoc/desc_to_brief_pass.rs1
-rw-r--r--src/librustdoc/doc.rs2
-rw-r--r--src/librustdoc/fold.rs7
-rw-r--r--src/librustdoc/markdown_index_pass.rs1
-rw-r--r--src/librustdoc/markdown_pass.rs18
-rw-r--r--src/librustdoc/markdown_writer.rs10
-rw-r--r--src/librustdoc/page_pass.rs3
-rw-r--r--src/librustdoc/parse.rs2
-rw-r--r--src/librustdoc/pass.rs3
-rw-r--r--src/librustdoc/path_pass.rs3
-rw-r--r--src/librustdoc/prune_hidden_pass.rs5
-rw-r--r--src/librustdoc/prune_private_pass.rs2
-rw-r--r--src/librustdoc/rustdoc.rc2
-rw-r--r--src/librustdoc/sectionalize_pass.rs4
-rw-r--r--src/librustdoc/sort_item_name_pass.rs5
-rw-r--r--src/librustdoc/sort_item_type_pass.rs8
-rw-r--r--src/librustdoc/sort_pass.rs6
-rw-r--r--src/librustdoc/text_pass.rs1
-rw-r--r--src/librustdoc/trim_pass.rs5
-rw-r--r--src/librustdoc/tystr_pass.rs2
-rw-r--r--src/librustdoc/unindent_pass.rs1
-rw-r--r--src/librustdoc/util.rs2
-rw-r--r--src/librusti/rusti.rc6
-rw-r--r--src/librustpkg/util.rs2
-rw-r--r--src/libstd/arc.rs6
-rw-r--r--src/libstd/arena.rs5
-rw-r--r--src/libstd/base64.rs1
-rw-r--r--src/libstd/bitv.rs1
-rw-r--r--src/libstd/c_vec.rs2
-rw-r--r--src/libstd/deque.rs2
-rw-r--r--src/libstd/ebml.rs6
-rw-r--r--src/libstd/flatpipes.rs13
-rw-r--r--src/libstd/future.rs4
-rw-r--r--src/libstd/getopts.rs2
-rw-r--r--src/libstd/io_util.rs1
-rw-r--r--src/libstd/list.rs1
-rw-r--r--src/libstd/net_ip.rs3
-rw-r--r--src/libstd/net_url.rs6
-rw-r--r--src/libstd/oldmap.rs4
-rw-r--r--src/libstd/prettyprint.rs1
-rw-r--r--src/libstd/rope.rs2
-rw-r--r--src/libstd/sync.rs3
-rw-r--r--src/libstd/task_pool.rs2
-rw-r--r--src/libstd/tempfile.rs1
-rw-r--r--src/libstd/term.rs2
-rw-r--r--src/libstd/test.rs1
-rw-r--r--src/libstd/time.rs3
-rw-r--r--src/libstd/timer.rs1
-rw-r--r--src/libstd/uv_global_loop.rs7
-rw-r--r--src/libstd/uv_iotask.rs1
-rw-r--r--src/libstd/workcache.rs1
-rw-r--r--src/libsyntax/ast.rs10
-rw-r--r--src/libsyntax/ast_map.rs3
-rw-r--r--src/libsyntax/ast_util.rs1
-rw-r--r--src/libsyntax/attr.rs2
-rw-r--r--src/libsyntax/codemap.rs1
-rw-r--r--src/libsyntax/diagnostic.rs1
-rw-r--r--src/libsyntax/ext/auto_encode.rs9
-rw-r--r--src/libsyntax/ext/base.rs2
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/deriving.rs1
-rw-r--r--src/libsyntax/ext/expand.rs1
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/ext/pipes/mod.rs1
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs1
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs6
-rw-r--r--src/libsyntax/ext/pipes/proto.rs1
-rw-r--r--src/libsyntax/ext/quote.rs3
-rw-r--r--src/libsyntax/ext/trace_macros.rs1
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs3
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs1
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs2
-rw-r--r--src/libsyntax/parse/attr.rs4
-rw-r--r--src/libsyntax/parse/classify.rs1
-rw-r--r--src/libsyntax/parse/comments.rs1
-rw-r--r--src/libsyntax/parse/common.rs2
-rw-r--r--src/libsyntax/parse/lexer.rs2
-rw-r--r--src/libsyntax/parse/mod.rs2
-rw-r--r--src/libsyntax/parse/obsolete.rs2
-rw-r--r--src/libsyntax/parse/parser.rs7
-rw-r--r--src/libsyntax/print/pp.rs3
-rw-r--r--src/libsyntax/print/pprust.rs4
-rw-r--r--src/libsyntax/visit.rs3
-rw-r--r--src/test/compile-fail/borrowck-autoref-3261.rs1
-rw-r--r--src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs1
-rw-r--r--src/test/compile-fail/borrowck-move-by-capture.rs4
-rw-r--r--src/test/compile-fail/issue-2611-3.rs1
-rw-r--r--src/test/compile-fail/issue-2611-4.rs1
-rw-r--r--src/test/compile-fail/issue-2611-5.rs1
-rw-r--r--src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs2
-rw-r--r--src/test/compile-fail/regions-glb-free-free.rs2
220 files changed, 161 insertions, 731 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index 0facf9d63c3..b7c4e26c4b1 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -10,8 +10,6 @@
 
 use core::prelude::*;
 
-use cmp;
-
 #[deriving_eq]
 pub enum mode {
     mode_compile_fail,
diff --git a/src/compiletest/compiletest.rc b/src/compiletest/compiletest.rc
index bccaf0ddf60..531e2329b0e 100644
--- a/src/compiletest/compiletest.rc
+++ b/src/compiletest/compiletest.rc
@@ -32,7 +32,6 @@ pub mod errors;
 use std::getopts;
 use std::test;
 
-use core::{result, either};
 use core::result::{Ok, Err};
 
 use common::config;
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs
index 39b70299ba5..16af0a4b575 100644
--- a/src/compiletest/errors.rs
+++ b/src/compiletest/errors.rs
@@ -10,8 +10,6 @@
 
 use core::prelude::*;
 
-use common::config;
-
 use core::io;
 use core::io::ReaderUtil;
 use core::str;
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs
index 8d8cdb3c719..f11e0ba74b6 100644
--- a/src/compiletest/procsrv.rs
+++ b/src/compiletest/procsrv.rs
@@ -13,14 +13,11 @@ use core::prelude::*;
 use core::io::{ReaderUtil, WriterUtil};
 use core::io;
 use core::libc::{c_int, pid_t};
-use core::libc;
 use core::os;
-use core::pipes;
 use core::run::spawn_process;
 use core::run;
 use core::str;
 use core::task;
-use core::vec;
 
 #[cfg(target_os = "win32")]
 fn target_env(lib_path: ~str, prog: ~str) -> ~[(~str,~str)] {
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index b5def15fc50..e0db543250d 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -10,14 +10,12 @@
 
 use core::prelude::*;
 
-use common;
 use common::mode_run_pass;
 use common::mode_run_fail;
 use common::mode_compile_fail;
 use common::mode_pretty;
 use common::config;
 use errors;
-use header;
 use header::load_props;
 use header::TestProps;
 use procsrv;
diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs
index ad60e532f3c..736c20969e9 100644
--- a/src/compiletest/util.rs
+++ b/src/compiletest/util.rs
@@ -10,12 +10,10 @@
 
 use core::prelude::*;
 
-use common;
 use common::config;
 
 use core::io;
 use core::os::getenv;
-use core::os;
 
 pub fn make_new_path(path: ~str) -> ~str {
 
diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs
index 89ffaeff63d..26a68e3a199 100644
--- a/src/libcore/bool.rs
+++ b/src/libcore/bool.rs
@@ -11,10 +11,8 @@
 
 //! Boolean logic
 
-use bool;
-use cmp;
-use cmp::Eq;
 use option::{None, Option, Some};
+#[cfg(notest)] use cmp;
 
 /// Negation / inverse
 pub pure fn not(v: bool) -> bool { !v }
@@ -82,7 +80,7 @@ impl cmp::Eq for bool {
 #[test]
 pub fn test_bool_from_str() {
     do all_values |v| {
-        assert Some(v) == from_str(bool::to_str(v))
+        assert Some(v) == from_str(to_str(v))
     }
 }
 
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index daff7d116e8..36b03af2d38 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -10,14 +10,14 @@
 
 //! Utilities for manipulating the char type
 
-use char;
-use cmp::Eq;
 use option::{None, Option, Some};
 use str;
 use u32;
 use uint;
 use unicode;
 
+#[cfg(notest)] use cmp::Eq;
+
 /*
     Lu  Uppercase_Letter    an uppercase letter
     Ll  Lowercase_Letter    a lowercase letter
@@ -305,8 +305,8 @@ fn test_to_digit() {
 
 #[test]
 fn test_is_ascii() {
-   assert str::all(~"banana", char::is_ascii);
-   assert ! str::all(~"ประเทศไทย中华Việt Nam", char::is_ascii);
+   assert str::all(~"banana", is_ascii);
+   assert ! str::all(~"ประเทศไทย中华Việt Nam", is_ascii);
 }
 
 #[test]
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs
index 7197de36404..5ec0dd073c8 100644
--- a/src/libcore/dvec.rs
+++ b/src/libcore/dvec.rs
@@ -20,7 +20,6 @@ Note that recursive use is not permitted.
 */
 
 use cast;
-use cast::reinterpret_cast;
 use prelude::*;
 use ptr::null;
 use vec;
diff --git a/src/libcore/either.rs b/src/libcore/either.rs
index 93b28233acd..e5091cc8c34 100644
--- a/src/libcore/either.rs
+++ b/src/libcore/either.rs
@@ -11,7 +11,6 @@
 //! A type that represents one of two alternatives
 
 use cmp::Eq;
-use cmp;
 use kinds::Copy;
 use result::Result;
 use result;
diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs
index c47e27e75d9..4d01c102707 100644
--- a/src/libcore/flate.rs
+++ b/src/libcore/flate.rs
@@ -17,9 +17,10 @@ Simple compression
 use libc;
 use libc::{c_void, size_t, c_int};
 use ptr;
-use rand;
 use vec;
 
+#[cfg(test)] use rand;
+
 extern mod rustrt {
     unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
                                          src_buf_len: size_t,
diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs
index 4a1a1952907..a6048e2b25a 100644
--- a/src/libcore/hash.rs
+++ b/src/libcore/hash.rs
@@ -21,7 +21,6 @@
 
 use io;
 use io::{Writer, WriterUtil};
-use os;
 use to_bytes::IterBytes;
 use uint;
 use vec;
diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs
index 007e3260aa1..b6ba790c300 100644
--- a/src/libcore/hashmap.rs
+++ b/src/libcore/hashmap.rs
@@ -19,11 +19,8 @@ pub mod linear {
     use iter::BaseIter;
     use hash::Hash;
     use iter;
-    use kinds::Copy;
     use option::{None, Option, Some};
-    use option;
     use rand;
-    use to_bytes::IterBytes;
     use uint;
     use vec;
 
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index 7bf475289c3..c0030179fe5 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -16,14 +16,11 @@ Basic input/output
 
 use result::Result;
 
-use cmp::Eq;
 use dvec::DVec;
 use int;
 use libc;
 use libc::{c_int, c_long, c_uint, c_void, size_t, ssize_t};
 use libc::consts::os::posix88::*;
-use libc::consts::os::extra::*;
-use option;
 use os;
 use prelude::*;
 use ptr;
@@ -719,7 +716,9 @@ pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
     -> Result<Writer, ~str> {
 
     #[cfg(windows)]
-    fn wb() -> c_int { (O_WRONLY | O_BINARY) as c_int }
+    fn wb() -> c_int {
+      (O_WRONLY | libc::consts::os::extra::O_BINARY) as c_int
+    }
 
     #[cfg(unix)]
     fn wb() -> c_int { O_WRONLY as c_int }
diff --git a/src/libcore/iter-trait/dlist.rs b/src/libcore/iter-trait/dlist.rs
index 5f95c00f336..41d509f1402 100644
--- a/src/libcore/iter-trait/dlist.rs
+++ b/src/libcore/iter-trait/dlist.rs
@@ -9,8 +9,6 @@
 // except according to those terms.
 
 mod inst {
-    use cast;
-    use dlist;
     use dlist::DList;
     use managed;
     use option::{Option, Some};
diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs
index c6229d7604c..9f673a14284 100644
--- a/src/libcore/libc.rs
+++ b/src/libcore/libc.rs
@@ -1007,7 +1007,6 @@ pub mod funcs {
 
     pub mod c95 {
         use libc::types::common::c95::{FILE, c_void, fpos_t};
-        use libc::types::common::posix88::dirent_t;
         use libc::types::os::arch::c95::{c_char, c_double, c_int, c_long};
         use libc::types::os::arch::c95::{c_uint, c_ulong, c_void, size_t};
 
diff --git a/src/libcore/logging.rs b/src/libcore/logging.rs
index 357a3415ac2..73af0ad3714 100644
--- a/src/libcore/logging.rs
+++ b/src/libcore/logging.rs
@@ -10,11 +10,7 @@
 
 //! Logging
 
-use cast::transmute;
-use io;
 use libc;
-use repr;
-use vec;
 
 #[nolink]
 extern mod rustrt {
@@ -48,6 +44,11 @@ pub fn console_off() {
 #[cfg(notest)]
 #[lang="log_type"]
 pub fn log_type<T>(level: u32, object: &T) {
+    use cast::transmute;
+    use io;
+    use repr;
+    use vec;
+
     let bytes = do io::with_bytes_writer |writer| {
         repr::write_repr(writer, object);
     };
diff --git a/src/libcore/managed.rs b/src/libcore/managed.rs
index bed50cfbc25..1f347371dfd 100644
--- a/src/libcore/managed.rs
+++ b/src/libcore/managed.rs
@@ -10,12 +10,9 @@
 
 //! Operations on managed box types
 
-use cast::transmute;
-use cmp::{Eq, Ord};
-use managed::raw::BoxRepr;
-use prelude::*;
 use ptr;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
 
 pub mod raw {
 
diff --git a/src/libcore/nil.rs b/src/libcore/nil.rs
index 62ed1d24d79..cf2af7e38cc 100644
--- a/src/libcore/nil.rs
+++ b/src/libcore/nil.rs
@@ -14,6 +14,7 @@ Functions for the unit type.
 
 */
 
+#[cfg(notest)]
 use cmp::{Eq, Ord};
 
 #[cfg(notest)]
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index d4808bd111f..5100021b954 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -11,17 +11,18 @@
 //! Operations and constants for `f32`
 
 use cmath;
-use cmp;
 use libc::{c_float, c_int};
 use num::NumCast;
 use num::strconv;
 use num;
-use ops;
 use option::Option;
 use unstable::intrinsics::floorf32;
 use from_str;
 use to_str;
 
+#[cfg(notest)] use cmp;
+#[cfg(notest)] use ops;
+
 pub use cmath::c_float_targ_consts::*;
 
 macro_rules! delegate(
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index 5362a65f7ce..9470922b881 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -11,18 +11,18 @@
 //! Operations and constants for `f64`
 
 use cmath;
-use cmp;
 use libc::{c_double, c_int};
-use libc;
 use num::NumCast;
 use num::strconv;
 use num;
-use ops;
 use option::Option;
 use unstable::intrinsics::floorf64;
 use to_str;
 use from_str;
 
+#[cfg(notest)] use cmp;
+#[cfg(notest)] use ops;
+
 pub use cmath::c_double_targ_consts::*;
 pub use cmp::{min, max};
 
diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs
index 1b79ec614d4..5d912472d7d 100644
--- a/src/libcore/num/float.rs
+++ b/src/libcore/num/float.rs
@@ -20,21 +20,17 @@
 
 // PORT this must match in width according to architecture
 
-use m_float = f64;
-
-use cmp::{Eq, Ord};
-use cmp;
 use f64;
 use num::NumCast;
 use num::strconv;
 use num;
-use ops;
 use option::{None, Option, Some};
-use str;
-use uint;
 use to_str;
 use from_str;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
+#[cfg(notest)] use ops;
+
 pub use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt};
 pub use f64::logarithm;
 pub use f64::{acos, asin, atan2, cbrt, ceil, copysign, cosh, floor};
diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs
index ef661d2160b..c0351e2c619 100644
--- a/src/libcore/num/int-template.rs
+++ b/src/libcore/num/int-template.rs
@@ -10,21 +10,15 @@
 
 use T = self::inst::T;
 
-use char;
-use cmp::{Eq, Ord};
-use cmp;
 use to_str::ToStr;
 use from_str::FromStr;
 use num::{ToStrRadix, FromStrRadix};
 use num::strconv;
 use num;
 use prelude::*;
-use str;
-use uint;
-use vec;
-use i8;
-use i16;
-use i32;
+
+#[cfg(notest)] use cmp::{Eq, Ord};
+
 pub use cmp::{min, max};
 
 pub const bits : uint = inst::bits;
diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs
index 4d97df621da..c141820198f 100644
--- a/src/libcore/num/num.rs
+++ b/src/libcore/num/num.rs
@@ -12,10 +12,7 @@
 use cmp::{Ord, Eq};
 use ops::{Add, Div, Modulo, Mul, Neg, Sub};
 use option::{None, Option, Some};
-use char;
-use str;
 use kinds::Copy;
-use vec;
 
 pub mod strconv;
 
diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs
index 8d5726b8679..0dbf7403e27 100644
--- a/src/libcore/num/uint-template.rs
+++ b/src/libcore/num/uint-template.rs
@@ -11,9 +11,6 @@
 use T = self::inst::T;
 use T_SIGNED = self::inst::T_SIGNED;
 
-use char;
-use cmp::{Eq, Ord};
-use cmp;
 use to_str::ToStr;
 use from_str::FromStr;
 use num::{ToStrRadix, FromStrRadix};
@@ -21,12 +18,8 @@ use num::strconv;
 use num;
 use option::{None, Option, Some};
 use prelude::*;
-use str;
-use uint;
-use vec;
-use u8;
-use u16;
-use u32;
+
+#[cfg(notest)] use cmp::{Eq, Ord};
 
 pub use cmp::{min, max};
 
@@ -357,7 +350,6 @@ pub fn to_str_radix37() {
     uint::to_str_radix(100u, 37u);
 }
 
-use io;
 #[test]
 pub fn test_ranges() {
     let mut l = ~[];
diff --git a/src/libcore/num/uint-template/uint.rs b/src/libcore/num/uint-template/uint.rs
index 07467575319..206f8c0f6ca 100644
--- a/src/libcore/num/uint-template/uint.rs
+++ b/src/libcore/num/uint-template/uint.rs
@@ -19,7 +19,6 @@ pub use self::inst::{
 
 pub mod inst {
     use sys;
-    use uint;
     use iter;
 
     pub type T = uint;
@@ -144,50 +143,51 @@ pub mod inst {
 
     #[test]
     fn test_next_power_of_two() {
-        assert (uint::next_power_of_two(0u) == 0u);
-        assert (uint::next_power_of_two(1u) == 1u);
-        assert (uint::next_power_of_two(2u) == 2u);
-        assert (uint::next_power_of_two(3u) == 4u);
-        assert (uint::next_power_of_two(4u) == 4u);
-        assert (uint::next_power_of_two(5u) == 8u);
-        assert (uint::next_power_of_two(6u) == 8u);
-        assert (uint::next_power_of_two(7u) == 8u);
-        assert (uint::next_power_of_two(8u) == 8u);
-        assert (uint::next_power_of_two(9u) == 16u);
-        assert (uint::next_power_of_two(10u) == 16u);
-        assert (uint::next_power_of_two(11u) == 16u);
-        assert (uint::next_power_of_two(12u) == 16u);
-        assert (uint::next_power_of_two(13u) == 16u);
-        assert (uint::next_power_of_two(14u) == 16u);
-        assert (uint::next_power_of_two(15u) == 16u);
-        assert (uint::next_power_of_two(16u) == 16u);
-        assert (uint::next_power_of_two(17u) == 32u);
-        assert (uint::next_power_of_two(18u) == 32u);
-        assert (uint::next_power_of_two(19u) == 32u);
-        assert (uint::next_power_of_two(20u) == 32u);
-        assert (uint::next_power_of_two(21u) == 32u);
-        assert (uint::next_power_of_two(22u) == 32u);
-        assert (uint::next_power_of_two(23u) == 32u);
-        assert (uint::next_power_of_two(24u) == 32u);
-        assert (uint::next_power_of_two(25u) == 32u);
-        assert (uint::next_power_of_two(26u) == 32u);
-        assert (uint::next_power_of_two(27u) == 32u);
-        assert (uint::next_power_of_two(28u) == 32u);
-        assert (uint::next_power_of_two(29u) == 32u);
-        assert (uint::next_power_of_two(30u) == 32u);
-        assert (uint::next_power_of_two(31u) == 32u);
-        assert (uint::next_power_of_two(32u) == 32u);
-        assert (uint::next_power_of_two(33u) == 64u);
-        assert (uint::next_power_of_two(34u) == 64u);
-        assert (uint::next_power_of_two(35u) == 64u);
-        assert (uint::next_power_of_two(36u) == 64u);
-        assert (uint::next_power_of_two(37u) == 64u);
-        assert (uint::next_power_of_two(38u) == 64u);
-        assert (uint::next_power_of_two(39u) == 64u);
+        assert (next_power_of_two(0u) == 0u);
+        assert (next_power_of_two(1u) == 1u);
+        assert (next_power_of_two(2u) == 2u);
+        assert (next_power_of_two(3u) == 4u);
+        assert (next_power_of_two(4u) == 4u);
+        assert (next_power_of_two(5u) == 8u);
+        assert (next_power_of_two(6u) == 8u);
+        assert (next_power_of_two(7u) == 8u);
+        assert (next_power_of_two(8u) == 8u);
+        assert (next_power_of_two(9u) == 16u);
+        assert (next_power_of_two(10u) == 16u);
+        assert (next_power_of_two(11u) == 16u);
+        assert (next_power_of_two(12u) == 16u);
+        assert (next_power_of_two(13u) == 16u);
+        assert (next_power_of_two(14u) == 16u);
+        assert (next_power_of_two(15u) == 16u);
+        assert (next_power_of_two(16u) == 16u);
+        assert (next_power_of_two(17u) == 32u);
+        assert (next_power_of_two(18u) == 32u);
+        assert (next_power_of_two(19u) == 32u);
+        assert (next_power_of_two(20u) == 32u);
+        assert (next_power_of_two(21u) == 32u);
+        assert (next_power_of_two(22u) == 32u);
+        assert (next_power_of_two(23u) == 32u);
+        assert (next_power_of_two(24u) == 32u);
+        assert (next_power_of_two(25u) == 32u);
+        assert (next_power_of_two(26u) == 32u);
+        assert (next_power_of_two(27u) == 32u);
+        assert (next_power_of_two(28u) == 32u);
+        assert (next_power_of_two(29u) == 32u);
+        assert (next_power_of_two(30u) == 32u);
+        assert (next_power_of_two(31u) == 32u);
+        assert (next_power_of_two(32u) == 32u);
+        assert (next_power_of_two(33u) == 64u);
+        assert (next_power_of_two(34u) == 64u);
+        assert (next_power_of_two(35u) == 64u);
+        assert (next_power_of_two(36u) == 64u);
+        assert (next_power_of_two(37u) == 64u);
+        assert (next_power_of_two(38u) == 64u);
+        assert (next_power_of_two(39u) == 64u);
     }
 
     #[test]
     fn test_overflows() {
+        use uint;
         assert (uint::max_value > 0u);
         assert (uint::min_value <= 0u);
         assert (uint::min_value + uint::max_value + 1u == 0u);
@@ -195,9 +195,9 @@ pub mod inst {
 
     #[test]
     fn test_div() {
-        assert(uint::div_floor(3u, 4u) == 0u);
-        assert(uint::div_ceil(3u, 4u)  == 1u);
-        assert(uint::div_round(3u, 4u) == 1u);
+        assert(div_floor(3u, 4u) == 0u);
+        assert(div_ceil(3u, 4u)  == 1u);
+        assert(div_round(3u, 4u) == 1u);
     }
 
     #[test]
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 53944c4c2c8..e5719b599bd 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -43,12 +43,12 @@ let unwrapped_msg = match msg {
 
 use cmp::{Eq,Ord};
 use kinds::Copy;
-use option;
-use ptr;
-use str;
 use util;
 use num::Zero;
 
+#[cfg(test)] use ptr;
+#[cfg(test)] use str;
+
 /// The option type
 #[deriving_eq]
 pub enum Option<T> {
diff --git a/src/libcore/os.rs b/src/libcore/os.rs
index 6e040286ba4..2341ec33115 100644
--- a/src/libcore/os.rs
+++ b/src/libcore/os.rs
@@ -27,7 +27,6 @@
  */
 
 use cast;
-use either;
 use io;
 use libc;
 use libc::{c_char, c_void, c_int, c_uint, size_t, ssize_t};
@@ -38,7 +37,6 @@ use prelude::*;
 use ptr;
 use str;
 use task;
-use task::TaskBuilder;
 use uint;
 use vec;
 
diff --git a/src/libcore/owned.rs b/src/libcore/owned.rs
index 3b839e5a9e0..486ce44147a 100644
--- a/src/libcore/owned.rs
+++ b/src/libcore/owned.rs
@@ -10,7 +10,7 @@
 
 //! Operations on unique pointer types
 
-use cmp::{Eq, Ord};
+#[cfg(notest)] use cmp::{Eq, Ord};
 
 #[cfg(notest)]
 impl<T:Eq> Eq for ~T {
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index 8d528a11598..a88c779d808 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -17,7 +17,6 @@ Cross-platform file path handling
 use cmp::Eq;
 use libc;
 use option::{None, Option, Some};
-use ptr;
 use str;
 use to_str::ToStr;
 
@@ -830,7 +829,6 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] {
 pub mod windows {
     use libc;
     use option::{None, Option, Some};
-    use to_str::ToStr;
 
     #[inline(always)]
     pub pure fn is_sep(u: u8) -> bool {
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index e4fc9528f23..c16281706d7 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -90,10 +90,8 @@ use kinds::Owned;
 use libc;
 use option;
 use option::{None, Option, Some, unwrap};
-use pipes;
 use unstable::intrinsics;
 use ptr;
-use unstable;
 use task;
 use vec;
 
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index ecbce18e6da..bc2d285ad14 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -11,14 +11,14 @@
 //! Unsafe pointer utility functions
 
 use cast;
-use cmp::{Eq, Ord};
 use libc;
 use libc::{c_void, size_t};
 use unstable::intrinsics::{memmove32,memmove64};
-use ptr;
-use str;
 use sys;
-use vec;
+
+#[cfg(test)] use vec;
+#[cfg(test)] use str;
+#[cfg(notest)] use cmp::{Eq, Ord};
 
 #[nolink]
 #[abi = "cdecl"]
@@ -316,13 +316,13 @@ pub fn test() {
         let mut v0 = ~[32000u16, 32001u16, 32002u16];
         let mut v1 = ~[0u16, 0u16, 0u16];
 
-        ptr::copy_memory(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 1u),
-                    ptr::offset(vec::raw::to_ptr(v0), 1u), 1u);
+        copy_memory(mut_offset(vec::raw::to_mut_ptr(v1), 1u),
+                    offset(vec::raw::to_ptr(v0), 1u), 1u);
         assert (v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16);
-        ptr::copy_memory(vec::raw::to_mut_ptr(v1),
-                    ptr::offset(vec::raw::to_ptr(v0), 2u), 1u);
+        copy_memory(vec::raw::to_mut_ptr(v1),
+                    offset(vec::raw::to_ptr(v0), 2u), 1u);
         assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 0u16);
-        ptr::copy_memory(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 2u),
+        copy_memory(mut_offset(vec::raw::to_mut_ptr(v1), 2u),
                     vec::raw::to_ptr(v0), 1u);
         assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 32000u16);
     }
@@ -361,15 +361,15 @@ pub fn test_buf_len() {
 
 #[test]
 pub fn test_is_null() {
-   let p: *int = ptr::null();
+   let p: *int = null();
    assert p.is_null();
    assert !p.is_not_null();
 
-   let q = ptr::offset(p, 1u);
+   let q = offset(p, 1u);
    assert !q.is_null();
    assert q.is_not_null();
 
-   let mp: *mut int = ptr::mut_null();
+   let mp: *mut int = mut_null();
    assert mp.is_null();
    assert !mp.is_not_null();
 
diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs
index af135339b2e..d0910e7cefb 100644
--- a/src/libcore/repr.rs
+++ b/src/libcore/repr.rs
@@ -15,29 +15,25 @@ More runtime type reflection
 */
 
 use cast::transmute;
-use cast;
 use char;
 use dvec::DVec;
 use intrinsic;
 use intrinsic::{TyDesc, TyVisitor, visit_tydesc};
-use io;
 use io::{Writer, WriterUtil};
 use libc::c_void;
 use managed;
-use managed::raw::BoxHeaderRepr;
 use ptr;
 use reflect;
 use reflect::{MovePtr, MovePtrAdaptor, align};
-use repr;
 use str;
 use sys;
-use sys::TypeDesc;
 use to_str::ToStr;
-use uint;
 use vec::UnboxedVecRepr;
 use vec::raw::{VecRepr, SliceRepr};
 use vec;
 
+#[cfg(test)] use io;
+
 pub use managed::raw::BoxRepr;
 
 /// Helpers
@@ -581,7 +577,7 @@ struct P {a: int, b: float}
 fn test_repr() {
 
     fn exact_test<T>(t: &T, e:&str) {
-        let s : &str = io::with_str_writer(|w| repr::write_repr(w, t));
+        let s : &str = io::with_str_writer(|w| write_repr(w, t));
         if s != e {
             error!("expected '%s', got '%s'",
                    e, s);
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index ddcd1547841..26d91777bd8 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -12,7 +12,6 @@
 
 // NB: transitionary, de-mode-ing.
 
-use cmp;
 use cmp::Eq;
 use either;
 use either::Either;
diff --git a/src/libcore/run.rs b/src/libcore/run.rs
index e8cd9caaef6..80d7b4fffdb 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -11,7 +11,6 @@
 //! Process spawning
 use cast;
 use io;
-use io::ReaderUtil;
 use libc;
 use libc::{pid_t, c_void, c_int};
 use comm::{stream, SharedChan, GenericChan, GenericPort};
@@ -452,7 +451,6 @@ pub fn waitpid(pid: pid_t) -> int {
 #[cfg(test)]
 mod tests {
     use debug;
-    use io::WriterUtil;
     use option::{None, Some};
     use os;
     use run::{readclose, writeclose};
diff --git a/src/libcore/stackwalk.rs b/src/libcore/stackwalk.rs
index 8950a1d0c02..c2b62ad5dee 100644
--- a/src/libcore/stackwalk.rs
+++ b/src/libcore/stackwalk.rs
@@ -11,8 +11,6 @@
 #[doc(hidden)]; // FIXME #3538
 
 use cast::reinterpret_cast;
-use ptr::offset;
-use sys::size_of;
 
 pub type Word = uint;
 
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index f1e23f01e7b..471e1ae5396 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -20,18 +20,17 @@
 use at_vec;
 use cast;
 use char;
-use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
+use cmp::{TotalOrd, Ordering, Less, Equal, Greater};
 use libc;
-use libc::size_t;
-use io::WriterUtil;
 use option::{None, Option, Some};
 use ptr;
 use str;
-use to_str::ToStr;
 use u8;
 use uint;
 use vec;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
+
 /*
 Section: Creating a string
 */
diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs
index ec3ab25a27d..da2f68166ce 100644
--- a/src/libcore/sys.rs
+++ b/src/libcore/sys.rs
@@ -16,10 +16,8 @@ use gc;
 use io;
 use libc;
 use libc::{c_void, c_char, size_t};
-use ptr;
 use repr;
 use str;
-use vec;
 
 pub type FreeGlue = fn(*TypeDesc, *c_void);
 
diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs
index 185d8caae01..d9fdd51fdce 100644
--- a/src/libcore/task/local_data.rs
+++ b/src/libcore/task/local_data.rs
@@ -29,7 +29,6 @@ magic.
 use prelude::*;
 use task::local_data_priv::{local_get, local_pop, local_modify, local_set};
 use task::rt;
-use task;
 
 /**
  * Indexes a task-local data slot. The function's code pointer is used for
diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs
index 0835d4400ed..ff3c8386f0b 100644
--- a/src/libcore/task/mod.rs
+++ b/src/libcore/task/mod.rs
@@ -33,22 +33,14 @@
  * ~~~
  */
 
-use cast;
 use cell::Cell;
-use cmp;
 use cmp::Eq;
-use iter;
-use libc;
 use option;
 use result::Result;
 use comm::{stream, Chan, GenericChan, GenericPort, Port, SharedChan};
-use pipes;
 use prelude::*;
-use ptr;
 use result;
-use task::local_data_priv::{local_get, local_set};
 use task::rt::{task_id, sched_id, rust_task};
-use task;
 use util;
 use util::replace;
 
diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs
index 152e602eeee..74384ee3d93 100644
--- a/src/libcore/task/spawn.rs
+++ b/src/libcore/task/spawn.rs
@@ -77,14 +77,12 @@ use cell::Cell;
 use container::Map;
 use option;
 use comm::{Chan, GenericChan, GenericPort, Port, stream};
-use pipes;
 use prelude::*;
 use unstable;
 use ptr;
 use hashmap::linear::LinearSet;
 use task::local_data_priv::{local_get, local_set};
 use task::rt::rust_task;
-use task::rt::rust_closure;
 use task::rt;
 use task::{Failure, ManualThreads, PlatformThread, SchedOpts, SingleThreaded};
 use task::{Success, TaskOpts, TaskResult, ThreadPerCore, ThreadPerTask};
diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs
index 916c188a9c3..dec6cbeb201 100644
--- a/src/libcore/to_str.rs
+++ b/src/libcore/to_str.rs
@@ -14,9 +14,7 @@ The `ToStr` trait for converting to strings
 
 */
 
-use kinds::Copy;
 use str;
-use vec;
 
 pub trait ToStr {
     pure fn to_str(&self) -> ~str;
diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs
index dde7d718c13..ae53081c2db 100644
--- a/src/libcore/tuple.rs
+++ b/src/libcore/tuple.rs
@@ -10,10 +10,11 @@
 
 //! Operations on tuples
 
-use cmp::{Eq, Ord};
 use kinds::Copy;
 use vec;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
+
 pub trait CopyableTuple<T, U> {
     pure fn first() -> T;
     pure fn second() -> U;
diff --git a/src/libcore/unstable.rs b/src/libcore/unstable.rs
index 8c0c029a90f..dcec424f290 100644
--- a/src/libcore/unstable.rs
+++ b/src/libcore/unstable.rs
@@ -11,16 +11,12 @@
 #[doc(hidden)];
 
 use cast;
-use iter;
 use libc;
 use option;
 use comm::{GenericChan, GenericPort};
 use prelude::*;
-use ptr;
-use result;
 use task;
 use task::{TaskBuilder, atomically};
-use uint;
 
 #[path = "unstable/at_exit.rs"]
 pub mod at_exit;
@@ -310,13 +306,8 @@ pub impl<T:Owned> Exclusive<T> {
 
 #[cfg(test)]
 pub mod tests {
-    use core::option::{None, Some};
-
-    use cell::Cell;
     use comm;
-    use option;
     use super::exclusive;
-    use result;
     use task;
     use uint;
 
diff --git a/src/libcore/unstable/at_exit.rs b/src/libcore/unstable/at_exit.rs
index 4785cb622cb..63e7613714d 100644
--- a/src/libcore/unstable/at_exit.rs
+++ b/src/libcore/unstable/at_exit.rs
@@ -10,13 +10,13 @@
 
 use sys;
 use cast;
-use ptr;
 use task;
-use uint;
 use vec;
 use rand;
 use libc::{c_void, size_t};
 
+#[cfg(test)] use uint;
+
 /**
 Register a function to be run during runtime shutdown.
 
diff --git a/src/libcore/unstable/extfmt.rs b/src/libcore/unstable/extfmt.rs
index 616d37a133a..9b2a205b673 100644
--- a/src/libcore/unstable/extfmt.rs
+++ b/src/libcore/unstable/extfmt.rs
@@ -77,9 +77,7 @@ debug!("hello, %s!", "world");
 */
 
 use cmp::Eq;
-use option::{Some, None};
 use prelude::*;
-use str;
 
 /*
  * We have a 'ct' (compile-time) module that parses format strings into a
@@ -98,7 +96,6 @@ pub mod ct {
     use char;
     use prelude::*;
     use str;
-    use vec;
 
     #[deriving_eq]
     pub enum Signedness { Signed, Unsigned, }
diff --git a/src/libcore/unstable/finally.rs b/src/libcore/unstable/finally.rs
index c995d914a7a..9a8b9bdde02 100644
--- a/src/libcore/unstable/finally.rs
+++ b/src/libcore/unstable/finally.rs
@@ -24,7 +24,8 @@ do || {
 */
 
 use ops::Drop;
-use task::{spawn, failing};
+
+#[cfg(test)] use task::failing;
 
 pub trait Finally<T> {
     fn finally(&self, dtor: &fn()) -> T;
diff --git a/src/libcore/unstable/global.rs b/src/libcore/unstable/global.rs
index aa28310f7ba..a0c2955673d 100644
--- a/src/libcore/unstable/global.rs
+++ b/src/libcore/unstable/global.rs
@@ -31,16 +31,16 @@ use kinds::Owned;
 use libc::{c_void, uintptr_t};
 use option::{Option, Some, None};
 use ops::Drop;
-use pipes;
 use unstable::{Exclusive, exclusive};
-use unstable::{SharedMutableState, shared_mutable_state};
-use unstable::{get_shared_immutable_state};
 use unstable::at_exit::at_exit;
 use unstable::intrinsics::atomic_cxchg;
 use hashmap::linear::LinearMap;
 use sys::Closure;
-use task::spawn;
-use uint;
+
+#[cfg(test)] use unstable::{SharedMutableState, shared_mutable_state};
+#[cfg(test)] use unstable::get_shared_immutable_state;
+#[cfg(test)] use task::spawn;
+#[cfg(test)] use uint;
 
 pub type GlobalDataKey<T> = &fn(v: T);
 
diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs
index e74052995e6..48462eabc38 100644
--- a/src/libcore/unstable/lang.rs
+++ b/src/libcore/unstable/lang.rs
@@ -18,7 +18,8 @@ use sys;
 use unstable::exchange_alloc;
 use cast::transmute;
 
-use gc::{cleanup_stack_for_failure, gc, Word};
+#[allow(non_camel_case_types)]
+pub type rust_task = c_void;
 
 #[cfg(target_word_size = "32")]
 pub const FROZEN_BIT: uint = 0x80000000;
diff --git a/src/libcore/unstable/weak_task.rs b/src/libcore/unstable/weak_task.rs
index bff5e9750ec..7f420123465 100644
--- a/src/libcore/unstable/weak_task.rs
+++ b/src/libcore/unstable/weak_task.rs
@@ -22,7 +22,6 @@ use cell::Cell;
 use comm::{GenericSmartChan, stream};
 use comm::{Port, Chan, SharedChan, GenericChan, GenericPort};
 use hashmap::linear::LinearMap;
-use ops::Drop;
 use option::{Some, None, swap_unwrap};
 use unstable::at_exit::at_exit;
 use unstable::finally::Finally;
diff --git a/src/libcore/util.rs b/src/libcore/util.rs
index 522cb2d2783..742eee7dc27 100644
--- a/src/libcore/util.rs
+++ b/src/libcore/util.rs
@@ -14,7 +14,6 @@ Miscellaneous helpers for common patterns.
 
 */
 
-use cmp::Eq;
 use prelude::*;
 
 /// The identity function.
@@ -102,6 +101,7 @@ pub fn unreachable() -> ! {
     fail!(~"internal error: entered unreachable code");
 }
 
+#[cfg(test)]
 mod tests {
     use option::{None, Some};
     use util::{NonCopyable, id, replace, swap};
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 925d78a3b81..f7676bd211e 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -13,7 +13,6 @@
 #[warn(non_camel_case_types)];
 
 use container::{Container, Mutable};
-use cast::transmute;
 use cast;
 use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
 use iter::BaseIter;
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 446b83af425..30ef73bf670 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -15,17 +15,14 @@ use driver::session::Session;
 use driver::session;
 use lib::llvm::llvm;
 use lib::llvm::{ModuleRef, mk_pass_manager, mk_target_data, True, False};
-use lib::llvm::{PassManagerRef, FileType};
 use lib;
 use metadata::common::LinkMeta;
-use metadata::filesearch;
 use metadata::{encoder, cstore};
 use middle::trans::common::CrateContext;
 use middle::ty;
 use util::ppaux;
 
 use core::char;
-use core::cmp;
 use core::hash;
 use core::io::{Writer, WriterUtil};
 use core::libc::{c_int, c_uint, c_char};
@@ -35,8 +32,6 @@ use core::ptr;
 use core::run;
 use core::str;
 use core::vec;
-use std::oldmap::HashMap;
-use std::sha1::sha1;
 use syntax::ast;
 use syntax::ast_map::{path, path_mod, path_name};
 use syntax::attr;
@@ -175,11 +170,9 @@ pub mod write {
     use lib::llvm::{False, True, ModuleRef, mk_pass_manager, mk_target_data};
     use lib;
 
-    use core::char;
     use core::libc::{c_char, c_int, c_uint};
     use core::path::Path;
     use core::str;
-    use core::vec;
 
     pub fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
         if ot == output_type_assembly || ot == output_type_object ||
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index 1bcd67bd67b..ce51bb9229e 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -198,16 +198,19 @@ pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
 
 #[cfg(unix)]
 mod test {
+    // FIXME(#2119): the outer attribute should be #[cfg(unix, test)], then
+    // these redundant #[cfg(test)] blocks can be removed
+    #[cfg(test)]
     use core::prelude::*;
-
+    #[cfg(test)]
     use back::rpath::{get_absolute_rpath, get_install_prefix_rpath};
+    #[cfg(test)]
     use back::rpath::{get_relative_to, get_rpath_relative_to_output};
+    #[cfg(test)]
     use back::rpath::{minimize_rpaths, rpaths_to_flags};
+    #[cfg(test)]
     use driver::session;
 
-    use core::os;
-    use core::str;
-
     #[test]
     pub fn test_rpaths_to_flags() {
         let flags = rpaths_to_flags(~[Path("path1"),
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index b24cdf9c602..43d34beea48 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -23,23 +23,17 @@ use middle::{trans, freevars, kind, ty, typeck, lint, astencode};
 use middle;
 use util::ppaux;
 
-use core::cmp;
 use core::int;
 use core::io::WriterUtil;
 use core::io;
-use core::option;
 use core::os;
-use core::result::{Ok, Err};
 use core::str;
 use core::vec;
 use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
-use std::getopts::groups;
 use std::getopts::{opt_present};
 use std::getopts;
-use std::oldmap::HashMap;
 use std;
 use syntax::ast;
-use syntax::ast_map;
 use syntax::attr;
 use syntax::codemap;
 use syntax::diagnostic;
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs
index 52ca0a886c9..e03e6bc19b3 100644
--- a/src/librustc/driver/session.rs
+++ b/src/librustc/driver/session.rs
@@ -19,8 +19,6 @@ use metadata::filesearch;
 use metadata;
 use middle::lint;
 
-use core::cmp;
-use core::option;
 use syntax::ast::node_id;
 use syntax::ast::{int_ty, uint_ty, float_ty};
 use syntax::codemap::span;
@@ -346,13 +344,10 @@ pub fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
 
 #[cfg(test)]
 pub mod test {
-    use core::prelude::*;
-
     use driver::session::{bin_crate, building_library, lib_crate};
     use driver::session::{unknown_crate};
 
     use syntax::ast;
-    use syntax::ast_util;
     use syntax::codemap;
 
     pub fn make_crate_type_attr(+t: ~str) -> ast::attribute {
diff --git a/src/librustc/front/core_inject.rs b/src/librustc/front/core_inject.rs
index b7df9979592..b53303c5983 100644
--- a/src/librustc/front/core_inject.rs
+++ b/src/librustc/front/core_inject.rs
@@ -14,7 +14,6 @@ use driver::session::Session;
 
 use core::vec;
 use syntax::ast;
-use syntax::ast_util::*;
 use syntax::attr;
 use syntax::codemap;
 use syntax::codemap::dummy_sp;
diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs
index 524e46db738..294e0a4a4b5 100644
--- a/src/librustc/front/test.rs
+++ b/src/librustc/front/test.rs
@@ -12,15 +12,11 @@
 
 use core::prelude::*;
 
-use driver::session::Session;
 use driver::session;
 use front::config;
 
-use core::dvec::DVec;
-use core::option;
 use core::vec;
 use syntax::ast_util::*;
-use syntax::attr::attrs_contains_name;
 use syntax::attr;
 use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan};
 use syntax::codemap;
diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs
index 78528fa053a..3af3c77f9ff 100644
--- a/src/librustc/lib/llvm.rs
+++ b/src/librustc/lib/llvm.rs
@@ -10,15 +10,10 @@
 
 use core::prelude::*;
 
-use core::cast;
-use core::cmp;
-use core::int;
-use core::io;
 use core::libc::{c_char, c_int, c_uint, c_longlong, c_ulonglong};
 use core::option;
 use core::ptr;
 use core::str;
-use core::uint;
 use core::vec;
 use std::oldmap::HashMap;
 
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs
index 307a58135e1..c7c81d0b1c0 100644
--- a/src/librustc/metadata/creader.rs
+++ b/src/librustc/metadata/creader.rs
@@ -14,19 +14,16 @@
 use core::prelude::*;
 
 use metadata::cstore;
-use metadata::common::*;
 use metadata::decoder;
 use metadata::filesearch::FileSearch;
 use metadata::loader;
 
 use core::either;
-use core::option;
 use core::vec;
 use syntax::attr;
 use syntax::codemap::{span, dummy_sp};
 use syntax::diagnostic::span_handler;
 use syntax::parse::token::ident_interner;
-use syntax::print::pprust;
 use syntax::visit;
 use syntax::{ast, ast_util};
 use std::oldmap::HashMap;
diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs
index ae4a223c1ae..8ccf2e6d003 100644
--- a/src/librustc/metadata/csearch.rs
+++ b/src/librustc/metadata/csearch.rs
@@ -22,14 +22,9 @@ use middle::{ty, resolve};
 use core::dvec::DVec;
 use core::vec;
 use reader = std::ebml::reader;
-use std::ebml;
-use std::oldmap::HashMap;
 use syntax::ast;
 use syntax::ast_map;
-use syntax::codemap::dummy_sp;
-use syntax::ast_util;
 use syntax::diagnostic::expect;
-use syntax::diagnostic::span_handler;
 
 pub struct ProvidedTraitMethodInfo {
     ty: ty::method,
diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs
index 667a9c20058..3ef63b70aea 100644
--- a/src/librustc/metadata/cstore.rs
+++ b/src/librustc/metadata/cstore.rs
@@ -14,14 +14,10 @@
 
 use core::prelude::*;
 
-use metadata::creader;
 use metadata::cstore;
 use metadata::decoder;
 
-use core::option;
-use core::str;
 use core::vec;
-use std::oldmap::HashMap;
 use std::oldmap;
 use std;
 use syntax::{ast, attr};
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index f660c796fa3..aa18c1eb450 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -20,13 +20,10 @@ use metadata::csearch;
 use metadata::cstore;
 use metadata::decoder;
 use metadata::tydecode::{parse_ty_data, parse_def_id, parse_bounds_data};
-use metadata::tydecode::{parse_ident};
 use middle::{ty, resolve};
-use util::ppaux::ty_to_str;
 
-use core::cmp;
-use core::dvec::DVec;
 use core::dvec;
+use core::dvec::DVec;
 use core::hash::{Hash, HashUtil};
 use core::int;
 use core::io::WriterUtil;
@@ -36,8 +33,6 @@ use core::str;
 use core::vec;
 use std::ebml::reader;
 use std::ebml;
-use std::oldmap::HashMap;
-use std::oldmap;
 use std::serialize::Decodable;
 use syntax::ast_map;
 use syntax::attr;
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 403cc1cf978..e22f7a4a8e2 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -14,11 +14,9 @@
 use core::prelude::*;
 
 use metadata::common::*;
-use metadata::csearch;
 use metadata::cstore;
 use metadata::decoder;
 use metadata::tyencode;
-use middle::resolve;
 use middle::ty::node_id_to_type;
 use middle::ty;
 use middle;
@@ -26,12 +24,10 @@ use util::ppaux::ty_to_str;
 
 use core::dvec;
 use core::flate;
-use core::float;
 use core::hash::{Hash, HashUtil};
 use core::int;
 use core::io::WriterUtil;
 use core::io;
-use core::str::to_bytes;
 use core::str;
 use core::to_bytes::IterBytes;
 use core::uint;
@@ -47,7 +43,6 @@ use syntax::ast_util::*;
 use syntax::attr;
 use syntax::diagnostic::span_handler;
 use syntax::parse::token::special_idents;
-use syntax::print::pprust;
 use syntax::{ast_util, visit};
 use syntax::opt_vec::OptVec;
 use syntax::opt_vec;
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index 233c0949fa6..5cd4c17b4ee 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -18,14 +18,12 @@ use core::prelude::*;
 
 use middle::ty;
 
-use core::io;
 use core::str;
 use core::uint;
 use core::vec;
 use syntax::ast;
 use syntax::ast::*;
 use syntax::codemap::{respan, dummy_sp};
-use std::oldmap::HashMap;
 
 // Compact string representation for ty::t values. API ty_str &
 // parse_from_str. Extra parameters are for converting to/from def_ids in the
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index b52a2d0bb09..ccdd73053e0 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -21,18 +21,13 @@ use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter};
 use metadata::tyencode;
 use middle::freevars::freevar_entry;
 use middle::typeck::{method_origin, method_map_entry, vtable_res};
-use middle::typeck::{vtable_origin};
 use middle::{ty, typeck, moves};
 use middle;
 use util::ppaux::ty_to_str;
 
 use core::{dvec, io, option, vec};
-use std::ebml::reader::get_doc;
 use std::ebml::reader;
-use std::ebml::writer::Encoder;
 use std::ebml;
-use std::oldmap::HashMap;
-use std::prettyprint;
 use std::serialize;
 use std::serialize::{Encodable, EncoderHelpers, DecoderHelpers};
 use std::serialize::Decodable;
@@ -41,15 +36,14 @@ use syntax::ast_map;
 use syntax::ast_util;
 use syntax::codemap::span;
 use syntax::codemap;
-use syntax::diagnostic;
 use syntax::fold::*;
 use syntax::fold;
-use syntax::parse;
-use syntax::print::pprust;
-use syntax::visit;
 use syntax;
 use writer = std::ebml::writer;
 
+#[cfg(test)] use syntax::parse;
+#[cfg(test)] use syntax::print::pprust;
+
 // Auxiliary maps of things to be encoded
 pub struct Maps {
     mutbl_map: middle::borrowck::mutbl_map,
@@ -1235,6 +1229,8 @@ fn mk_ctxt() -> fake_ext_ctxt {
 
 #[cfg(test)]
 fn roundtrip(in_item: Option<@ast::item>) {
+    use std::prettyprint;
+
     let in_item = in_item.get();
     let bytes = do io::with_bytes_writer |wr| {
         let ebml_w = writer::Encoder(wr);
diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs
index d6af2f78626..89700427d96 100644
--- a/src/librustc/middle/borrowck/check_loans.rs
+++ b/src/librustc/middle/borrowck/check_loans.rs
@@ -31,10 +31,7 @@ use middle::mem_categorization::{lp_comp, lp_deref, lp_local};
 use middle::ty;
 use util::ppaux::ty_to_str;
 
-use core::cmp;
-use core::dvec::DVec;
 use core::uint;
-use core::vec;
 use std::oldmap::HashMap;
 use syntax::ast::{m_const, m_imm, m_mutbl};
 use syntax::ast;
diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs
index 457701e659a..1404c4db464 100644
--- a/src/librustc/middle/borrowck/gather_loans.rs
+++ b/src/librustc/middle/borrowck/gather_loans.rs
@@ -26,7 +26,6 @@ use middle::borrowck::ReqMaps;
 use middle::borrowck::loan;
 use middle::mem_categorization::{cat_binding, cat_discr, cmt, comp_variant};
 use middle::mem_categorization::{mem_categorization_ctxt};
-use middle::mem_categorization::{opt_deref_kind};
 use middle::pat_util;
 use middle::ty::{ty_region};
 use middle::ty;
diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs
index e0f3aad4bc2..412603016dc 100644
--- a/src/librustc/middle/borrowck/mod.rs
+++ b/src/librustc/middle/borrowck/mod.rs
@@ -226,31 +226,22 @@ Borrowck results in two maps.
 
 use core::prelude::*;
 
-use middle::liveness;
 use middle::mem_categorization::*;
 use middle::region;
 use middle::ty;
 use middle::typeck;
 use middle::moves;
 use util::common::{indenter, stmt_set};
-use util::ppaux::{expr_repr, note_and_explain_region};
-use util::ppaux::{ty_to_str, region_to_str, explain_region};
+use util::ppaux::note_and_explain_region;
 
-use core::cmp;
 use core::dvec::DVec;
 use core::io;
 use core::result::{Result, Ok, Err};
 use core::to_bytes;
-use std::list::{List, Cons, Nil};
-use std::list;
 use std::oldmap::{HashMap, Set};
 use syntax::ast::{mutability, m_mutbl, m_imm, m_const};
 use syntax::ast;
-use syntax::ast_map;
-use syntax::ast_util;
 use syntax::codemap::span;
-use syntax::print::pprust;
-use syntax::visit;
 
 pub mod check_loans;
 pub mod gather_loans;
diff --git a/src/librustc/middle/borrowck/preserve.rs b/src/librustc/middle/borrowck/preserve.rs
index aabcd7a2fe5..c7f2dd9cb51 100644
--- a/src/librustc/middle/borrowck/preserve.rs
+++ b/src/librustc/middle/borrowck/preserve.rs
@@ -27,7 +27,6 @@ use middle::mem_categorization::{region_ptr};
 use middle::ty;
 use util::common::indenter;
 
-use syntax::ast::{m_const, m_imm, m_mutbl};
 use syntax::ast;
 
 pub enum PreserveCondition {
diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs
index c86f7ea5a92..c5676dcfe18 100644
--- a/src/librustc/middle/check_const.rs
+++ b/src/librustc/middle/check_const.rs
@@ -17,7 +17,6 @@ use middle::typeck;
 use util::ppaux;
 
 use core::option;
-use std::oldmap::HashMap;
 use syntax::ast::*;
 use syntax::codemap;
 use syntax::{visit, ast_util, ast_map};
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index f736c403cfc..2f1dcd86569 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -19,16 +19,13 @@ use middle::typeck::method_map;
 use middle::moves;
 use util::ppaux::ty_to_str;
 
-use core::cmp;
 use core::option;
 use core::uint;
 use core::vec;
-use std::oldmap::HashMap;
 use std::sort;
 use syntax::ast::*;
 use syntax::ast_util::{variant_def_ids, unguarded_pat, walk_pat};
 use syntax::codemap::{span, dummy_sp, spanned};
-use syntax::print::pprust::pat_to_str;
 use syntax::visit;
 
 pub struct MatchCheckCtxt {
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index ae83e996aba..e54cf60495a 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -14,7 +14,6 @@ use middle::resolve;
 use middle::ty;
 use middle;
 
-use core::cmp;
 use core::float;
 use core::vec;
 use syntax::{ast, ast_map, ast_util, visit};
diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs
index 52520b59b44..d6f0da6d7a3 100644
--- a/src/librustc/middle/freevars.rs
+++ b/src/librustc/middle/freevars.rs
@@ -20,7 +20,6 @@ use core::option::*;
 use core::vec;
 use std::oldmap::*;
 use syntax::codemap::span;
-use syntax::print::pprust::path_to_str;
 use syntax::{ast, ast_util, visit};
 
 // A vector of defs representing the free variables referred to in a function.
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index aca5675aa15..2d5b73d1ec7 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -12,12 +12,10 @@ use core::prelude::*;
 
 use middle::freevars::freevar_entry;
 use middle::freevars;
-use middle::lint::{non_implicitly_copyable_typarams, implicit_copies};
 use middle::liveness;
 use middle::pat_util;
 use middle::ty;
 use middle::typeck;
-use middle;
 use util::ppaux::{ty_to_str, tys_to_str};
 
 use core::option;
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index c0ce6ee515f..0f3051f6044 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -25,7 +25,6 @@ use core::prelude::*;
 use driver::session::Session;
 use metadata::csearch::{each_lang_item, get_item_attrs};
 use metadata::cstore::{iter_crate_data};
-use metadata::decoder::{dl_def, dl_field, dl_impl};
 use syntax::ast::{crate, def_fn, def_id, def_ty, lit_str, meta_item};
 use syntax::ast::{meta_list, meta_name_value, meta_word};
 use syntax::ast_util::{local_def};
@@ -34,7 +33,6 @@ use syntax::visit::{visit_crate, visit_item};
 
 use core::ptr;
 use std::oldmap::HashMap;
-use str_eq = core::str::eq;
 
 pub enum LangItem {
     ConstTraitLangItem,         // 0
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index 8bcc573ac36..7f01ed02384 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -12,7 +12,6 @@ use core::prelude::*;
 
 use driver::session::Session;
 use driver::session;
-use middle::pat_util::{pat_bindings};
 use middle::ty;
 use util::ppaux::{ty_to_str};
 
@@ -24,7 +23,6 @@ use core::i16;
 use core::i32;
 use core::i64;
 use core::int;
-use core::io::WriterUtil;
 use core::str;
 use core::u8;
 use core::u16;
@@ -35,7 +33,6 @@ use core::vec;
 use std::oldmap::{Map, HashMap};
 use std::oldmap;
 use std::smallintmap::SmallIntMap;
-use syntax::ast_util::{path_to_ident};
 use syntax::attr;
 use syntax::codemap::span;
 use syntax::codemap;
@@ -132,7 +129,7 @@ pub fn get_lint_dict() -> LintDict {
          @LintSpec {
             lint: unused_imports,
             desc: "imports that are never used",
-            default: allow
+            default: warn
          }),
 
         (@~"while_true",
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index bcbb2d6fd17..2fd74e006a7 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -54,8 +54,6 @@ use middle::typeck;
 use util::ppaux::{ty_to_str, region_to_str};
 use util::common::indenter;
 
-use core::cmp;
-use core::to_bytes;
 use core::uint;
 use syntax::ast::{m_imm, m_const, m_mutbl};
 use syntax::ast;
diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs
index 823af16c605..df9b9aa1374 100644
--- a/src/librustc/middle/pat_util.rs
+++ b/src/librustc/middle/pat_util.rs
@@ -11,12 +11,9 @@
 use core::prelude::*;
 
 use middle::resolve;
-use middle::ty;
 
 use syntax::ast::*;
 use syntax::ast_util::{path_to_ident, walk_pat};
-use syntax::fold;
-use syntax::fold::*;
 use syntax::codemap::{span, respan};
 use std::oldmap::HashMap;
 
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index 95764050898..f8dcf6e2a9f 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -25,13 +25,9 @@ use middle::resolve;
 use middle::ty::{region_variance, rv_covariant, rv_invariant};
 use middle::ty::{rv_contravariant};
 use middle::ty;
-use util::common::stmt_set;
 
-use core::cmp;
 use core::dvec::DVec;
 use core::vec;
-use std::list;
-use std::list::list;
 use std::oldmap::HashMap;
 use syntax::ast_map;
 use syntax::codemap::span;
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 5298f6c632d..ca15418a83f 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -22,7 +22,6 @@ use middle::lint::{deny, allow, forbid, level, unused_imports, warn};
 use middle::lint::{get_lint_level, get_lint_settings_level};
 use middle::pat_util::{pat_bindings};
 
-use core::cmp;
 use core::str;
 use core::vec;
 use syntax::ast::{RegionTyParamBound, TraitTyParamBound, _mod, add, arm};
@@ -74,17 +73,12 @@ use syntax::visit::{default_visitor, fk_method, mk_vt, Visitor, visit_block};
 use syntax::visit::{visit_crate, visit_expr, visit_expr_opt, visit_fn};
 use syntax::visit::{visit_foreign_item, visit_item, visit_method_helper};
 use syntax::visit::{visit_mod, visit_ty, vt};
-use syntax::opt_vec;
 use syntax::opt_vec::OptVec;
 
 use core::dvec::DVec;
-use core::managed::ptr_eq;
 use core::option::{Some, get, is_some, is_none};
 use core::str::{connect, split_str};
-use core::vec::pop;
-use std::list::{Cons, List, Nil};
 use std::oldmap::HashMap;
-use str_eq = core::str::eq;
 
 // Definition mapping
 pub type DefMap = HashMap<node_id,def>;
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 7998d4ebcac..79e90d93ac8 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -26,10 +26,6 @@
 use core::prelude::*;
 
 use back::link::{mangle_exported_name};
-use back::link::{mangle_internal_name_by_path_and_seq};
-use back::link::{mangle_internal_name_by_path};
-use back::link::{mangle_internal_name_by_seq};
-use back::link::{mangle_internal_name_by_type_only};
 use back::{link, abi, upcall};
 use driver::session;
 use driver::session::Session;
@@ -41,7 +37,6 @@ use metadata::common::LinkMeta;
 use metadata::{csearch, cstore, decoder, encoder};
 use middle::astencode;
 use middle::borrowck::RootInfo;
-use middle::pat_util::*;
 use middle::resolve;
 use middle::trans::_match;
 use middle::trans::base;
@@ -66,17 +61,14 @@ use middle::trans::tvec;
 use middle::trans::type_of;
 use middle::trans::type_of::*;
 use middle::ty;
-use middle::ty::arg;
 use util::common::indenter;
 use util::ppaux::{ty_to_str, ty_to_short_str};
 use util::ppaux;
 
-use core::either;
 use core::hash;
 use core::int;
 use core::io;
 use core::libc::{c_uint, c_ulonglong};
-use core::option::{is_none, is_some};
 use core::option;
 use core::uint;
 use std::oldmap::HashMap;
@@ -86,11 +78,9 @@ use syntax::ast_map::{path, path_elt_to_str, path_mod, path_name};
 use syntax::ast_util::{def_id_of_def, local_def, path_to_ident};
 use syntax::attr;
 use syntax::codemap::span;
-use syntax::diagnostic::expect;
 use syntax::parse::token::special_idents;
 use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str};
 use syntax::visit;
-use syntax::visit::vt;
 use syntax::{ast, ast_util, codemap, ast_map};
 
 pub struct icx_popper {
diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs
index 8db48e1de60..353109f7dd8 100644
--- a/src/librustc/middle/trans/build.rs
+++ b/src/librustc/middle/trans/build.rs
@@ -14,10 +14,9 @@ use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False};
 use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef};
 use lib;
 use middle::trans::common::*;
-use middle::trans::machine::llsize_of_real;
+use syntax::codemap::span;
 
 use core::prelude::*;
-use core::cast::transmute;
 use core::cast;
 use core::libc::{c_uint, c_int, c_ulonglong};
 use core::libc;
@@ -26,8 +25,6 @@ use core::ptr;
 use core::str;
 use core::vec;
 use std::oldmap::HashMap;
-use syntax::codemap::span;
-use syntax::codemap;
 
 pub fn terminate(cx: block, _: &str) {
     unsafe {
diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs
index 562009dc2ca..54b10e2ad5c 100644
--- a/src/librustc/middle/trans/cabi_x86_64.rs
+++ b/src/librustc/middle/trans/cabi_x86_64.rs
@@ -22,7 +22,6 @@ use core::cmp;
 use core::libc::c_uint;
 use core::option;
 use core::option::Option;
-use core::ptr;
 use core::uint;
 use core::vec;
 
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index 12864f12abd..6d9de7b22ea 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -39,14 +39,12 @@ use middle::trans::inline;
 use middle::trans::meth;
 use middle::trans::monomorphize;
 use middle::trans::type_of;
-use middle::ty::ty_to_str;
 use middle::ty;
 use middle::typeck;
 use util::common::indenter;
 
 use syntax::ast;
 use syntax::ast_map;
-use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str};
 use syntax::visit;
 
 // Represents a (possibly monomorphized) top-level fn item or method
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index fd149aa71e5..6e788bf302a 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -12,7 +12,6 @@ use core::prelude::*;
 
 use back::abi;
 use back::link::{mangle_internal_name_by_path_and_seq};
-use back::link::{mangle_internal_name_by_path};
 use lib::llvm::{llvm, ValueRef, TypeRef};
 use middle::moves;
 use middle::trans::base::*;
@@ -27,14 +26,10 @@ use middle::trans::type_of::*;
 use middle::ty;
 use util::ppaux::ty_to_str;
 
-use core::libc::c_uint;
-use std::oldmap::HashMap;
 use syntax::ast;
 use syntax::ast_map::{path, path_mod, path_name};
 use syntax::ast_util;
-use syntax::codemap::span;
 use syntax::parse::token::special_idents;
-use syntax::print::pprust::expr_to_str;
 
 // ___Good to know (tm)__________________________________________________
 //
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index c7036324456..f3ac1177197 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -24,7 +24,6 @@ use lib::llvm::{True, False, Bool};
 use lib::llvm::{llvm, TargetData, TypeNames, associate_type, name_has_type};
 use lib;
 use metadata::common::LinkMeta;
-use metadata::{csearch};
 use middle::astencode;
 use middle::resolve;
 use middle::trans::base;
@@ -34,7 +33,6 @@ use middle::trans::datum;
 use middle::trans::debuginfo;
 use middle::trans::expr;
 use middle::trans::glue;
-use middle::trans::meth;
 use middle::trans::reachable;
 use middle::trans::shape;
 use middle::trans::type_of;
@@ -45,7 +43,6 @@ use middle::typeck;
 use util::ppaux::{expr_repr, ty_to_str};
 
 use core::cast;
-use core::cmp;
 use core::hash;
 use core::libc::c_uint;
 use core::ptr;
@@ -58,7 +55,6 @@ use syntax::ast::ident;
 use syntax::ast_map::path;
 use syntax::codemap::span;
 use syntax::parse::token::ident_interner;
-use syntax::print::pprust::expr_to_str;
 use syntax::{ast, ast_map};
 
 pub type namegen = @fn(~str) -> ident;
diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs
index 9b282e71b3e..be6f1582e13 100644
--- a/src/librustc/middle/trans/controlflow.rs
+++ b/src/librustc/middle/trans/controlflow.rs
@@ -17,7 +17,6 @@ use middle::trans::base::*;
 use middle::trans::build::*;
 use middle::trans::callee;
 use middle::trans::common::*;
-use middle::trans::datum::*;
 use middle::trans::debuginfo;
 use middle::trans::expr;
 use middle::trans::type_of::*;
diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs
index 94c90aaad6d..59897ff1502 100644
--- a/src/librustc/middle/trans/datum.rs
+++ b/src/librustc/middle/trans/datum.rs
@@ -100,15 +100,12 @@ use middle::trans::glue;
 use middle::trans::tvec;
 use middle::trans::type_of;
 use middle::ty;
-use middle::typeck;
 use util::common::indenter;
 use util::ppaux::ty_to_str;
 
 use core::cmp;
-use core::option;
 use core::to_bytes;
 use core::uint;
-use core::vec;
 use syntax::ast;
 use syntax::parse::token::special_idents;
 
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index d6c691f6667..da8e27ba4ff 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -13,9 +13,6 @@ use core::prelude::*;
 use driver::session;
 use lib::llvm::ValueRef;
 use lib::llvm::llvm;
-use middle::pat_util::*;
-use middle::trans::base;
-use middle::trans::build::B;
 use middle::trans::common::*;
 use middle::trans::machine;
 use middle::trans::type_of;
@@ -28,7 +25,6 @@ use core::option;
 use core::sys;
 use std::oldmap::HashMap;
 use std::oldmap;
-use syntax::ast::Ty;
 use syntax::codemap::{span, CharPos};
 use syntax::parse::token::ident_interner;
 use syntax::{ast, codemap, ast_util, ast_map};
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 74cebaee2da..d41bf357193 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -125,7 +125,6 @@ use back::abi;
 use lib;
 use lib::llvm::{ValueRef, TypeRef, llvm, True};
 use middle::borrowck::root_map_key;
-use middle::resolve;
 use middle::trans::_match;
 use middle::trans::base;
 use middle::trans::base::*;
@@ -153,7 +152,6 @@ use std::oldmap::HashMap;
 use syntax::print::pprust::{expr_to_str};
 use syntax::ast;
 use syntax::codemap;
-use syntax::codemap::spanned;
 
 // Destinations
 
diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs
index 12271f51b35..54ef40df684 100644
--- a/src/librustc/middle/trans/foreign.rs
+++ b/src/librustc/middle/trans/foreign.rs
@@ -16,8 +16,6 @@ use driver::session::arch_x86_64;
 use driver::session::arch_arm;
 use driver::session::arch_mips;
 use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg};
-use lib::llvm::{Struct, Array, ModuleRef, CallConv, Attribute};
-use lib::llvm::{StructRetAttribute, ByValAttribute};
 use lib::llvm::{llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double};
 use lib;
 use middle::trans::base::*;
@@ -33,14 +31,12 @@ use middle::trans::expr::{Dest, Ignore};
 use middle::trans::machine::llsize_of;
 use middle::trans::glue;
 use middle::trans::machine;
-use middle::trans::shape;
 use middle::trans::type_of::*;
 use middle::trans::type_of;
 use middle::ty;
 use middle::ty::{FnSig, arg};
 use util::ppaux::ty_to_str;
 
-use core::libc::c_uint;
 use syntax::codemap::span;
 use syntax::{ast, ast_util};
 use syntax::{attr, ast_map};
diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs
index 7ce36c2b1e2..afbb5f09da3 100644
--- a/src/librustc/middle/trans/inline.rs
+++ b/src/librustc/middle/trans/inline.rs
@@ -16,9 +16,6 @@ use middle::trans::base::{get_insn_ctxt};
 use middle::trans::base::{impl_owned_self, impl_self, no_self};
 use middle::trans::base::{trans_item, get_item_val, self_arg, trans_fn};
 use middle::trans::common::*;
-use middle::trans::common;
-use middle::trans::inline;
-use middle::trans::monomorphize;
 use middle::ty;
 use util::ppaux::ty_to_str;
 
diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs
index d2bf034165d..917960f7a27 100644
--- a/src/librustc/middle/trans/meth.rs
+++ b/src/librustc/middle/trans/meth.rs
@@ -12,7 +12,6 @@ use core::prelude::*;
 
 use back::{link, abi};
 use driver;
-use lib::llvm::llvm::LLVMGetParam;
 use lib::llvm::llvm;
 use lib::llvm::{ValueRef, TypeRef};
 use lib;
@@ -34,11 +33,8 @@ use middle::typeck;
 use util::common::indenter;
 use util::ppaux::{ty_to_str, tys_to_str};
 
-use core::libc::c_uint;
-use std::oldmap::HashMap;
 use syntax::ast_map::{path, path_mod, path_name, node_id_to_str};
 use syntax::ast_util;
-use syntax::print::pprust::expr_to_str;
 use syntax::{ast, ast_map};
 
 /**
diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs
index 30a42210a13..b4b2f6afd1f 100644
--- a/src/librustc/middle/trans/monomorphize.rs
+++ b/src/librustc/middle/trans/monomorphize.rs
@@ -24,7 +24,6 @@ use middle::trans::datum;
 use middle::trans::foreign;
 use middle::trans::machine;
 use middle::trans::meth;
-use middle::trans::shape;
 use middle::trans::type_of::type_of_fn_from_ty;
 use middle::trans::type_of;
 use middle::trans::type_use;
diff --git a/src/librustc/middle/trans/reachable.rs b/src/librustc/middle/trans/reachable.rs
index 17abebad600..37e56e46f45 100644
--- a/src/librustc/middle/trans/reachable.rs
+++ b/src/librustc/middle/trans/reachable.rs
@@ -16,7 +16,6 @@
 // reachable as well.
 
 
-use driver::session::*;
 use middle::resolve;
 use middle::ty;
 use middle::typeck;
diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs
index dcfa897ab60..ac6cda3096c 100644
--- a/src/librustc/middle/trans/reflect.rs
+++ b/src/librustc/middle/trans/reflect.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 
-use back::abi;
 use lib::llvm::{TypeRef, ValueRef};
 use middle::trans::base::*;
 use middle::trans::build::*;
@@ -27,7 +26,6 @@ use util::ppaux::ty_to_str;
 
 use core::option::None;
 use core::vec;
-use std::oldmap::HashMap;
 use syntax::ast::def_id;
 use syntax::ast;
 
diff --git a/src/librustc/middle/trans/shape.rs b/src/librustc/middle/trans/shape.rs
index 72e4fa2f4eb..9f10d4976a2 100644
--- a/src/librustc/middle/trans/shape.rs
+++ b/src/librustc/middle/trans/shape.rs
@@ -12,28 +12,13 @@
 // This substitutes for the runtime tags used by e.g. MLs.
 
 
-use back::abi;
 use lib::llvm::llvm;
 use lib::llvm::{True, False, ModuleRef, TypeRef, ValueRef};
-use middle::trans::base;
 use middle::trans::common::*;
-use middle::trans::machine::*;
 use middle::trans;
-use middle::ty::field;
-use middle::ty;
-use util::ppaux::ty_to_str;
 
-use core::dvec::DVec;
-use core::option::is_some;
 use core::str;
 use core::vec;
-use std::oldmap::HashMap;
-use syntax::ast;
-use syntax::codemap::dummy_sp;
-use syntax::codemap::span;
-use syntax::util::interner;
-
-use ty_ctxt = middle::ty::ctxt;
 
 pub struct Ctxt {
     next_tag_id: u16,
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index 3542b5acf05..e88d95b0ebb 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -31,8 +31,6 @@ use core::uint;
 use core::vec;
 use syntax::ast;
 use syntax::codemap;
-use syntax::codemap::span;
-use syntax::print::pprust::{expr_to_str};
 
 // Boxed vector types are in some sense currently a "shorthand" for a box
 // containing an unboxed vector. This expands a boxed vector type into such an
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index fdb5e94559f..b8bca3e8346 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -14,14 +14,12 @@ use lib::llvm::{TypeRef};
 use middle::trans::base;
 use middle::trans::common::*;
 use middle::trans::common;
-use middle::trans::expr;
 use middle::trans::machine;
 use middle::ty;
 use util::ppaux;
 
 use core::option::None;
 use core::vec;
-use std::oldmap::HashMap;
 use syntax::ast;
 
 pub fn type_of_explicit_arg(ccx: @CrateContext, arg: ty::arg) -> TypeRef {
diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs
index 7b7a6eee92e..ee8bd81ac83 100644
--- a/src/librustc/middle/trans/type_use.rs
+++ b/src/librustc/middle/trans/type_use.rs
@@ -28,7 +28,6 @@
 // invasive.)
 
 
-use metadata::csearch;
 use middle::freevars;
 use middle::trans::common::*;
 use middle::trans::inline;
@@ -41,7 +40,6 @@ use core::uint;
 use core::vec;
 use std::list::{List, Cons, Nil};
 use std::list;
-use std::oldmap::HashMap;
 use syntax::ast;
 use syntax::ast::*;
 use syntax::ast_map;
diff --git a/src/librustc/middle/trans/uniq.rs b/src/librustc/middle/trans/uniq.rs
index 7db76258404..4ce2b780011 100644
--- a/src/librustc/middle/trans/uniq.rs
+++ b/src/librustc/middle/trans/uniq.rs
@@ -19,8 +19,6 @@ use middle::trans::datum;
 use middle::trans::glue;
 use middle::ty;
 
-use syntax::ast;
-
 pub fn make_free_glue(bcx: block, vptrptr: ValueRef, box_ty: ty::t)
     -> block {
     let _icx = bcx.insn_ctxt("uniq::make_free_glue");
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 0b0715dd9ca..847b5873b27 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -10,7 +10,6 @@
 
 use core::prelude::*;
 
-use driver::session::Session;
 use driver::session;
 use metadata::csearch;
 use metadata;
diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs
index 5c05723bb3f..8a0bea62795 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc/middle/typeck/astconv.rs
@@ -54,12 +54,9 @@
 
 use core::prelude::*;
 
-use middle::pat_util::pat_id_map;
 use middle::ty::{arg, field, substs};
 use middle::ty::{ty_param_substs_and_ty};
 use middle::ty;
-use middle::typeck::collect;
-use middle::typeck::rscope::{anon_rscope, binding_rscope, empty_rscope};
 use middle::typeck::rscope::{in_anon_rscope, in_binding_rscope};
 use middle::typeck::rscope::{region_scope, type_rscope};
 use middle::typeck::{CrateCtxt, write_substs_to_tcx, write_ty_to_tcx};
diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs
index 39b2a2efdd8..f3b25af9782 100644
--- a/src/librustc/middle/typeck/check/_match.rs
+++ b/src/librustc/middle/typeck/check/_match.rs
@@ -11,7 +11,6 @@
 use core::prelude::*;
 
 use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const};
-use middle::pat_util::{pat_is_variant_or_struct};
 use middle::ty;
 use middle::typeck::check::demand;
 use middle::typeck::check::{check_block, check_expr_has_type, FnCtxt};
@@ -22,7 +21,6 @@ use middle::typeck::require_same_types;
 use core::vec;
 use std::oldmap::HashMap;
 use syntax::ast;
-use syntax::ast_util::walk_pat;
 use syntax::ast_util;
 use syntax::codemap::span;
 use syntax::print::pprust;
diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs
index 63d09d88f52..b269e594395 100644
--- a/src/librustc/middle/typeck/check/method.rs
+++ b/src/librustc/middle/typeck/check/method.rs
@@ -81,7 +81,6 @@ obtained the type `Foo`, we would never match this method.
 
 use core::prelude::*;
 
-use middle::resolve::{Impl, MethodInfo};
 use middle::resolve;
 use middle::ty::*;
 use middle::ty;
@@ -90,7 +89,6 @@ use middle::typeck::check::{structurally_resolved_type};
 use middle::typeck::check::vtable::VtableContext;
 use middle::typeck::check::vtable;
 use middle::typeck::check;
-use middle::typeck::coherence::get_base_type_def_id;
 use middle::typeck::infer;
 use middle::typeck::{method_map_entry, method_origin, method_param};
 use middle::typeck::{method_self, method_static, method_trait, method_super};
@@ -107,9 +105,6 @@ use syntax::ast::{sty_uniq, sty_static, node_id, by_copy, by_ref};
 use syntax::ast::{m_const, m_mutbl, m_imm};
 use syntax::ast;
 use syntax::ast_map;
-use syntax::ast_map::node_id_to_str;
-use syntax::codemap::dummy_sp;
-use syntax::codemap::span;
 
 pub fn lookup(
     fcx: @mut FnCtxt,
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index f724a442902..a8985ac512b 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -96,7 +96,6 @@ use middle::typeck::CrateCtxt;
 use middle::typeck::infer::{resolve_type, force_tvar};
 use middle::typeck::infer;
 use middle::typeck::rscope::{anon_rscope, binding_rscope, bound_self_region};
-use middle::typeck::rscope::{empty_rscope, in_anon_rscope};
 use middle::typeck::rscope::{in_binding_rscope, region_scope, type_rscope};
 use middle::typeck::rscope;
 use middle::typeck::{isr_alist, lookup_def_ccx, method_map_entry};
@@ -120,7 +119,6 @@ use syntax::ast::{provided, required, ty_i};
 use syntax::ast;
 use syntax::ast_map;
 use syntax::ast_util::{Private, Public, is_local, local_def};
-use syntax::ast_util::{visibility_to_privacy};
 use syntax::ast_util;
 use syntax::codemap::{span, spanned, respan};
 use syntax::codemap;
@@ -128,7 +126,6 @@ use syntax::parse::token::special_idents;
 use syntax::print::pprust;
 use syntax::visit;
 use syntax::opt_vec::OptVec;
-use syntax::opt_vec;
 use syntax;
 
 pub mod _match;
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index 8a772665072..93ab5c09476 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -33,7 +33,6 @@ use middle::freevars::get_freevars;
 use middle::pat_util::{pat_bindings, pat_is_binding};
 use middle::ty::{encl_region, re_scope};
 use middle::ty::{vstore_box, vstore_fixed, vstore_slice};
-use middle::ty::{vstore_uniq};
 use middle::ty;
 use middle::typeck::check::FnCtxt;
 use middle::typeck::check::lookup_def;
@@ -46,7 +45,6 @@ use syntax::ast::{ManagedSigil, OwnedSigil, BorrowedSigil};
 use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar};
 use syntax::ast;
 use syntax::codemap::span;
-use syntax::print::pprust;
 use syntax::visit;
 
 pub struct Rcx {
diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs
index 841365652ff..a5c64e7c873 100644
--- a/src/librustc/middle/typeck/check/regionmanip.rs
+++ b/src/librustc/middle/typeck/check/regionmanip.rs
@@ -22,7 +22,6 @@ use util::ppaux;
 use std::list::Cons;
 use syntax::ast;
 use syntax::codemap;
-use syntax::print::pprust::{expr_to_str};
 
 // Helper functions related to manipulating region types.
 
diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs
index b2d399ac8da..da2b8036477 100644
--- a/src/librustc/middle/typeck/check/vtable.rs
+++ b/src/librustc/middle/typeck/check/vtable.rs
@@ -10,7 +10,6 @@
 
 use core::prelude::*;
 
-use middle::resolve;
 use middle::ty::{param_ty, substs};
 use middle::ty;
 use middle::typeck::check::{FnCtxt, impl_self_ty};
@@ -33,7 +32,6 @@ use syntax::ast;
 use syntax::ast_util;
 use syntax::codemap::span;
 use syntax::print::pprust::expr_to_str;
-use syntax::print::pprust;
 use syntax::visit;
 
 // vtable resolution looks for places where trait bounds are
diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs
index e5aca315dd1..00f757412f6 100644
--- a/src/librustc/middle/typeck/check/writeback.rs
+++ b/src/librustc/middle/typeck/check/writeback.rs
@@ -28,7 +28,6 @@ use util::ppaux;
 
 use core::result::{Result, Ok, Err};
 use core::vec;
-use std::oldmap::HashMap;
 use syntax::ast;
 use syntax::codemap::span;
 use syntax::print::pprust::pat_to_str;
diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs
index f8fcef7580b..2f0ce944baf 100644
--- a/src/librustc/middle/typeck/coherence.rs
+++ b/src/librustc/middle/typeck/coherence.rs
@@ -47,7 +47,6 @@ use syntax::ast;
 use syntax::ast_map::node_item;
 use syntax::ast_map;
 use syntax::ast_util::{def_id_of_def, local_def};
-use syntax::attr;
 use syntax::codemap::{span, dummy_sp};
 use syntax::parse;
 use syntax::visit::{default_simple_visitor, default_visitor};
@@ -59,10 +58,7 @@ use util::ppaux::ty_to_str;
 use core::dvec::DVec;
 use core::result::Ok;
 use core::hashmap::linear::LinearSet;
-use core::uint::range;
 use core::uint;
-use core::vec::{len, push};
-use core::vec;
 use std::oldmap::HashMap;
 
 pub struct UniversalQuantificationResult {
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs
index 67dca7ea811..39f9a41122a 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc/middle/typeck/collect.rs
@@ -45,7 +45,6 @@ use middle::typeck::rscope;
 use middle::typeck::{CrateCtxt, lookup_def_tcx, no_params, write_ty_to_tcx};
 use util::common::{indenter, pluralize};
 use util::ppaux;
-use util::ppaux::bound_to_str;
 
 use core::dvec;
 use core::option;
@@ -60,7 +59,6 @@ use syntax::codemap::span;
 use syntax::codemap;
 use syntax::print::pprust::path_to_str;
 use syntax::visit;
-use syntax::opt_vec;
 use syntax::opt_vec::OptVec;
 
 pub fn collect_item_types(ccx: @mut CrateCtxt, crate: @ast::crate) {
diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/typeck/infer/coercion.rs
index 9ee0b848176..2390e73f16f 100644
--- a/src/librustc/middle/typeck/infer/coercion.rs
+++ b/src/librustc/middle/typeck/infer/coercion.rs
@@ -78,7 +78,6 @@ use middle::typeck::infer::to_str::InferStr;
 use middle::typeck::infer::resolve::try_resolve_tvar_shallow;
 use util::common::{indent, indenter};
 
-use core::option;
 use syntax::ast::{m_const, m_imm, m_mutbl};
 use syntax::ast;
 
diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs
index 981d7be3d5f..dd9bf9cac64 100644
--- a/src/librustc/middle/typeck/infer/glb.rs
+++ b/src/librustc/middle/typeck/infer/glb.rs
@@ -13,7 +13,6 @@ use core::prelude::*;
 use middle::ty::RegionVid;
 use middle::ty;
 use middle::typeck::infer::combine::*;
-use middle::typeck::infer::glb::Glb;
 use middle::typeck::infer::lattice::*;
 use middle::typeck::infer::lub::Lub;
 use middle::typeck::infer::sub::Sub;
diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs
index aff2d599a0e..b2f011e984f 100644
--- a/src/librustc/middle/typeck/infer/mod.rs
+++ b/src/librustc/middle/typeck/infer/mod.rs
@@ -254,13 +254,10 @@ pub use middle::typeck::infer::resolve::{resolve_nested_tvar};
 pub use middle::typeck::infer::resolve::{resolve_rvar};
 
 use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, Vid};
-use middle::ty::{ty_int, ty_uint, get, terr_fn, TyVar, IntVar, FloatVar};
 use middle::ty;
 use middle::typeck::check::regionmanip::{replace_bound_regions_in_fn_sig};
 use middle::typeck::infer::coercion::Coerce;
 use middle::typeck::infer::combine::{Combine, CombineFields, eq_tys};
-use middle::typeck::infer::glb::Glb;
-use middle::typeck::infer::lub::Lub;
 use middle::typeck::infer::region_inference::{RegionVarBindings};
 use middle::typeck::infer::resolve::{resolver};
 use middle::typeck::infer::sub::Sub;
@@ -271,20 +268,14 @@ use util::common::{indent, indenter};
 use util::ppaux::{bound_region_to_str, ty_to_str, mt_to_str};
 
 use core::cmp::Eq;
-use core::dvec::DVec;
 use core::result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2};
 use core::result;
 use core::vec;
 use std::list::Nil;
-use std::oldmap::HashMap;
 use std::smallintmap::SmallIntMap;
-use syntax::ast::{ret_style, purity};
 use syntax::ast::{m_const, m_imm, m_mutbl};
-use syntax::ast::{unsafe_fn, impure_fn, pure_fn, extern_fn};
 use syntax::ast;
-use syntax::codemap::dummy_sp;
 use syntax::codemap;
-use syntax::ast_util;
 use syntax::codemap::span;
 
 pub mod macros;
diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs
index 1ad89fe6f1e..7226872e12c 100644
--- a/src/librustc/middle/typeck/infer/region_inference.rs
+++ b/src/librustc/middle/typeck/infer/region_inference.rs
@@ -543,9 +543,7 @@ use middle::region;
 use middle::ty;
 use middle::ty::{Region, RegionVid, re_static, re_infer, re_free, re_bound};
 use middle::ty::{re_scope, ReVar, ReSkolemized, br_fresh};
-use middle::typeck::infer::to_str::InferStr;
 use middle::typeck::infer::cres;
-use syntax::codemap;
 use util::common::indenter;
 use util::ppaux::note_and_explain_region;
 
@@ -556,10 +554,8 @@ use core::result::{Err, Ok, Result};
 use core::to_bytes;
 use core::uint;
 use core::vec;
-use std::list::{List, Nil, Cons};
 use std::oldmap::HashMap;
 use syntax::codemap::span;
-use syntax::codemap;
 
 enum Constraint {
     ConstrainVarSubVar(RegionVid, RegionVid),
diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs
index a4e706db60e..83ef61bbf49 100644
--- a/src/librustc/middle/typeck/infer/resolve.rs
+++ b/src/librustc/middle/typeck/infer/resolve.rs
@@ -60,7 +60,6 @@ use util::ppaux::ty_to_str;
 
 use syntax::ast;
 
-use core::uint;
 use core::vec;
 
 pub const resolve_nested_tvar: uint = 0b0000000001;
diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs
index aaaf3b425c2..f209116696e 100644
--- a/src/librustc/middle/typeck/infer/sub.rs
+++ b/src/librustc/middle/typeck/infer/sub.rs
@@ -19,7 +19,6 @@ use middle::typeck::infer::glb::Glb;
 use middle::typeck::infer::InferCtxt;
 use middle::typeck::infer::lub::Lub;
 use middle::typeck::infer::to_str::InferStr;
-use middle::typeck::infer::unify::*;
 use util::common::{indent, indenter};
 use util::ppaux::bound_region_to_str;
 
diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs
index 9b74ac85351..a9ad54aea8b 100644
--- a/src/librustc/middle/typeck/infer/to_str.rs
+++ b/src/librustc/middle/typeck/infer/to_str.rs
@@ -17,7 +17,6 @@ use middle::typeck::infer::{Bound, Bounds};
 use middle::typeck::infer::InferCtxt;
 use middle::typeck::infer::unify::{Redirect, Root, VarValue};
 use util::ppaux::{mt_to_str, ty_to_str};
-use util::ppaux;
 
 use syntax::{ast, ast_util};
 
diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs
index fec3f3d9779..3cf5b4f4ef0 100644
--- a/src/librustc/middle/typeck/infer/unify.rs
+++ b/src/librustc/middle/typeck/infer/unify.rs
@@ -9,17 +9,14 @@
 // except according to those terms.
 
 use core::prelude::*;
-use core::result;
 use std::smallintmap::SmallIntMap;
 
 use middle::ty::{Vid, expected_found, IntVarValue};
 use middle::ty;
 use middle::typeck::infer::{Bound, Bounds, cres, uok, ures};
-use middle::typeck::infer::combine::Combine;
 use middle::typeck::infer::InferCtxt;
 use middle::typeck::infer::to_str::InferStr;
 use syntax::ast;
-use util::common::{indent, indenter};
 
 pub enum VarValue<V, T> {
     Redirect(V),
diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs
index de3df62d62c..b7d60817627 100644
--- a/src/librustc/middle/typeck/mod.rs
+++ b/src/librustc/middle/typeck/mod.rs
@@ -50,31 +50,19 @@ independently:
 
 use core::prelude::*;
 
-use metadata::csearch;
-use middle::pat_util::{pat_id_map, PatIdMap};
 use middle::resolve;
-use middle::ty::{arg, field, node_type_table, mk_nil, ty_param_bounds_and_ty};
 use middle::ty::{ty_param_substs_and_ty, vstore_uniq};
 use middle::ty;
-use util::common::{block_query, indent, indenter, loop_query};
-use util::ppaux::{bound_region_to_str, vstore_to_str, expr_repr};
-use util::ppaux::{ty_to_str, tys_to_str, region_to_str};
 use util::ppaux;
 
-use core::dvec::DVec;
-use core::result::Result;
 use core::result;
 use core::vec;
 use std::list::{List, Nil, Cons};
 use std::list;
 use std::oldmap::HashMap;
 use std::oldmap;
-use syntax::ast::{provided, required};
-use syntax::ast_map::node_id_to_str;
-use syntax::ast_util::{local_def, split_trait_methods};
 use syntax::codemap::{span, spanned, respan};
 use syntax::print::pprust::*;
-use syntax::visit;
 use syntax::{ast, ast_util, ast_map};
 
 #[path = "check/mod.rs"]
diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs
index d82667285ff..7b3fb02e1d8 100644
--- a/src/librustc/middle/typeck/rscope.rs
+++ b/src/librustc/middle/typeck/rscope.rs
@@ -16,7 +16,6 @@ use core::result::Result;
 use core::result;
 use syntax::ast;
 use syntax::codemap::span;
-use syntax::parse::token::special_idents;
 
 pub trait region_scope {
     pure fn anon_region(&self, span: span) -> Result<ty::Region, ~str>;
diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc
index 8dbc0f12a88..b204c458d65 100644
--- a/src/librustc/rustc.rc
+++ b/src/librustc/rustc.rc
@@ -34,19 +34,6 @@ use core::*;
 extern mod std(vers = "0.6");
 extern mod syntax(vers = "0.6");
 
-/*
-Alternate names for some modules.
-
-I am using this to help extract metadata into its own crate. In metadata.rs
-it redefines all these modules in order to gate access from metadata to the
-rest of the compiler, then uses these to access the original implementation.
-*/
-use util_ = util;
-use lib_ = lib;
-use driver_ = driver;
-use middle_ = middle;
-use back_ = back;
-
 pub mod middle {
     pub mod trans {
         pub mod macros;
@@ -148,7 +135,6 @@ use core::io::ReaderUtil;
 use core::result::{Ok, Err};
 use std::getopts::{groups, opt_present};
 use std::getopts;
-use std::oldmap::HashMap;
 use syntax::codemap;
 use syntax::diagnostic;
 
@@ -318,7 +304,6 @@ fails without recording a fatal error then we've encountered a compiler
 bug and need to present an error.
 */
 pub fn monitor(+f: ~fn(diagnostic::Emitter)) {
-    use core::cell::Cell;
     use core::comm::*;
     let (p, ch) = stream();
     let ch = SharedChan(ch);
diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs
index 8729ca5f6e1..d3ffd2deb81 100644
--- a/src/librustc/util/common.rs
+++ b/src/librustc/util/common.rs
@@ -13,12 +13,8 @@ use core::prelude::*;
 use syntax::ast;
 use syntax::codemap::{span};
 use syntax::visit;
-use syntax::print;
-use syntax;
 
-use core::option;
 use core::str;
-use core::vec;
 use std::oldmap::HashMap;
 
 pub fn indent<R>(op: fn() -> R) -> R {
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 995fdba35cb..6020aa52e32 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -12,8 +12,6 @@ use core::prelude::*;
 
 use middle::ty;
 use middle::ty::{arg, canon_mode};
-use middle::ty::{bound_copy, bound_const, bound_durable, bound_owned,
-        bound_trait};
 use middle::ty::{bound_region, br_anon, br_named, br_self, br_cap_avoid,
                  br_fresh};
 use middle::ty::{ctxt, field, method};
@@ -28,7 +26,6 @@ use middle::ty::{ty_ptr, ty_rec, ty_rptr, ty_self, ty_tup};
 use middle::ty::{ty_type, ty_uniq, ty_uint, ty_infer};
 use middle::ty::{ty_unboxed_vec};
 use metadata::encoder;
-use syntax::codemap;
 use syntax::codemap::span;
 use syntax::print::pprust;
 use syntax::print::pprust::{path_to_str, mode_to_str};
@@ -37,7 +34,6 @@ use syntax::ast_map;
 
 use core::str;
 use core::vec;
-use std::oldmap::HashMap;
 
 pub fn note_and_explain_region(cx: ctxt,
                                prefix: ~str,
diff --git a/src/librustdoc/astsrv.rs b/src/librustdoc/astsrv.rs
index 03410ee30fc..9b5f476009b 100644
--- a/src/librustdoc/astsrv.rs
+++ b/src/librustdoc/astsrv.rs
@@ -20,25 +20,15 @@ non-sendableness.
 use core::prelude::*;
 
 use parse;
-use util;
 
 use core::cell::Cell;
 use core::comm::{stream, Chan, SharedChan, Port};
-use core::vec;
-use core::ops::Drop;
-use rustc::back::link;
 use rustc::driver::driver;
 use rustc::driver::session::Session;
 use rustc::driver::session::{basic_options, options};
-use rustc::driver::session;
 use rustc::front;
-use rustc::metadata::filesearch;
-use std::oldmap::HashMap;
 use syntax::ast;
 use syntax::ast_map;
-use syntax::codemap;
-use syntax::diagnostic::handler;
-use syntax::diagnostic;
 use syntax;
 
 pub struct Ctxt {
diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs
index bb9ba93cbe0..1d1a5209cae 100644
--- a/src/librustdoc/attr_parser.rs
+++ b/src/librustdoc/attr_parser.rs
@@ -18,12 +18,8 @@ an AST's attributes.
 use core::prelude::*;
 
 use core::str;
-use core::tuple;
-use core::vec;
 use syntax::ast;
 use syntax::attr;
-use syntax::codemap;
-use syntax;
 
 pub struct CrateAttrs {
     name: Option<~str>
@@ -38,10 +34,8 @@ mod test {
 
     pub fn parse_attributes(source: ~str) -> ~[ast::attribute] {
         use syntax::parse;
-        use syntax::parse::parser;
         use syntax::parse::attr::parser_attr;
         use syntax::codemap;
-        use syntax::diagnostic;
 
         let parse_sess = syntax::parse::new_parse_sess(None);
         let parser = parse::new_parser_from_source_str(
diff --git a/src/librustdoc/attr_pass.rs b/src/librustdoc/attr_pass.rs
index 28322450c4d..16acec41881 100644
--- a/src/librustdoc/attr_pass.rs
+++ b/src/librustdoc/attr_pass.rs
@@ -31,8 +31,6 @@ use core::option;
 use core::vec;
 use syntax::ast;
 use syntax::ast_map;
-use std::oldmap::HashMap;
-use std::par;
 
 pub fn mk_pass() -> Pass {
     Pass {
diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs
index 2d0969562a0..b4d990ccdd2 100644
--- a/src/librustdoc/desc_to_brief_pass.rs
+++ b/src/librustdoc/desc_to_brief_pass.rs
@@ -27,7 +27,6 @@ use pass::Pass;
 use core::str;
 use core::vec;
 use core::util;
-use std::par;
 
 pub fn mk_pass() -> Pass {
     Pass {
diff --git a/src/librustdoc/doc.rs b/src/librustdoc/doc.rs
index f7de1997d53..ae45f549417 100644
--- a/src/librustdoc/doc.rs
+++ b/src/librustdoc/doc.rs
@@ -13,9 +13,7 @@
 use core::prelude::*;
 
 use doc;
-use pass::Pass;
 
-use core::cmp;
 use core::option;
 use core::vec;
 
diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs
index d03af547af0..4ea67c1bff6 100644
--- a/src/librustdoc/fold.rs
+++ b/src/librustdoc/fold.rs
@@ -10,14 +10,11 @@
 
 use core::prelude::*;
 
-use astsrv;
 use doc;
-use extract;
-use parse;
-use pass::Pass;
+#[cfg(test)] use extract;
+#[cfg(test)] use parse;
 
 use core::vec;
-use std::par;
 
 pub struct Fold<T> {
     ctxt: T,
diff --git a/src/librustdoc/markdown_index_pass.rs b/src/librustdoc/markdown_index_pass.rs
index b37f8f8443e..cfec1857df9 100644
--- a/src/librustdoc/markdown_index_pass.rs
+++ b/src/librustdoc/markdown_index_pass.rs
@@ -23,7 +23,6 @@ use markdown_writer;
 use pass::Pass;
 
 use core::str;
-use std::par;
 
 pub fn mk_pass(config: config::Config) -> Pass {
     Pass {
diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs
index f64f365496d..cb92e078fdd 100644
--- a/src/librustdoc/markdown_pass.rs
+++ b/src/librustdoc/markdown_pass.rs
@@ -13,32 +13,22 @@
 use core::prelude::*;
 
 use astsrv;
-use attr_pass;
-use config;
-use desc_to_brief_pass;
 use doc::ItemUtils;
 use doc;
-use extract;
-use fold;
-use markdown_index_pass;
 use markdown_pass;
 use markdown_writer::Writer;
 use markdown_writer::WriterUtils;
 use markdown_writer::WriterFactory;
-use markdown_writer;
-use page_pass;
 use pass::Pass;
-use path_pass;
-use sectionalize_pass;
 use sort_pass;
-use trim_pass;
-use unindent_pass;
+
+#[cfg(test)] use config;
+#[cfg(test)] use markdown_writer;
+#[cfg(test)] use page_pass;
 
 use core::cell::Cell;
-use core::iter;
 use core::str;
 use core::vec;
-use std::par;
 use syntax;
 
 pub fn mk_pass(writer_factory: WriterFactory) -> Pass {
diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs
index 020073f9b89..acd456e77be 100644
--- a/src/librustdoc/markdown_writer.rs
+++ b/src/librustdoc/markdown_writer.rs
@@ -11,12 +11,9 @@
 use core::prelude::*;
 
 use config;
-use config::Config;
 use doc::ItemUtils;
 use doc;
-use pass::Pass;
 
-use core::io::ReaderUtil;
 use core::io;
 use core::libc;
 use core::os;
@@ -27,7 +24,6 @@ use core::str;
 use core::task;
 use core::comm::*;
 use std::future;
-use syntax;
 
 pub enum WriteInstr {
     Write(~str),
@@ -224,7 +220,7 @@ pub fn make_filename(
 
 #[test]
 fn should_use_markdown_file_name_based_off_crate() {
-    let config = Config {
+    let config = config::Config {
         output_dir: Path("output/dir"),
         output_format: config::Markdown,
         output_style: config::DocPerCrate,
@@ -238,7 +234,7 @@ fn should_use_markdown_file_name_based_off_crate() {
 
 #[test]
 fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
-    let config = Config {
+    let config = config::Config {
         output_dir: Path("output/dir"),
         output_format: config::PandocHtml,
         output_style: config::DocPerMod,
@@ -252,7 +248,7 @@ fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
 
 #[test]
 fn should_name_mod_file_names_by_path() {
-    let config = Config {
+    let config = config::Config {
         output_dir: Path("output/dir"),
         output_format: config::PandocHtml,
         output_style: config::DocPerMod,
diff --git a/src/librustdoc/page_pass.rs b/src/librustdoc/page_pass.rs
index 2a2c3888647..46c02e5bfae 100644
--- a/src/librustdoc/page_pass.rs
+++ b/src/librustdoc/page_pass.rs
@@ -24,12 +24,9 @@ use doc;
 use fold::Fold;
 use fold;
 use pass::Pass;
-use sort_pass;
 use util::NominalOp;
-use util;
 
 use core::option;
-use core::vec;
 use core::comm::*;
 use syntax::ast;
 
diff --git a/src/librustdoc/parse.rs b/src/librustdoc/parse.rs
index b8fcc29c32b..9f44e074bd2 100644
--- a/src/librustdoc/parse.rs
+++ b/src/librustdoc/parse.rs
@@ -16,8 +16,6 @@ use rustc::driver::driver::{file_input, str_input};
 use rustc::driver::driver;
 use rustc::driver::session;
 use syntax::ast;
-use syntax::codemap;
-use syntax::diagnostic;
 use syntax::parse;
 
 pub fn from_file(file: &Path) -> @ast::crate {
diff --git a/src/librustdoc/pass.rs b/src/librustdoc/pass.rs
index e78c7d54019..b4d0cfe7c93 100644
--- a/src/librustdoc/pass.rs
+++ b/src/librustdoc/pass.rs
@@ -12,9 +12,10 @@ use core::prelude::*;
 
 use astsrv;
 use doc;
-use extract;
 use time;
 
+#[cfg(test)] use extract;
+
 use core::vec;
 
 /// A single operation on the document model
diff --git a/src/librustdoc/path_pass.rs b/src/librustdoc/path_pass.rs
index c03eb06d2dd..2663ca8c876 100644
--- a/src/librustdoc/path_pass.rs
+++ b/src/librustdoc/path_pass.rs
@@ -15,11 +15,12 @@ use core::prelude::*;
 use astsrv;
 use doc::ItemUtils;
 use doc;
-use extract;
 use fold::Fold;
 use fold;
 use pass::Pass;
 
+#[cfg(test)] use extract;
+
 use syntax::ast;
 
 pub fn mk_pass() -> Pass {
diff --git a/src/librustdoc/prune_hidden_pass.rs b/src/librustdoc/prune_hidden_pass.rs
index 97258d99ba4..3755fd706c0 100644
--- a/src/librustdoc/prune_hidden_pass.rs
+++ b/src/librustdoc/prune_hidden_pass.rs
@@ -18,9 +18,6 @@ use fold::Fold;
 use fold;
 use pass::Pass;
 
-use core::vec;
-use std::oldmap::HashMap;
-
 pub fn mk_pass() -> Pass {
     Pass {
         name: ~"prune_hidden",
@@ -66,6 +63,8 @@ fn is_hidden(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
 
 #[test]
 fn should_prune_hidden_items() {
+    use core::vec;
+
     let doc = test::mk_doc(~"#[doc(hidden)] mod a { }");
     assert vec::is_empty(doc.cratemod().mods())
 }
diff --git a/src/librustdoc/prune_private_pass.rs b/src/librustdoc/prune_private_pass.rs
index 1acb6092e2c..85f25901ad1 100644
--- a/src/librustdoc/prune_private_pass.rs
+++ b/src/librustdoc/prune_private_pass.rs
@@ -19,8 +19,6 @@ use fold;
 use pass::Pass;
 
 use core::util;
-use core::vec;
-use syntax::ast;
 
 pub fn mk_pass() -> Pass {
     Pass {
diff --git a/src/librustdoc/rustdoc.rc b/src/librustdoc/rustdoc.rc
index 54f1a779bcc..9bd78e54b78 100644
--- a/src/librustdoc/rustdoc.rc
+++ b/src/librustdoc/rustdoc.rc
@@ -29,7 +29,6 @@ extern mod rustc(vers = "0.6");
 extern mod syntax(vers = "0.6");
 
 use core::*;
-use std::par;
 
 pub mod pass;
 pub mod config;
@@ -62,7 +61,6 @@ pub mod util;
 
 use doc::ItemUtils;
 use doc::Item;
-use pass::Pass;
 use config::Config;
 
 pub fn main() {
diff --git a/src/librustdoc/sectionalize_pass.rs b/src/librustdoc/sectionalize_pass.rs
index 205fc0aa86d..91f352a2eac 100644
--- a/src/librustdoc/sectionalize_pass.rs
+++ b/src/librustdoc/sectionalize_pass.rs
@@ -13,17 +13,13 @@
 use core::prelude::*;
 
 use astsrv;
-use attr_pass;
 use doc::ItemUtils;
 use doc;
-use extract;
 use fold::Fold;
 use fold;
 use pass::Pass;
 
 use core::str;
-use core::vec;
-use std::par;
 
 pub fn mk_pass() -> Pass {
     Pass {
diff --git a/src/librustdoc/sort_item_name_pass.rs b/src/librustdoc/sort_item_name_pass.rs
index 946be67ee10..b20faf44fa4 100644
--- a/src/librustdoc/sort_item_name_pass.rs
+++ b/src/librustdoc/sort_item_name_pass.rs
@@ -10,10 +10,8 @@
 
 //! Sorts items by name
 
-use astsrv;
 use doc::ItemUtils;
 use doc;
-use extract;
 use pass::Pass;
 use sort_pass;
 
@@ -26,6 +24,9 @@ pub fn mk_pass() -> Pass {
 
 #[test]
 fn test() {
+    use astsrv;
+    use extract;
+
     let source = ~"mod z { } fn y() { }";
     do astsrv::from_str(source) |srv| {
         let doc = extract::from_srv(srv.clone(), ~"");
diff --git a/src/librustdoc/sort_item_type_pass.rs b/src/librustdoc/sort_item_type_pass.rs
index 1a370947d69..8b39dcb1f8f 100644
--- a/src/librustdoc/sort_item_type_pass.rs
+++ b/src/librustdoc/sort_item_type_pass.rs
@@ -10,12 +10,7 @@
 
 //! Sorts items by type
 
-use core::prelude::*;
-
-use astsrv;
-use doc::ItemUtils;
 use doc;
-use extract;
 use pass::Pass;
 use sort_pass;
 
@@ -43,6 +38,9 @@ pub fn mk_pass() -> Pass {
 
 #[test]
 fn test() {
+    use astsrv;
+    use extract;
+
     let source =
         ~"mod imod { } \
          extern mod inmod {
diff --git a/src/librustdoc/sort_pass.rs b/src/librustdoc/sort_pass.rs
index 3bdb0897404..c1e58f30c7a 100644
--- a/src/librustdoc/sort_pass.rs
+++ b/src/librustdoc/sort_pass.rs
@@ -10,17 +10,15 @@
 
 //! A general sorting pass
 
-use core::prelude::*;
-
 use astsrv;
-use doc::ItemUtils;
 use doc;
-use extract;
 use fold::Fold;
 use fold;
 use pass::Pass;
 use util::NominalOp;
 
+#[cfg(test)] use extract;
+
 use std::sort;
 
 pub type ItemLtEqOp = @pure fn(v1: &doc::ItemTag, v2:  &doc::ItemTag) -> bool;
diff --git a/src/librustdoc/text_pass.rs b/src/librustdoc/text_pass.rs
index 83f35418b0b..22bdc08a50e 100644
--- a/src/librustdoc/text_pass.rs
+++ b/src/librustdoc/text_pass.rs
@@ -21,7 +21,6 @@ use pass::Pass;
 use util::NominalOp;
 
 use core::cell::Cell;
-use std::par;
 
 pub fn mk_pass(name: ~str, op: @fn(&str) -> ~str) -> Pass {
     let op = Cell(op);
diff --git a/src/librustdoc/trim_pass.rs b/src/librustdoc/trim_pass.rs
index 39557a92e01..eb63d9a52d0 100644
--- a/src/librustdoc/trim_pass.rs
+++ b/src/librustdoc/trim_pass.rs
@@ -15,12 +15,9 @@ If the first paragraph of a long description is short enough then it
 is interpreted as the brief description.
 */
 
-use doc::ItemUtils;
-use doc;
 use pass::Pass;
 use text_pass;
 
-use core::option::Some;
 use core::str;
 
 pub fn mk_pass() -> Pass {
@@ -29,6 +26,8 @@ pub fn mk_pass() -> Pass {
 
 #[test]
 fn should_trim_text() {
+    use core::option::Some;
+
     let doc = test::mk_doc(~"#[doc = \" desc \"] \
                             mod m {
                             }");
diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs
index afd3ca0ef6a..c1e7675fd0e 100644
--- a/src/librustdoc/tystr_pass.rs
+++ b/src/librustdoc/tystr_pass.rs
@@ -22,8 +22,6 @@ use fold;
 use pass::Pass;
 
 use core::vec;
-use std::oldmap::HashMap;
-use std::par;
 use syntax::ast;
 use syntax::print::pprust;
 use syntax::ast_map;
diff --git a/src/librustdoc/unindent_pass.rs b/src/librustdoc/unindent_pass.rs
index fa8c2dd93c0..d5b9756faa5 100644
--- a/src/librustdoc/unindent_pass.rs
+++ b/src/librustdoc/unindent_pass.rs
@@ -27,7 +27,6 @@ use text_pass;
 use core::str;
 use core::uint;
 use core::vec;
-use std::par;
 
 pub fn mk_pass() -> Pass {
     text_pass::mk_pass(~"unindent", unindent)
diff --git a/src/librustdoc/util.rs b/src/librustdoc/util.rs
index 61c02bf6849..fe39ac6bc50 100644
--- a/src/librustdoc/util.rs
+++ b/src/librustdoc/util.rs
@@ -10,8 +10,6 @@
 
 use core::prelude::*;
 
-use core::task;
-
 // Just a named container for our op, so it can have impls
 pub struct NominalOp<T> {
     op: T
diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc
index 56375ca5bfb..3e1b0c03bd7 100644
--- a/src/librusti/rusti.rc
+++ b/src/librusti/rusti.rc
@@ -30,13 +30,7 @@ extern mod syntax(vers = "0.6");
 
 use core::*;
 use core::io::{ReaderUtil, WriterUtil};
-use rustc::back;
 use rustc::driver::{driver, session};
-use rustc::front;
-use rustc::lib::llvm::llvm;
-use rustc::metadata::{creader, filesearch};
-use rustc::middle::{freevars, kind, lint, trans, ty, typeck};
-use rustc::middle;
 use syntax::{ast, ast_util, codemap, diagnostic, fold, parse, print, visit};
 use syntax::ast_util::*;
 use syntax::parse::token;
diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs
index bd2dd102e45..57d456f1bbf 100644
--- a/src/librustpkg/util.rs
+++ b/src/librustpkg/util.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use Listener;
-
 use core::*;
 use core::hashmap::linear::LinearMap;
 use rustc::driver::{driver, session};
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs
index ea59d6a54c6..e29474f82ef 100644
--- a/src/libstd/arc.rs
+++ b/src/libstd/arc.rs
@@ -17,15 +17,12 @@ use sync;
 use sync::{Mutex, mutex_with_condvars, RWlock, rwlock_with_condvars};
 
 use core::cast;
-use core::cell::Cell;
-use core::pipes;
 use core::prelude::*;
 use core::unstable::{SharedMutableState, shared_mutable_state};
 use core::unstable::{clone_shared_mutable_state};
 use core::unstable::{get_shared_mutable_state, get_shared_immutable_state};
 use core::ptr;
 use core::task;
-use core::util;
 
 /// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
 pub struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar }
@@ -449,9 +446,6 @@ mod tests {
     use arc;
 
     use core::cell::Cell;
-    use core::option::{Some, None};
-    use core::option;
-    use core::pipes;
     use core::task;
     use core::vec;
 
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index a30ee94a42b..c7b50bf8908 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -32,7 +32,6 @@
 // overhead when initializing plain-old-data and means we don't need
 // to waste time running the destructors of POD.
 
-use arena;
 use list;
 use list::{List, Cons, Nil};
 
@@ -274,7 +273,7 @@ pub impl &Arena {
 
 #[test]
 fn test_arena_destructors() {
-    let arena = arena::Arena();
+    let arena = Arena();
     for uint::range(0, 10) |i| {
         // Arena allocate something with drop glue to make sure it
         // doesn't leak.
@@ -287,7 +286,7 @@ fn test_arena_destructors() {
 
 #[test] #[should_fail] #[ignore(cfg(windows))]
 fn test_arena_destructors_fail() {
-    let arena = arena::Arena();
+    let arena = Arena();
     // Put some stuff in the arena.
     for uint::range(0, 10) |i| {
         // Arena allocate something with drop glue to make sure it
diff --git a/src/libstd/base64.rs b/src/libstd/base64.rs
index 5065e15bb5e..17b3cda0713 100644
--- a/src/libstd/base64.rs
+++ b/src/libstd/base64.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core::io::Reader;
 use core::iter;
 use core::str;
 use core::vec;
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs
index cf278b07c9d..939f6960bf9 100644
--- a/src/libstd/bitv.rs
+++ b/src/libstd/bitv.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use core::container::{Container, Mutable, Set};
-use core::num::NumCast;
 use core::ops;
 use core::prelude::*;
 use core::uint;
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs
index 30538a12942..e0336be5986 100644
--- a/src/libstd/c_vec.rs
+++ b/src/libstd/c_vec.rs
@@ -36,11 +36,9 @@
  * still held if needed.
  */
 
-use core::libc;
 use core::option;
 use core::prelude::*;
 use core::ptr;
-use core::task;
 
 /**
  * The type representing a foreign chunk of memory
diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs
index f6fcf6c8d3b..b203a53058d 100644
--- a/src/libstd/deque.rs
+++ b/src/libstd/deque.rs
@@ -9,9 +9,7 @@
 // except according to those terms.
 
 use core::container::{Container, Mutable};
-use core::cmp::Eq;
 use core::prelude::*;
-use core::uint;
 use core::vec;
 
 const initial_capacity: uint = 32u; // 2^5
diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs
index cbe0580a609..7ac58ae539f 100644
--- a/src/libstd/ebml.rs
+++ b/src/libstd/ebml.rs
@@ -8,13 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use serialize;
-
-use core::io;
-use core::ops;
 use core::prelude::*;
-use core::str;
-use core::vec;
 
 // Simple Extensible Binary Markup Language (ebml) reader and writer on a
 // cursor model. See the specification here:
diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs
index 42f954f7c39..564d34f73d7 100644
--- a/src/libstd/flatpipes.rs
+++ b/src/libstd/flatpipes.rs
@@ -51,10 +51,8 @@ block the scheduler thread, so will their pipes.
 use core::io;
 use core::comm::GenericChan;
 use core::comm::GenericPort;
-use core::pipes;
 use core::prelude::*;
 use core::sys::size_of;
-use core::uint;
 use core::vec;
 
 /**
@@ -508,7 +506,6 @@ pub mod bytepipes {
 
     use core::io::{Writer, Reader, ReaderUtil};
     use core::comm::{Port, Chan};
-    use core::pipes;
     use core::prelude::*;
 
     pub struct ReaderBytePort<R> {
@@ -633,26 +630,18 @@ pub mod bytepipes {
 mod test {
     use core::prelude::*;
 
-    use DefaultEncoder = json::Encoder;
-    use DefaultDecoder = json::Decoder;
-
     use flatpipes::{Flattener, Unflattener};
-    use flatpipes::flatteners::*;
     use flatpipes::bytepipes::*;
     use flatpipes::pod;
     use flatpipes::serial;
     use io_util::BufReader;
     use flatpipes::{BytePort, FlatChan, FlatPort};
-    use net::ip;
     use net::tcp::TcpSocketBuf;
 
-    use core::dvec::DVec;
     use core::int;
     use core::io::{BytesReader, BytesWriter};
-    use core::io;
     use core::prelude::*;
     use core::result;
-    use core::sys;
     use core::task;
 
     #[test]
@@ -773,7 +762,6 @@ mod test {
 
         use core::cell::Cell;
         use net::ip;
-        use net::tcp::TcpSocket;
         use net::tcp;
         use uv;
 
@@ -880,7 +868,6 @@ mod test {
         use io_util::BufReader;
 
         use core::io;
-        use core::pipes;
         use core::sys;
         use core::task;
 
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index 990c37ce807..f105aacbc4f 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -21,11 +21,8 @@
  * ~~~
  */
 
-use core::cast::copy_lifetime;
 use core::cast;
 use core::cell::Cell;
-use core::either::Either;
-use core::option;
 use core::comm::{oneshot, ChanOne, PortOne, send_one, recv_one};
 use core::pipes::recv;
 use core::prelude::*;
@@ -145,6 +142,7 @@ pub fn spawn<A:Owned>(blk: ~fn() -> A) -> Future<A> {
 }
 
 #[allow(non_implicitly_copyable_typarams)]
+#[cfg(test)]
 pub mod test {
     use core::prelude::*;
 
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index dd205583259..4e851005de5 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -79,7 +79,6 @@ use core::cmp::Eq;
 use core::prelude::*;
 use core::result::{Err, Ok};
 use core::result;
-use core::option;
 use core::option::{Some, None};
 use core::str;
 use core::vec;
@@ -640,7 +639,6 @@ pub mod groups {
 mod tests {
     use core::prelude::*;
 
-    use opt = getopts;
     use getopts::groups::OptGroup;
     use getopts::*;
 
diff --git a/src/libstd/io_util.rs b/src/libstd/io_util.rs
index b1c6e2d44e5..6839981d201 100644
--- a/src/libstd/io_util.rs
+++ b/src/libstd/io_util.rs
@@ -10,7 +10,6 @@
 
 use core::io::{Reader, BytesReader};
 use core::io;
-use core::prelude::*;
 
 pub struct BufReader {
     buf: ~[u8],
diff --git a/src/libstd/list.rs b/src/libstd/list.rs
index f6cbd9a099b..043e0cafe61 100644
--- a/src/libstd/list.rs
+++ b/src/libstd/list.rs
@@ -11,7 +11,6 @@
 //! A standard linked list
 
 use core::cmp::Eq;
-use core::option;
 use core::option::*;
 use core::prelude::*;
 use core::vec;
diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs
index bc17cb0bfe9..95e10cf5b12 100644
--- a/src/libstd/net_ip.rs
+++ b/src/libstd/net_ip.rs
@@ -16,7 +16,6 @@ use core::comm::{stream, SharedChan};
 use core::ptr;
 use core::result;
 use core::str;
-use core::uint;
 use core::vec;
 
 use iotask = uv::iotask::IoTask;
@@ -26,10 +25,8 @@ use sockaddr_in = uv::ll::sockaddr_in;
 use sockaddr_in6 = uv::ll::sockaddr_in6;
 use addrinfo = uv::ll::addrinfo;
 use uv_getaddrinfo_t = uv::ll::uv_getaddrinfo_t;
-use uv_ip4_addr = uv::ll::ip4_addr;
 use uv_ip4_name = uv::ll::ip4_name;
 use uv_ip4_port = uv::ll::ip4_port;
-use uv_ip6_addr = uv::ll::ip6_addr;
 use uv_ip6_name = uv::ll::ip6_name;
 use uv_ip6_port = uv::ll::ip6_port;
 use uv_getaddrinfo = uv::ll::getaddrinfo;
diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs
index 08b7b3d6ae5..18f38e074c7 100644
--- a/src/libstd/net_url.rs
+++ b/src/libstd/net_url.rs
@@ -13,7 +13,6 @@
 #[allow(deprecated_mode)];
 
 use core::cmp::Eq;
-use core::dvec::DVec;
 use core::from_str::FromStr;
 use core::io::{Reader, ReaderUtil};
 use core::io;
@@ -25,8 +24,6 @@ use core::to_bytes;
 use core::to_str::ToStr;
 use core::to_str;
 use core::uint;
-use core::util;
-use core::vec;
 
 #[deriving_eq]
 struct Url {
@@ -820,11 +817,8 @@ mod tests {
     use core::prelude::*;
 
     use net_url::*;
-    use net_url::UserInfo;
 
     use core::hashmap::linear::LinearMap;
-    use core::result;
-    use core::str;
 
     #[test]
     pub fn test_url_parse() {
diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs
index 1d21f749b32..faa26e24812 100644
--- a/src/libstd/oldmap.rs
+++ b/src/libstd/oldmap.rs
@@ -14,12 +14,9 @@ use core::container::{Container, Mutable, Map};
 use core::cmp::Eq;
 use core::hash::Hash;
 use core::io::WriterUtil;
-use core::io;
-use core::ops;
 use core::to_str::ToStr;
 use core::prelude::*;
 use core::to_bytes::IterBytes;
-use core::uint;
 use core::vec;
 
 /// A convenience type to treat a hashmap as a set
@@ -417,7 +414,6 @@ pub fn hash_from_vec<K:Eq + IterBytes + Hash + Const + Copy,V:Copy>(
 
 #[cfg(test)]
 mod tests {
-    use core::option::None;
     use core::uint;
 
     use super::*;
diff --git a/src/libstd/prettyprint.rs b/src/libstd/prettyprint.rs
index dd873650b66..ed02ea87dac 100644
--- a/src/libstd/prettyprint.rs
+++ b/src/libstd/prettyprint.rs
@@ -10,7 +10,6 @@
 
 use serialize;
 
-use core::io::Writer;
 use core::io::WriterUtil;
 use core::io;
 
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs
index 8e878c8fc2e..ba107b340bc 100644
--- a/src/libstd/rope.rs
+++ b/src/libstd/rope.rs
@@ -33,8 +33,6 @@
  * * access to a character by index is logarithmic (linear in strings);
  */
 
-use core::cast;
-use core::char;
 use core::option;
 use core::prelude::*;
 use core::str;
diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs
index a8a609b1f8a..83f80f94382 100644
--- a/src/libstd/sync.rs
+++ b/src/libstd/sync.rs
@@ -15,9 +15,7 @@
  * in std.
  */
 
-use core::cell::Cell;
 use core::option;
-use core::pipes;
 use core::prelude::*;
 use core::unstable::{Exclusive, exclusive};
 use core::ptr;
@@ -714,7 +712,6 @@ mod tests {
     use core::cast;
     use core::cell::Cell;
     use core::option;
-    use core::pipes;
     use core::ptr;
     use core::result;
     use core::task;
diff --git a/src/libstd/task_pool.rs b/src/libstd/task_pool.rs
index 35b7ff5ad27..c3b4435bc8f 100644
--- a/src/libstd/task_pool.rs
+++ b/src/libstd/task_pool.rs
@@ -11,9 +11,7 @@
 /// A task pool abstraction. Useful for achieving predictable CPU
 /// parallelism.
 
-use core::io;
 use core::comm::{Chan, Port};
-use core::pipes;
 use core::prelude::*;
 use core::task::{SchedMode, SingleThreaded};
 use core::task;
diff --git a/src/libstd/tempfile.rs b/src/libstd/tempfile.rs
index b786d913639..1e95f1aafa5 100644
--- a/src/libstd/tempfile.rs
+++ b/src/libstd/tempfile.rs
@@ -13,7 +13,6 @@
 use core::os;
 use core::prelude::*;
 use core::rand;
-use core::str;
 
 pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> {
     let r = rand::Rng();
diff --git a/src/libstd/term.rs b/src/libstd/term.rs
index 5616c7211c1..af826af9397 100644
--- a/src/libstd/term.rs
+++ b/src/libstd/term.rs
@@ -10,11 +10,9 @@
 
 //! Simple ANSI color library
 
-use core::i32;
 use core::io;
 use core::option;
 use core::os;
-use core::str;
 use core::vec;
 
 // FIXME (#2807): Windows support.
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index 4ffa9b01d2b..b5f568f1921 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -32,7 +32,6 @@ use core::option;
 use core::prelude::*;
 use core::result;
 use core::str;
-use core::task::TaskBuilder;
 use core::task;
 use core::vec;
 
diff --git a/src/libstd/time.rs b/src/libstd/time.rs
index 6e80665d80e..7a4da436d12 100644
--- a/src/libstd/time.rs
+++ b/src/libstd/time.rs
@@ -10,7 +10,6 @@
 
 use core::cmp::{Eq, Ord};
 use core::int;
-use core::libc::{c_char, c_int, c_long, size_t, time_t};
 use core::i32;
 use core::io::{Reader, ReaderUtil};
 use core::io;
@@ -894,8 +893,6 @@ mod tests {
     use core::result;
     use core::result::{Err, Ok};
     use core::str;
-    use core::u64;
-    use core::uint;
     use core::vec;
 
     pub fn test_get_time() {
diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs
index 7bd411315b2..f0898e22400 100644
--- a/src/libstd/timer.rs
+++ b/src/libstd/timer.rs
@@ -21,7 +21,6 @@ use core::cast::transmute;
 use core::comm::{stream, Chan, SharedChan, Port, select2i};
 use core::prelude::*;
 use core::ptr;
-use core;
 
 /**
  * Wait for timeout period then send provided value over a channel
diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs
index daf90f345e0..db3570941e8 100644
--- a/src/libstd/uv_global_loop.rs
+++ b/src/libstd/uv_global_loop.rs
@@ -10,22 +10,16 @@
 
 //! A process-wide libuv event loop for library use.
 
-use ll = uv_ll;
 use iotask = uv_iotask;
-use get_gl = self::get;
 use uv_iotask::{IoTask, spawn_iotask};
 
 use core::clone::Clone;
 use core::comm::{Port, Chan, SharedChan, select2i};
-use core::either::{Left, Right};
-use core::libc;
 use core::option::{Some, None};
-use core::str;
 use core::task::{task, SingleThreaded, spawn};
 use core::task;
 use core::unstable::global::{global_data_clone_create, global_data_clone};
 use core::unstable::weak_task::weaken_task;
-use core::vec;
 
 /**
  * Race-free helper to get access to a global task where a libuv
@@ -126,7 +120,6 @@ mod test {
     use get_gl = uv_global_loop::get;
     use uv::iotask;
     use uv::ll;
-    use uv_global_loop::*;
     use uv_iotask::IoTask;
 
     use core::iter;
diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs
index 6179b10f3c3..2414b1f9bfa 100644
--- a/src/libstd/uv_iotask.rs
+++ b/src/libstd/uv_iotask.rs
@@ -22,7 +22,6 @@ use core::libc;
 use core::comm::{stream, Port, Chan, SharedChan};
 use core::prelude::*;
 use core::ptr::addr_of;
-use core::task::TaskBuilder;
 use core::task;
 
 /// Used to abstract-away direct interaction with a libuv loop.
diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs
index 7f47db37504..1dd7bfd75db 100644
--- a/src/libstd/workcache.rs
+++ b/src/libstd/workcache.rs
@@ -19,7 +19,6 @@ use core::cell::Cell;
 use core::cmp;
 use core::either::{Either, Left, Right};
 use core::io;
-use core::option;
 use core::comm::{oneshot, PortOne, send_one};
 use core::pipes::recv;
 use core::prelude::*;
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index cec35b429b4..47948cc3ead 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -13,9 +13,7 @@
 use codemap::{span, FileName, spanned};
 
 use core::cast;
-use core::cmp;
 use core::option::{None, Option, Some};
-use core::ptr;
 use core::task;
 use core::to_bytes;
 use core::to_str::ToStr;
@@ -1336,15 +1334,15 @@ pub enum inlined_item {
 
 #[cfg(test)]
 mod test {
-    use std;
-    use codemap::*;
-    use super::*;
-
     //are asts encodable?
 
     // it looks like this *will* be a compiler bug, after
     // I get deriving_eq for crates into incoming :)
     /*
+    use std;
+    use codemap::*;
+    use super::*;
+
     #[test] fn check_asts_encodable() {
         let bogus_span = span {lo:BytePos(10),
                                hi:BytePos(20),
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 0627e063d97..3001fe8069c 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -23,11 +23,8 @@ use print::pprust;
 use visit;
 
 use core::cmp;
-use core::either;
 use core::str;
 use core::vec;
-use std::oldmap::HashMap;
-use std::oldmap;
 use std;
 
 pub enum path_elt {
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 96f4dadb3db..b5ccef8eae0 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -18,7 +18,6 @@ use parse::token;
 use visit;
 use opt_vec;
 
-use core::cmp;
 use core::int;
 use core::option;
 use core::str;
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index e744d19b965..7739a862432 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -21,8 +21,6 @@ use parse::comments::{doc_comment_style, strip_doc_comment_decoration};
 
 use core::cmp;
 use core::either::Either;
-use core::either;
-use core::option;
 use core::vec;
 use core::hashmap::linear::LinearSet;
 use std;
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 77fe53f5b25..232c57eb5a2 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -28,7 +28,6 @@ use core::dvec::DVec;
 use core::str;
 use core::to_bytes;
 use core::uint;
-use core::vec;
 use std::serialize::{Encodable, Decodable, Encoder, Decoder};
 
 pub trait Pos {
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index ba4ec7fb6db..a83dfa5538d 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -13,7 +13,6 @@ use core::prelude::*;
 use codemap::{Pos, span};
 use codemap;
 
-use core::cmp;
 use core::io::WriterUtil;
 use core::io;
 use core::option;
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index b0dcdf2e664..644afaff37c 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -102,8 +102,6 @@ use opt_vec::OptVec;
 use ext::build;
 
 use core::vec;
-use std::oldmap;
-use std::oldmap::HashMap;
 
 // Transitional reexports so qquote can find the paths it is looking for
 mod syntax {
@@ -1208,14 +1206,7 @@ fn mk_enum_deser_body(
 mod test {
     use std::serialize::Encodable;
     use std::serialize::Encoder;
-    use core::dvec::*;
     use util::testing::*;
-    use core::io;
-    use core::str;
-    use core::option::Option;
-    use core::option::Some;
-    use core::option::None;
-    use std;
 
     // just adding the ones I want to test, for now:
     #[deriving_eq]
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 01439fb40fb..23cabc09946 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -19,7 +19,6 @@ use ext;
 use parse;
 use parse::{parser, token};
 
-use core::io;
 use core::vec;
 use core::hashmap::linear::LinearMap;
 
@@ -504,7 +503,6 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
 
 #[cfg(test)]
 mod test {
-    use super::*;
     use super::MapChain;
     use util::testing::check_equal;
     use core::hashmap::linear::LinearMap;
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index c6e6e677348..a42564ff2ec 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -16,10 +16,8 @@ use codemap::span;
 use ext::base::ext_ctxt;
 use ext::build;
 
-use opt_vec;
 use opt_vec::OptVec;
 
-use core::dvec;
 use core::option;
 
 pub struct Field {
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index f5dbf269138..07896236442 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -28,7 +28,6 @@ use codemap::{span, spanned};
 use parse::token::special_idents::clownshoes_extensions;
 use ast_util;
 use opt_vec;
-use opt_vec::OptVec;
 
 use core::dvec;
 use core::uint;
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 858ce4b17a3..97c75e65e1d 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -24,7 +24,6 @@ use parse::{parser, parse_item_from_source_str, new_parser_from_tts};
 
 use core::option;
 use core::vec;
-use core::hashmap::LinearMap;
 
 pub fn expand_expr(extsbox: @mut SyntaxEnv,
                    cx: ext_ctxt,
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 3b885b7a7b9..e6f0cdde8c1 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -17,9 +17,7 @@ use core::prelude::*;
 
 use ast::{ident, node_id};
 use ast;
-use ast_util::{ident_to_path};
 use ast_util;
-use attr;
 use codemap::{span, respan, dummy_sp, spanned};
 use codemap;
 use ext::base::{ext_ctxt, mk_ctxt};
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index c26bfd178b0..df17c960ba2 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -44,7 +44,6 @@ FIXME (#3072) - This is still incomplete.
 */
 
 use ast;
-use ast::tt_delim;
 use codemap::span;
 use ext::base;
 use ext::base::ext_ctxt;
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index a5ca24c6737..0725f288949 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -11,7 +11,6 @@
 // Parsing pipes protocols from token trees.
 
 use ast_util;
-use ext::pipes::pipec::*;
 use ext::pipes::proto::*;
 use parse::common::SeqSep;
 use parse::parser;
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 968a0e5f77e..5ea9257d583 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -11,19 +11,15 @@
 // A protocol compiler for Rust.
 
 use ast;
-use ast::ident;
 use codemap::{dummy_sp, spanned};
 use ext::base::ext_ctxt;
 use ext::pipes::ast_builder::{append_types, ext_ctxt_ast_builder, path};
 use ext::pipes::ast_builder::{path_global};
 use ext::pipes::proto::*;
 use ext::quote::rt::*;
-use parse::*;
-use util::interner;
 use opt_vec;
 use opt_vec::OptVec;
 
-use core::dvec::DVec;
 use core::prelude::*;
 use core::str;
 use core::to_str::ToStr;
@@ -342,7 +338,7 @@ impl gen_init for protocol {
         };
 
         cx.parse_item(fmt!("pub fn init%s() -> (client::%s, server::%s)\
-                            { use core::pipes::HasBuffer; %s }",
+                            { pub use core::pipes::HasBuffer; %s }",
                            start_state.generics.to_source(cx),
                            start_state.to_ty(cx).to_source(cx),
                            start_state.to_ty(cx).to_source(cx),
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index db5c6541e26..329b3f59b1e 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -15,7 +15,6 @@ use codemap::span;
 use ext::base::ext_ctxt;
 use ext::pipes::ast_builder::{append_types, ext_ctxt_ast_builder, path};
 
-use core::cmp;
 use core::to_str::ToStr;
 
 #[deriving_eq]
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 7b00a5e5a4b..49d5ed1d0cc 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use ast;
-use attr;
 use codemap::{BytePos, Pos, span};
 use ext::base::ext_ctxt;
 use ext::base;
@@ -19,7 +18,6 @@ use parse::token;
 use parse;
 
 use core::prelude::*;
-use core::str;
 
 /**
 *
@@ -34,7 +32,6 @@ use core::str;
 
 pub mod rt {
     use ast;
-    use codemap;
     use ext::base::ext_ctxt;
     use parse;
     use print::pprust;
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index d7f7f7c6510..b53523f78a4 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -10,7 +10,6 @@
 
 use core::prelude::*;
 
-use ast::tt_delim;
 use ast;
 use codemap::span;
 use ext::base::ext_ctxt;
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 004acd40691..0e63ea3278e 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -13,7 +13,6 @@ use ast;
 use ast::{matcher, match_tok, match_seq, match_nonterminal, ident};
 use codemap::{BytePos, mk_sp};
 use codemap;
-use parse::common::*; //resolve bug?
 use parse::lexer::*; //resolve bug?
 use parse::ParseSess;
 use parse::parser::Parser;
@@ -22,8 +21,6 @@ use parse::token;
 
 use core::dvec::DVec;
 use core::dvec;
-use core::io;
-use core::option;
 use core::option::{Option, Some, None};
 use core::str;
 use core::uint;
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 370b838ab41..e5b7152bea2 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -26,7 +26,6 @@ use parse::token::{FAT_ARROW, SEMI, LBRACE, RBRACE, nt_matchers, nt_tt};
 use print;
 
 use core::io;
-use std::oldmap::HashMap;
 
 pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
                          arg: ~[ast::token_tree]) -> base::MacResult {
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 443c0b40390..79264f7adf0 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -12,7 +12,6 @@ use core::prelude::*;
 
 use ast;
 use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident};
-use ast_util;
 use codemap::{span, dummy_sp};
 use diagnostic::span_handler;
 use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal};
@@ -22,7 +21,6 @@ use parse::lexer::TokenAndSpan;
 use core::option;
 use core::vec;
 use std;
-use std::oldmap::HashMap;
 
 /* FIXME #2811: figure out how to have a uniquely linked stack, and change to
    `~` */
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 824a3e6f880..bf8f03d4bf6 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core::prelude::*;
-
 use ast;
 use codemap::spanned;
 use codemap::BytePos;
@@ -17,8 +15,6 @@ use parse::common::*; //resolve bug?
 use parse::token;
 use parse::parser::Parser;
 
-use core::either::{Either, Left, Right};
-
 // a parser that can parse attributes.
 pub trait parser_attr {
     fn parse_outer_attributes(&self) -> ~[ast::attribute];
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs
index 64c4cb3c508..4125a0bc3b4 100644
--- a/src/libsyntax/parse/classify.rs
+++ b/src/libsyntax/parse/classify.rs
@@ -14,7 +14,6 @@
 
 use ast;
 use codemap;
-use ast_util::operator_prec;
 
 pub fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
     match e.node {
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 714ae9a0fd5..ca5c4564dd9 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -19,7 +19,6 @@ use parse::lexer::{is_line_non_doc_comment, is_block_non_doc_comment};
 use parse::lexer;
 use parse::token;
 use parse;
-use util::interner;
 
 use core::cmp;
 use core::io::ReaderUtil;
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs
index 0abec79ee5d..cdeb9b2f647 100644
--- a/src/libsyntax/parse/common.rs
+++ b/src/libsyntax/parse/common.rs
@@ -17,8 +17,6 @@ use parse::parser::Parser;
 use parse::token;
 
 use core::option::{None, Option, Some};
-use core::option;
-use std::oldmap::HashMap;
 
 use opt_vec;
 use opt_vec::OptVec;
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index ed71fa411c6..524f9b48dd5 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -11,7 +11,6 @@
 use core::prelude::*;
 
 use ast;
-use ast_util;
 use codemap::{BytePos, CharPos, CodeMap, Pos, span};
 use codemap;
 use diagnostic::span_handler;
@@ -780,7 +779,6 @@ pub mod test {
     use core::option::None;
     use diagnostic;
     use parse::token;
-    use util::interner;
     use util::testing::{check_equal, check_equal_ptr};
 
     // represents a testing reader (incl. both reader and interner)
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 887f064018f..96a8f780934 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -20,13 +20,11 @@ use parse::attr::parser_attr;
 use parse::lexer::{reader, StringReader};
 use parse::parser::Parser;
 use parse::token::{ident_interner, mk_ident_interner};
-use util::interner;
 
 use core::io;
 use core::option::{None, Option, Some};
 use core::path::Path;
 use core::result::{Err, Ok, Result};
-use core::result;
 
 pub mod lexer;
 pub mod parser;
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 4ca7c1ec888..93d3d952cdd 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -26,8 +26,6 @@ use parse::parser::Parser;
 use parse::token::Token;
 use parse::token;
 
-use core::cmp;
-use core::option;
 use core::str;
 use core::to_bytes;
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 0d0d23e0cd0..dd179171fce 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -57,7 +57,6 @@ use ast::{unnamed_field, unsafe_blk, unsafe_fn, variant, view_item};
 use ast::{view_item_, view_item_extern_mod, view_item_use};
 use ast::{view_path, view_path_glob, view_path_list, view_path_simple};
 use ast::{visibility, vstore, vstore_box, vstore_fixed, vstore_slice};
-use ast::{vstore_uniq};
 use ast;
 use ast_util::{ident_to_path, operator_prec};
 use ast_util;
@@ -72,7 +71,6 @@ use parse::lexer::TokenAndSpan;
 use parse::obsolete::{ObsoleteClassTraits, ObsoleteModeInFnType};
 use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator};
 use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove};
-use parse::obsolete::{ObsoleteStructCtor, ObsoleteWith};
 use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
 use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
 use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
@@ -82,16 +80,11 @@ use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
 use parse::token;
 use parse::{new_sub_parser_from_file, next_node_id, ParseSess};
-use print::pprust::expr_to_str;
-use util::interner::Interner;
 use opt_vec;
 use opt_vec::OptVec;
 
-use core::cmp;
 use core::either::{Either, Left, Right};
 use core::either;
-use core::result::Result;
-use core::vec::push;
 use core::vec;
 use std::oldmap::HashMap;
 
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index 1dc45b1a4bd..60e6e4dc87e 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -10,11 +10,8 @@
 
 use core::prelude::*;
 
-use core::cmp;
-use core::dvec::DVec;
 use core::io::WriterUtil;
 use core::io;
-use core::str;
 use core::vec;
 
 /*
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index f808a3be6bb..ab65134fd00 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -13,15 +13,12 @@ use core::prelude::*;
 use ast::{RegionTyParamBound, TraitTyParamBound, required, provided};
 use ast;
 use ast_util;
-use ast_util::{operator_prec};
-use opt_vec;
 use opt_vec::OptVec;
 use attr;
 use codemap::{CodeMap, BytePos};
 use codemap;
 use diagnostic;
 use parse::classify::{expr_is_simple_block, expr_requires_semi_to_be_stmt};
-use parse::classify::{stmt_ends_with_semi};
 use parse::token::ident_interner;
 use parse::{comments, lexer, token};
 use parse;
@@ -34,7 +31,6 @@ use core::char;
 use core::dvec::DVec;
 use core::io;
 use core::option;
-use core::str::{push_str, push_char};
 use core::str;
 use core::u64;
 use core::vec;
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 262754624cb..bd60be766fb 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -18,9 +18,6 @@ use parse;
 use opt_vec;
 use opt_vec::OptVec;
 
-use core::option;
-use core::vec;
-
 // Context-passing AST walker. Each overridden visit method has full control
 // over what happens with its node, it can do its own traversal of the node's
 // children (potentially passing in different contexts to each), call
diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs
index 068bb7cd7a6..1d96c04f105 100644
--- a/src/test/compile-fail/borrowck-autoref-3261.rs
+++ b/src/test/compile-fail/borrowck-autoref-3261.rs
@@ -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()>)) {
diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
index 55cbb1cbdca..07a68bfb068 100644
--- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
+++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
@@ -11,7 +11,6 @@
 //buggy.rs
 extern mod std;
 use std::oldmap::HashMap;
-use std::oldmap;
 
 fn main() {
     let buggy_map :HashMap<uint, &uint> =
diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs
index d80c56eb64f..18b4ce0640c 100644
--- a/src/test/compile-fail/borrowck-move-by-capture.rs
+++ b/src/test/compile-fail/borrowck-move-by-capture.rs
@@ -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;
diff --git a/src/test/compile-fail/issue-2611-3.rs b/src/test/compile-fail/issue-2611-3.rs
index 1f425b09223..248bea2d9b5 100644
--- a/src/test/compile-fail/issue-2611-3.rs
+++ b/src/test/compile-fail/issue-2611-3.rs
@@ -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;
diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs
index ae7869d4a68..cf644fc198c 100644
--- a/src/test/compile-fail/issue-2611-4.rs
+++ b/src/test/compile-fail/issue-2611-4.rs
@@ -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;
diff --git a/src/test/compile-fail/issue-2611-5.rs b/src/test/compile-fail/issue-2611-5.rs
index c28fd462b41..b0e2878c46b 100644
--- a/src/test/compile-fail/issue-2611-5.rs
+++ b/src/test/compile-fail/issue-2611-5.rs
@@ -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;
diff --git a/src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs b/src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs
index 4af3e1cbe86..bee9596df72 100644
--- a/src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs
+++ b/src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs
@@ -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> }
 
diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/compile-fail/regions-glb-free-free.rs
index c25205c58d1..44cd89ec0ea 100644
--- a/src/test/compile-fail/regions-glb-free-free.rs
+++ b/src/test/compile-fail/regions-glb-free-free.rs
@@ -11,8 +11,6 @@
 mod argparse {
     extern mod std;
 
-    use core::either::{Either, Left, Right};
-
     pub struct Flag {
         name: &str,
         desc: &str,