From e2ad3be1787cdd36d52fcd2355225156f5460dc4 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Mon, 22 Aug 2016 10:02:28 +0000 Subject: [PATCH 1/3] Use `#[prelude_import]` in `libcore`. --- src/libcore/any.rs | 4 +--- src/libcore/array.rs | 11 +++-------- src/libcore/borrow.rs | 2 -- src/libcore/cell.rs | 13 +++---------- src/libcore/char.rs | 2 -- src/libcore/char_private.rs | 2 -- src/libcore/clone.rs | 2 -- src/libcore/cmp.rs | 9 +-------- src/libcore/convert.rs | 3 --- src/libcore/default.rs | 2 -- src/libcore/fmt/builders.rs | 1 - src/libcore/fmt/mod.rs | 5 ----- src/libcore/fmt/num.rs | 2 -- src/libcore/hash/mod.rs | 4 ---- src/libcore/hash/sip.rs | 2 -- src/libcore/intrinsics.rs | 2 -- src/libcore/iter/iterator.rs | 11 ++--------- src/libcore/iter/mod.rs | 4 ---- src/libcore/iter/range.rs | 6 +----- src/libcore/iter/sources.rs | 5 +---- src/libcore/iter/traits.rs | 5 ----- src/libcore/iter_private.rs | 2 -- src/libcore/lib.rs | 5 +++++ src/libcore/marker.rs | 5 ----- src/libcore/mem.rs | 1 - src/libcore/nonzero.rs | 1 - src/libcore/num/bignum.rs | 3 --- src/libcore/num/dec2flt/algorithm.rs | 2 -- src/libcore/num/dec2flt/mod.rs | 1 - src/libcore/num/dec2flt/num.rs | 1 - src/libcore/num/dec2flt/parse.rs | 1 - src/libcore/num/dec2flt/rawfp.rs | 1 - src/libcore/num/flt2dec/decoder.rs | 2 -- src/libcore/num/flt2dec/mod.rs | 1 - src/libcore/num/flt2dec/strategy/dragon.rs | 2 -- src/libcore/num/flt2dec/strategy/grisu.rs | 2 -- src/libcore/num/mod.rs | 10 ++-------- src/libcore/ops.rs | 7 +------ src/libcore/option.rs | 11 +---------- src/libcore/ptr.rs | 5 +---- src/libcore/result.rs | 8 +------- src/libcore/slice.rs | 15 +++------------ src/libcore/str/mod.rs | 18 ++++-------------- src/libcore/str/pattern.rs | 2 -- src/libcore/sync/atomic.rs | 6 ------ src/libcore/tuple.rs | 4 ---- 46 files changed, 30 insertions(+), 183 deletions(-) diff --git a/src/libcore/any.rs b/src/libcore/any.rs index a452be2565b..4f486ad7cb8 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -72,12 +72,10 @@ #![stable(feature = "rust1", since = "1.0.0")] use fmt; -use marker::Send; use mem::transmute; -use option::Option::{self, Some, None}; use raw::TraitObject; use intrinsics; -use marker::{Reflect, Sized}; +use marker::Reflect; /////////////////////////////////////////////////////////////////////////////// // Any trait diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 45fc5ff8009..9866a39619a 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -20,16 +20,11 @@ issue = "27778")] use borrow::{Borrow, BorrowMut}; -use clone::Clone; -use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; -use convert::{AsRef, AsMut}; -use default::Default; +use cmp::Ordering; use fmt; use hash::{Hash, self}; -use iter::IntoIterator; -use marker::{Copy, Sized, Unsize}; -use option::Option; -use slice::{Iter, IterMut, SliceExt}; +use marker::Unsize; +use slice::{Iter, IterMut}; /// Utility trait implemented only on arrays of fixed size /// diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index 79330d3a61e..3d223465c88 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -12,8 +12,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use marker::Sized; - /// A trait for borrowing data. /// /// In general, there may be several ways to "borrow" a piece of data. The diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 2af48ef2fab..ec35198b685 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -144,17 +144,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use clone::Clone; -use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; -use convert::From; -use default::Default; +use cmp::Ordering; use fmt::{self, Debug, Display}; -use marker::{Copy, PhantomData, Send, Sync, Sized, Unsize}; -use ops::{Deref, DerefMut, Drop, FnOnce, CoerceUnsized}; -use option::Option; -use option::Option::{None, Some}; -use result::Result; -use result::Result::{Ok, Err}; +use marker::{PhantomData, Unsize}; +use ops::{Deref, DerefMut, CoerceUnsized}; /// A mutable memory location that admits only `Copy` data. /// diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 98b7632a220..64cb6dc2314 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -15,8 +15,6 @@ #![allow(non_snake_case)] #![stable(feature = "core_char", since = "1.2.0")] -use prelude::v1::*; - use char_private::is_printable; use iter::FusedIterator; use mem::transmute; diff --git a/src/libcore/char_private.rs b/src/libcore/char_private.rs index 1d8f95cd4b8..708e7cc15e7 100644 --- a/src/libcore/char_private.rs +++ b/src/libcore/char_private.rs @@ -11,8 +11,6 @@ // NOTE: The following code was generated by "src/etc/char_private.py", // do not edit directly! -use slice::SliceExt; - fn check(x: u16, singletons: &[u16], normal: &[u16]) -> bool { for &s in singletons { if x == s { diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index e8cd36f3cd7..748bb62a1f3 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -44,8 +44,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use marker::Sized; - /// A common trait for the ability to explicitly duplicate an object. /// /// Differs from `Copy` in that `Copy` is implicit and extremely inexpensive, while diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 9bba6cd38e5..907dd1508d8 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -34,9 +34,6 @@ use self::Ordering::*; -use marker::Sized; -use option::Option::{self, Some}; - /// Trait for equality comparisons which are [partial equivalence /// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation). /// @@ -571,11 +568,7 @@ pub fn max(v1: T, v2: T) -> T { // Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types mod impls { - use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering}; - use cmp::Ordering::{Less, Greater, Equal}; - use marker::Sized; - use option::Option; - use option::Option::{Some, None}; + use cmp::Ordering::{self, Less, Greater, Equal}; macro_rules! partial_eq_impl { ($($t:ty)*) => ($( diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index e68f973d8d9..8e7e2abfc1e 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -40,9 +40,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use marker::Sized; -use result::Result; - /// A cheap, reference-to-reference conversion. /// /// `AsRef` is very similar to, but different than, `Borrow`. See diff --git a/src/libcore/default.rs b/src/libcore/default.rs index a0dd38c983b..85e4b2a0067 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -12,8 +12,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use marker::Sized; - /// A trait for giving a type a useful default value. /// /// Sometimes, you want to fall back to some kind of default value, and diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 6cac80ab624..102e3c0bd7b 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use fmt::{self, FlagV1}; struct PadAdapter<'a, 'b: 'a> { diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 7688da971eb..66ef92928eb 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -12,8 +12,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use prelude::v1::*; - use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut, BorrowState}; use marker::PhantomData; use mem; @@ -905,8 +903,6 @@ impl<'a> Formatter<'a> { prefix: &str, buf: &str) -> Result { - use char::CharExt; - let mut width = buf.len(); let mut sign = None; @@ -1020,7 +1016,6 @@ impl<'a> Formatter<'a> { f: F) -> Result where F: FnOnce(&mut Formatter) -> Result, { - use char::CharExt; let align = match self.align { rt::v1::Alignment::Unknown => default, _ => self.align diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index d55e0317a94..0145897d8f6 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -14,8 +14,6 @@ // FIXME: #6220 Implement floating point formatting -use prelude::v1::*; - use fmt; use num::Zero; use ops::{Div, Rem, Sub}; diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index 27fdbd38301..081f0c14ec3 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -71,8 +71,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use prelude::v1::*; - use fmt; use marker; use mem; @@ -288,8 +286,6 @@ impl Default for BuildHasherDefault { ////////////////////////////////////////////////////////////////////////////// mod impls { - use prelude::v1::*; - use mem; use slice; use super::*; diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index 4a806a3c986..bd6cae92b05 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -10,8 +10,6 @@ //! An implementation of SipHash. -use prelude::v1::*; - use marker::PhantomData; use ptr; diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index c645608dda7..b70bf43ac35 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -46,8 +46,6 @@ issue = "0")] #![allow(missing_docs)] -use marker::Sized; - extern "rust-intrinsic" { // NB: These intrinsics take raw pointers because they mutate aliased diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 6b01ccaceea..ea97c87efbb 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -8,19 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use clone::Clone; -use cmp::{Ord, PartialOrd, PartialEq, Ordering}; -use default::Default; -use ops::FnMut; -use option::Option::{self, Some, None}; -use marker::Sized; +use cmp::Ordering; use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, FlatMap, Fuse}; use super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, Take, TakeWhile, Rev}; use super::{Zip, Sum, Product}; -use super::ChainState; -use super::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator}; -use super::{IntoIterator, ZipImpl}; +use super::{ChainState, FromIterator, ZipImpl}; fn _assert_is_object_safe(_: &Iterator) {} diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index cfe117c0b1d..b1d3ab1d1fe 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -299,13 +299,9 @@ #![stable(feature = "rust1", since = "1.0.0")] -use clone::Clone; use cmp; -use default::Default; use fmt; use iter_private::TrustedRandomAccess; -use ops::FnMut; -use option::Option::{self, Some, None}; use usize; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index 48816bf66bb..8408e5d88b4 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -8,15 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use clone::Clone; -use cmp::PartialOrd; use mem; use ops::{self, Add, Sub}; -use option::Option::{self, Some, None}; -use marker::Sized; use usize; -use super::{DoubleEndedIterator, ExactSizeIterator, Iterator, FusedIterator}; +use super::FusedIterator; /// Objects that can be stepped over in both directions. /// diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index a2a019a07dc..da346eaf1db 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -8,14 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use clone::Clone; -use default::Default; use fmt; use marker; -use option::Option::{self, Some, None}; use usize; -use super::{DoubleEndedIterator, IntoIterator, Iterator, ExactSizeIterator, FusedIterator}; +use super::FusedIterator; /// An iterator that repeats an element endlessly. /// diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index 6f80a024681..59e23c4d960 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -8,11 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use option::Option::{self, Some}; -use marker::Sized; - -use super::Iterator; - /// Conversion from an `Iterator`. /// /// By implementing `FromIterator` for a type, you define how it will be diff --git a/src/libcore/iter_private.rs b/src/libcore/iter_private.rs index effe43cc67c..83eeef31ab0 100644 --- a/src/libcore/iter_private.rs +++ b/src/libcore/iter_private.rs @@ -9,8 +9,6 @@ // except according to those terms. -use iter::ExactSizeIterator; - /// An iterator whose items are random accessible efficiently /// /// # Safety diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index fbeddf26b93..1ae4cf8e5ef 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -91,6 +91,11 @@ #![feature(unboxed_closures)] #![feature(question_mark)] #![feature(never_type)] +#![feature(prelude_import)] + +#[prelude_import] +#[allow(unused)] +use prelude::v1::*; #[macro_use] mod macros; diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 894982abaa9..0a46813df7e 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -16,10 +16,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use clone::Clone; use cmp; -use default::Default; -use option::Option; use hash::Hash; use hash::Hasher; @@ -414,8 +411,6 @@ pub struct PhantomData; impls! { PhantomData } mod impls { - use super::{Send, Sync, Sized}; - #[stable(feature = "rust1", since = "1.0.0")] unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {} #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 5c2179ccf33..3526e555b0e 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -15,7 +15,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use marker::Sized; use intrinsics; use ptr; diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index 92bbc4efb7c..47afaf77353 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -13,7 +13,6 @@ reason = "needs an RFC to flesh out the design", issue = "27730")] -use marker::Sized; use ops::{CoerceUnsized, Deref}; /// Unsafe trait to indicate what types are usable with the NonZero struct diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs index a881b539ced..bc503ba3e46 100644 --- a/src/libcore/num/bignum.rs +++ b/src/libcore/num/bignum.rs @@ -27,8 +27,6 @@ issue = "0")] #![macro_use] -use prelude::v1::*; - use mem; use intrinsics; @@ -494,6 +492,5 @@ define_bignum!(Big32x40: type=Digit32, n=40); // this one is used for testing only. #[doc(hidden)] pub mod tests { - use prelude::v1::*; define_bignum!(Big8x3: type=u8, n=3); } diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index 4761727cec0..604bc7c10de 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -10,7 +10,6 @@ //! The various algorithms from the paper. -use prelude::v1::*; use cmp::min; use cmp::Ordering::{Less, Equal, Greater}; use num::diy_float::Fp; @@ -47,7 +46,6 @@ mod fpu_precision { #[cfg(all(target_arch="x86", not(target_feature="sse2")))] mod fpu_precision { use mem::size_of; - use ops::Drop; /// A structure used to preserve the original value of the FPU control word, so that it can be /// restored when the structure is dropped. diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index ff2d85307b1..cd40e399ab9 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -92,7 +92,6 @@ reason = "internal routines only exposed for testing", issue = "0")] -use prelude::v1::*; use fmt; use str::FromStr; diff --git a/src/libcore/num/dec2flt/num.rs b/src/libcore/num/dec2flt/num.rs index 81e7856633b..34b41fa9dec 100644 --- a/src/libcore/num/dec2flt/num.rs +++ b/src/libcore/num/dec2flt/num.rs @@ -12,7 +12,6 @@ // FIXME This module's name is a bit unfortunate, since other modules also import `core::num`. -use prelude::v1::*; use cmp::Ordering::{self, Less, Equal, Greater}; pub use num::bignum::Big32x40 as Big; diff --git a/src/libcore/num/dec2flt/parse.rs b/src/libcore/num/dec2flt/parse.rs index fce1c250a02..d20986faa0f 100644 --- a/src/libcore/num/dec2flt/parse.rs +++ b/src/libcore/num/dec2flt/parse.rs @@ -20,7 +20,6 @@ //! modules rely on to not panic (or overflow) in turn. //! To make matters worse, all that happens in a single pass over the input. //! So, be careful when modifying anything, and double-check with the other modules. -use prelude::v1::*; use super::num; use self::ParseResult::{Valid, ShortcutToInf, ShortcutToZero, Invalid}; diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index 68e4dc4b359..e3b58b6cc7c 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -27,7 +27,6 @@ //! Many functions in this module only handle normal numbers. The dec2flt routines conservatively //! take the universally-correct slow path (Algorithm M) for very small and very large numbers. //! That algorithm needs only next_float() which does handle subnormals and zeros. -use prelude::v1::*; use u32; use cmp::Ordering::{Less, Equal, Greater}; use ops::{Mul, Div, Neg}; diff --git a/src/libcore/num/flt2dec/decoder.rs b/src/libcore/num/flt2dec/decoder.rs index 5420e7bdd2a..276667e44aa 100644 --- a/src/libcore/num/flt2dec/decoder.rs +++ b/src/libcore/num/flt2dec/decoder.rs @@ -10,8 +10,6 @@ //! Decodes a floating-point value into individual parts and error ranges. -use prelude::v1::*; - use {f32, f64}; use num::FpCategory; use num::dec2flt::rawfp::RawFloat; diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index b549f334242..f6c03a59f81 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -130,7 +130,6 @@ functions. reason = "internal routines only exposed for testing", issue = "0")] -use prelude::v1::*; use i16; pub use self::decoder::{decode, DecodableFloat, FullDecoded, Decoded}; diff --git a/src/libcore/num/flt2dec/strategy/dragon.rs b/src/libcore/num/flt2dec/strategy/dragon.rs index 2d68c3a6d02..6aa4f297e75 100644 --- a/src/libcore/num/flt2dec/strategy/dragon.rs +++ b/src/libcore/num/flt2dec/strategy/dragon.rs @@ -15,8 +15,6 @@ Almost direct (but slightly optimized) Rust translation of Figure 3 of [1]. quickly and accurately. SIGPLAN Not. 31, 5 (May. 1996), 108-116. */ -use prelude::v1::*; - use cmp::Ordering; use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up}; diff --git a/src/libcore/num/flt2dec/strategy/grisu.rs b/src/libcore/num/flt2dec/strategy/grisu.rs index 13e01d9a7f7..cf70a1978f5 100644 --- a/src/libcore/num/flt2dec/strategy/grisu.rs +++ b/src/libcore/num/flt2dec/strategy/grisu.rs @@ -16,8 +16,6 @@ Rust adaptation of Grisu3 algorithm described in [1]. It uses about accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243. */ -use prelude::v1::*; - use num::diy_float::Fp; use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up}; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 4636811aa46..29ee29eb3eb 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -12,17 +12,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use char::CharExt; -use cmp::PartialOrd; -use convert::{From, TryFrom}; +use convert::TryFrom; use fmt; use intrinsics; -use marker::{Copy, Sized}; use mem::size_of; -use option::Option::{self, Some, None}; -use result::Result::{self, Ok, Err}; -use str::{FromStr, StrExt}; -use slice::SliceExt; +use str::FromStr; /// Provides intentionally-wrapped arithmetic on `T`. /// diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index c9124249bf5..fd1a7c0827f 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -71,10 +71,8 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cmp::PartialOrd; use fmt; -use marker::{Sized, Unsize}; -use result::Result::{self, Ok, Err}; +use marker::Unsize; /// The `Drop` trait is used to run some code when a value goes out of scope. /// This is sometimes called a 'destructor'. @@ -2184,9 +2182,6 @@ pub trait FnOnce { } mod impls { - use marker::Sized; - use super::{Fn, FnMut, FnOnce}; - #[stable(feature = "rust1", since = "1.0.0")] impl<'a,A,F:?Sized> Fn for &'a F where F : Fn diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 51bbad085fb..cf52849e019 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -139,17 +139,8 @@ #![stable(feature = "rust1", since = "1.0.0")] -use self::Option::*; - -use clone::Clone; -use convert::From; -use default::Default; -use iter::{Iterator, FromIterator, IntoIterator, ExactSizeIterator, DoubleEndedIterator}; -use iter::FusedIterator; +use iter::{FromIterator, FusedIterator}; use mem; -use ops::FnOnce; -use result::Result::{Ok, Err}; -use result::Result; // Note that this is not a lang item per se, but it has a hidden dependency on // `Iterator`, which is one. The compiler assumes that the `next` method of diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 8cb485872b3..f23b407bda4 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -16,17 +16,14 @@ #![stable(feature = "rust1", since = "1.0.0")] -use clone::Clone; use intrinsics; use ops::{CoerceUnsized, Deref}; use fmt; use hash; -use option::Option::{self, Some, None}; -use marker::{Copy, PhantomData, Send, Sized, Sync, Unsize}; +use marker::{PhantomData, Unsize}; use mem; use nonzero::NonZero; -use cmp::{PartialEq, Eq, Ord, PartialOrd}; use cmp::Ordering::{self, Less, Equal, Greater}; // FIXME #19649: intrinsic docs don't render, so these have no docs :( diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 718fdf865a9..49eb5619bc6 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -236,14 +236,8 @@ #![stable(feature = "rust1", since = "1.0.0")] -use self::Result::{Ok, Err}; - -use clone::Clone; use fmt; -use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSizeIterator, IntoIterator}; -use iter::FusedIterator; -use ops::FnOnce; -use option::Option::{self, None, Some}; +use iter::{FromIterator, FusedIterator}; /// `Result` is a type that represents either success (`Ok`) or failure (`Err`). /// diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 603f55a6e10..baa41aa7af5 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -33,24 +33,15 @@ // * The `raw` and `bytes` submodules. // * Boilerplate trait implementations. -use clone::Clone; -use cmp::{Ordering, PartialEq, PartialOrd, Eq, Ord}; -use cmp::Ordering::{Less, Equal, Greater}; +use cmp::Ordering::{self, Less, Equal, Greater}; use cmp; -use convert::AsRef; -use default::Default; use fmt; use intrinsics::assume; use iter::*; -use ops::{FnMut, self}; -use ops::RangeFull; -use option::Option; -use option::Option::{None, Some}; -use result::Result; -use result::Result::{Ok, Err}; +use ops::{self, RangeFull}; use ptr; use mem; -use marker::{Copy, Send, Sync, self}; +use marker; use iter_private::TrustedRandomAccess; #[repr(C)] diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 5dc5880e310..18e43c02c64 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -18,18 +18,10 @@ use self::pattern::Pattern; use self::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher}; use char; -use clone::Clone; -use convert::AsRef; -use default::Default; use fmt; -use iter::ExactSizeIterator; -use iter::{Map, Cloned, Iterator, DoubleEndedIterator, FusedIterator}; -use marker::Sized; +use iter::{Map, Cloned, FusedIterator}; use mem; -use ops::{Fn, FnMut, FnOnce}; -use option::Option::{self, None, Some}; -use result::Result::{self, Ok, Err}; -use slice::{self, SliceExt}; +use slice; pub mod pattern; @@ -1338,11 +1330,9 @@ Section: Trait implementations */ mod traits { - use cmp::{Ord, Ordering, PartialEq, PartialOrd, Eq}; - use option::Option; - use option::Option::Some; + use cmp::Ordering; use ops; - use str::{StrExt, eq_slice}; + use str::eq_slice; #[stable(feature = "rust1", since = "1.0.0")] impl Ord for str { diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 53804c611e6..7dced2ba751 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -17,8 +17,6 @@ reason = "API not fully fleshed out and ready to be stabilized", issue = "27721")] -use prelude::v1::*; - use cmp; use fmt; use usize; diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index bd62879c1a5..75ddd2021a8 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -79,14 +79,8 @@ use self::Ordering::*; -use marker::{Send, Sync}; - use intrinsics; use cell::UnsafeCell; - -use result::Result::{self, Ok, Err}; - -use default::Default; use fmt; /// A boolean type which can be safely shared between threads. diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index abaabfd129b..c3608b60a31 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -10,12 +10,8 @@ // See src/libstd/primitive_docs.rs for documentation. -use clone::Clone; use cmp::*; use cmp::Ordering::*; -use default::Default; -use option::Option; -use option::Option::Some; // FIXME(#19630) Remove this work-around macro_rules! e { From 9a2c8783d91624261317316f996d8d2d09b7b6a4 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Mon, 22 Aug 2016 19:47:38 +0000 Subject: [PATCH 2/3] Use `#[prelude_import]` in `libstd`. --- src/libstd/ascii.rs | 3 --- src/libstd/collections/hash/map.rs | 2 -- src/libstd/collections/hash/set.rs | 2 -- src/libstd/env.rs | 3 --- src/libstd/error.rs | 6 ++---- src/libstd/ffi/c_str.rs | 12 ++---------- src/libstd/ffi/os_str.rs | 4 +--- src/libstd/fs.rs | 2 -- src/libstd/io/buffered.rs | 2 -- src/libstd/io/cursor.rs | 2 -- src/libstd/io/error.rs | 5 ----- src/libstd/io/impls.rs | 4 ---- src/libstd/io/lazy.rs | 2 -- src/libstd/io/mod.rs | 8 -------- src/libstd/io/stdio.rs | 1 - src/libstd/io/util.rs | 2 -- src/libstd/lib.rs | 5 +++++ src/libstd/net/addr.rs | 3 --- src/libstd/net/ip.rs | 1 - src/libstd/net/mod.rs | 2 -- src/libstd/net/parser.rs | 2 -- src/libstd/net/tcp.rs | 3 --- src/libstd/net/test.rs | 2 -- src/libstd/net/udp.rs | 2 -- src/libstd/num/mod.rs | 4 ---- src/libstd/panic.rs | 1 - src/libstd/panicking.rs | 1 - src/libstd/path.rs | 6 +----- src/libstd/process.rs | 2 -- src/libstd/rt.rs | 1 - src/libstd/sync/barrier.rs | 2 -- src/libstd/sync/condvar.rs | 4 ---- src/libstd/sync/mpsc/blocking.rs | 2 -- src/libstd/sync/mpsc/mod.rs | 4 ---- src/libstd/sync/mpsc/mpsc_queue.rs | 2 -- src/libstd/sync/mpsc/select.rs | 2 -- src/libstd/sync/mpsc/spsc_queue.rs | 2 -- src/libstd/sync/mpsc/sync.rs | 1 - src/libstd/sync/mutex.rs | 4 ---- src/libstd/sync/once.rs | 2 -- src/libstd/sync/rwlock.rs | 6 ------ src/libstd/sys/common/args.rs | 6 ------ src/libstd/sys/common/at_exit_imp.rs | 2 -- src/libstd/sys/common/backtrace.rs | 1 - src/libstd/sys/common/io.rs | 3 --- src/libstd/sys/common/mod.rs | 1 - src/libstd/sys/common/mutex.rs | 1 - src/libstd/sys/common/net.rs | 4 ---- src/libstd/sys/common/remutex.rs | 3 --- src/libstd/sys/common/thread.rs | 2 -- src/libstd/sys/common/thread_info.rs | 1 - src/libstd/sys/common/thread_local.rs | 1 - src/libstd/sys/common/wtf8.rs | 3 --- src/libstd/sys/unix/ext/ffi.rs | 1 - src/libstd/sys/unix/ext/net.rs | 2 -- src/libstd/sys/unix/ext/process.rs | 2 -- src/libstd/sys/unix/fd.rs | 2 -- src/libstd/sys/unix/fs.rs | 2 -- src/libstd/sys/unix/net.rs | 2 -- src/libstd/sys/unix/os.rs | 1 - src/libstd/sys/unix/os_str.rs | 2 -- src/libstd/sys/unix/pipe.rs | 2 -- src/libstd/sys/unix/process.rs | 2 -- src/libstd/sys/unix/stdio.rs | 2 -- src/libstd/sys/unix/thread.rs | 4 ---- src/libstd/sys/windows/compat.rs | 2 -- src/libstd/sys/windows/dynamic_lib.rs | 1 - src/libstd/sys/windows/fs.rs | 1 - src/libstd/sys/windows/handle.rs | 2 -- src/libstd/sys/windows/mod.rs | 2 -- src/libstd/sys/windows/mutex.rs | 2 -- src/libstd/sys/windows/net.rs | 2 -- src/libstd/sys/windows/os.rs | 1 - src/libstd/sys/windows/os_str.rs | 3 --- src/libstd/sys/windows/pipe.rs | 1 - src/libstd/sys/windows/process.rs | 3 --- src/libstd/sys/windows/stdio.rs | 1 - src/libstd/sys/windows/thread.rs | 2 -- src/libstd/sys/windows/thread_local.rs | 2 -- src/libstd/thread/local.rs | 7 ------- src/libstd/thread/mod.rs | 6 ------ 81 files changed, 11 insertions(+), 205 deletions(-) diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 070d7ca1eef..a063b856468 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -12,8 +12,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use prelude::v1::*; - use mem; use ops::Range; use iter::FusedIterator; @@ -454,7 +452,6 @@ static ASCII_UPPERCASE_MAP: [u8; 256] = [ #[cfg(test)] mod tests { - use prelude::v1::*; use super::*; use char::from_u32; diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ba27fafa59a..14da36ca483 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -2059,8 +2059,6 @@ fn assert_covariance() { #[cfg(test)] mod test_map { - use prelude::v1::*; - use super::HashMap; use super::Entry::{Occupied, Vacant}; use cell::RefCell; diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 96efff86abf..ca5137e9573 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1067,8 +1067,6 @@ fn assert_covariance() { #[cfg(test)] mod test_set { - use prelude::v1::*; - use super::HashSet; #[test] diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 753411991ab..7a94c396218 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -16,8 +16,6 @@ #![stable(feature = "env", since = "1.0.0")] -use prelude::v1::*; - use error::Error; use ffi::{OsStr, OsString}; use fmt; @@ -950,7 +948,6 @@ mod arch { #[cfg(test)] mod tests { - use prelude::v1::*; use super::*; use iter::repeat; diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 914599271ac..44595361fb5 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -48,16 +48,15 @@ // reconsider what crate these items belong in. use any::TypeId; -use boxed::Box; use cell; use char; use fmt::{self, Debug, Display}; -use marker::{Send, Sync, Reflect}; +use marker::Reflect; use mem::transmute; use num; use raw::TraitObject; use str; -use string::{self, String}; +use string; /// Base functionality for all errors in Rust. #[stable(feature = "rust1", since = "1.0.0")] @@ -454,7 +453,6 @@ impl Error + Send + Sync { #[cfg(test)] mod tests { - use prelude::v1::*; use super::Error; use fmt; diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 5dae1a09bf4..38222c014f6 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -9,25 +9,18 @@ // except according to those terms. use ascii; -use borrow::{Cow, ToOwned, Borrow}; -use boxed::Box; -use convert::{Into, From}; -use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; +use borrow::{Cow, Borrow}; +use cmp::Ordering; use error::Error; use fmt::{self, Write}; use io; -use iter::Iterator; use libc; use mem; use memchr; use ops; -use option::Option::{self, Some, None}; use os::raw::c_char; -use result::Result::{self, Ok, Err}; use slice; use str::{self, Utf8Error}; -use string::String; -use vec::Vec; /// A type representing an owned C-compatible string /// @@ -700,7 +693,6 @@ impl AsRef for CString { #[cfg(test)] mod tests { - use prelude::v1::*; use super::*; use os::raw::c_char; use borrow::Cow::{Borrowed, Owned}; diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 3d23a9a2383..36cf4ef758d 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -8,14 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use borrow::{Borrow, Cow, ToOwned}; +use borrow::{Borrow, Cow}; use fmt::{self, Debug}; use mem; -use string::String; use ops; use cmp; use hash::{Hash, Hasher}; -use vec::Vec; use sys::os_str::{Buf, Slice}; use sys_common::{AsInner, IntoInner, FromInner}; diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index b78db24e44b..f2374e722c1 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -23,7 +23,6 @@ use io::{self, SeekFrom, Seek, Read, Write}; use path::{Path, PathBuf}; use sys::fs as fs_imp; use sys_common::{AsInnerMut, FromInner, AsInner, IntoInner}; -use vec::Vec; use time::SystemTime; /// A reference to an open file on the filesystem. @@ -1677,7 +1676,6 @@ impl AsInnerMut for DirBuilder { #[cfg(test)] mod tests { - use prelude::v1::*; use io::prelude::*; use fs::{self, File, OpenOptions}; diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index a92ca95f4ee..a26a932ad2d 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -10,7 +10,6 @@ //! Buffering wrappers for I/O traits -use prelude::v1::*; use io::prelude::*; use marker::Reflect; @@ -788,7 +787,6 @@ impl fmt::Debug for LineWriter where W: fmt::Debug { #[cfg(test)] mod tests { - use prelude::v1::*; use io::prelude::*; use io::{self, BufReader, BufWriter, LineWriter, SeekFrom}; use sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 2d780559db1..1b836b74537 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use io::prelude::*; use cmp; @@ -284,7 +283,6 @@ impl Write for Cursor> { mod tests { use io::prelude::*; use io::{Cursor, SeekFrom}; - use vec::Vec; #[test] fn test_vec_writer() { diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 5333b0a531e..d90be2e08a9 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -8,12 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use boxed::Box; -use convert::Into; use error; use fmt; -use marker::{Send, Sync}; -use option::Option::{self, Some, None}; use result; use sys; @@ -522,7 +518,6 @@ fn _assert_error_is_sync_send() { #[cfg(test)] mod test { - use prelude::v1::*; use super::{Error, ErrorKind}; use error; use fmt; diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index 31799381563..cd05e6b5de9 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -8,13 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use boxed::Box; use cmp; use io::{self, SeekFrom, Read, Write, Seek, BufRead, Error, ErrorKind}; use fmt; use mem; -use string::String; -use vec::Vec; // ============================================================================= // Forwarding implementations @@ -228,7 +225,6 @@ impl Write for Vec { #[cfg(test)] mod tests { use io::prelude::*; - use vec::Vec; use test; #[bench] diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs index 11551601207..ce205c3b11c 100644 --- a/src/libstd/io/lazy.rs +++ b/src/libstd/io/lazy.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use cell::Cell; use ptr; use sync::Arc; diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 307d014fd68..1053792cd43 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -253,15 +253,8 @@ use cmp; use rustc_unicode::str as core_str; use error as std_error; use fmt; -use iter::{Iterator}; -use marker::Sized; -use ops::{Drop, FnOnce}; -use option::Option::{self, Some, None}; -use result::Result::{Ok, Err}; use result; -use string::String; use str; -use vec::Vec; use memchr; #[stable(feature = "rust1", since = "1.0.0")] @@ -1734,7 +1727,6 @@ impl Iterator for Lines { #[cfg(test)] mod tests { - use prelude::v1::*; use io::prelude::*; use io; use super::Cursor; diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index b8b66a58359..9a782e95f6e 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use io::prelude::*; use cell::{RefCell, BorrowState}; diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index c8b52fc0467..2c6880281b5 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -167,8 +167,6 @@ impl Write for Sink { #[cfg(test)] mod tests { - use prelude::v1::*; - use io::prelude::*; use io::{copy, sink, empty, repeat}; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index d4644a190f4..9a8cd0c712f 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -252,6 +252,7 @@ #![feature(optin_builtin_traits)] #![feature(panic_unwind)] #![feature(placement_in_syntax)] +#![feature(prelude_import)] #![feature(question_mark)] #![feature(rand)] #![feature(raw)] @@ -292,6 +293,10 @@ #![allow(unused_features)] // std may use features in a platform-specific way #![cfg_attr(not(stage0), deny(warnings))] +#[prelude_import] +#[allow(unused)] +use prelude::v1::*; + #[cfg(test)] extern crate test; // We want to reexport a few macros from core but libcore has already been diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index b93ca8277e6..d0b59b42c17 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use fmt; use hash; use io; @@ -523,7 +521,6 @@ impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T { #[cfg(test)] mod tests { - use prelude::v1::*; use net::*; use net::test::{tsa, sa6, sa4}; diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 4c3b993497c..c6a7a77e68a 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -653,7 +653,6 @@ impl From<[u8; 16]> for Ipv6Addr { // Tests for this module #[cfg(test)] mod tests { - use prelude::v1::*; use net::*; use net::Ipv6MulticastScope::*; use net::test::{tsa, sa6, sa4}; diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index 11a16b27113..2a78afa85f7 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -12,8 +12,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use prelude::v1::*; - use io::{self, Error, ErrorKind}; use sys_common::net as net_imp; diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 5851ce7135d..854d87c4cbe 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -13,8 +13,6 @@ //! This module is "publicly exported" through the `FromStr` implementations //! below. -use prelude::v1::*; - use error::Error; use fmt; use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 76617f15970..dcd3652af87 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use io::prelude::*; use fmt; @@ -438,8 +437,6 @@ impl fmt::Debug for TcpListener { #[cfg(test)] mod tests { - use prelude::v1::*; - use io::ErrorKind; use io::prelude::*; use net::*; diff --git a/src/libstd/net/test.rs b/src/libstd/net/test.rs index 9665fd72287..98ac61f6461 100644 --- a/src/libstd/net/test.rs +++ b/src/libstd/net/test.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use env; use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; use sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index 9d0279deb1b..781f026c12c 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -355,8 +355,6 @@ impl fmt::Debug for UdpSocket { #[cfg(test)] mod tests { - use prelude::v1::*; - use io::ErrorKind; use net::*; use net::test::{next_test_ip4, next_test_ip6}; diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 20804d62dfa..d1c2fc3d3fc 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -24,9 +24,7 @@ pub use core::num::{FpCategory, ParseIntError, ParseFloatError, TryFromIntError} #[stable(feature = "rust1", since = "1.0.0")] pub use core::num::Wrapping; -#[cfg(test)] use cmp::PartialEq; #[cfg(test)] use fmt; -#[cfg(test)] use marker::Copy; #[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem}; /// Helper function for testing numeric operations @@ -52,7 +50,6 @@ mod tests { use u32; use u64; use usize; - use string::ToString; use ops::Mul; #[test] @@ -287,7 +284,6 @@ mod tests { mod bench { extern crate test; use self::test::Bencher; - use prelude::v1::*; #[bench] fn bench_pow_function(b: &mut Bencher) { diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index 2f67081e0d7..47f594a9b0c 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -13,7 +13,6 @@ #![stable(feature = "std_panic", since = "1.9.0")] use any::Any; -use boxed::Box; use cell::UnsafeCell; use ops::{Deref, DerefMut}; use panicking; diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 5961fd59699..0c10dcbdad6 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -17,7 +17,6 @@ //! * Executing a panic up to doing the actual implementation //! * Shims around "try" -use prelude::v1::*; use io::prelude::*; use any::Any; diff --git a/src/libstd/path.rs b/src/libstd/path.rs index bc8fd66a438..67219b6fd1b 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -100,7 +100,7 @@ #![stable(feature = "rust1", since = "1.0.0")] use ascii::*; -use borrow::{Borrow, ToOwned, Cow}; +use borrow::{Borrow, Cow}; use cmp; use error::Error; use fmt; @@ -110,8 +110,6 @@ use io; use iter::{self, FusedIterator}; use mem; use ops::{self, Deref}; -use string::String; -use vec::Vec; use ffi::{OsStr, OsString}; @@ -2152,8 +2150,6 @@ impl Error for StripPrefixError { #[cfg(test)] mod tests { use super::*; - use string::{ToString, String}; - use vec::Vec; macro_rules! t( ($path:expr, iter: $iter:expr) => ( diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 660c098d30b..f0c44430700 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -12,7 +12,6 @@ #![stable(feature = "process", since = "1.0.0")] -use prelude::v1::*; use io::prelude::*; use ffi::OsStr; @@ -810,7 +809,6 @@ pub fn exit(code: i32) -> ! { #[cfg(test)] mod tests { - use prelude::v1::*; use io::prelude::*; use io::ErrorKind; diff --git a/src/libstd/rt.rs b/src/libstd/rt.rs index a3d9e4db7d1..e3de1efaa31 100644 --- a/src/libstd/rt.rs +++ b/src/libstd/rt.rs @@ -30,7 +30,6 @@ pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count}; #[cfg(not(test))] #[lang = "start"] fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize { - use borrow::ToOwned; use mem; use panic; use sys; diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index b1267acdee6..ac0f400379e 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -113,8 +113,6 @@ impl BarrierWaitResult { #[cfg(test)] mod tests { - use prelude::v1::*; - use sync::{Arc, Barrier}; use sync::mpsc::{channel, TryRecvError}; use thread; diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 3c52ebc72f2..1f480f6d4a9 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use sync::atomic::{AtomicUsize, Ordering}; use sync::{mutex, MutexGuard, PoisonError}; use sys_common::condvar as sys; @@ -245,8 +243,6 @@ impl Drop for Condvar { #[cfg(test)] mod tests { - use prelude::v1::*; - use sync::mpsc::channel; use sync::{Condvar, Mutex, Arc}; use thread; diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs index 4a70de0e7d8..0f9ef6fabb0 100644 --- a/src/libstd/sync/mpsc/blocking.rs +++ b/src/libstd/sync/mpsc/blocking.rs @@ -13,9 +13,7 @@ use thread::{self, Thread}; use sync::atomic::{AtomicBool, Ordering}; use sync::Arc; -use marker::{Sync, Send}; use mem; -use clone::Clone; use time::Instant; struct Inner { diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index d8b8c6a77a2..3d9f81413dc 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1270,8 +1270,6 @@ impl error::Error for TryRecvError { #[cfg(test)] mod tests { - use prelude::v1::*; - use env; use super::*; use thread; @@ -1946,8 +1944,6 @@ mod tests { #[cfg(test)] mod sync_tests { - use prelude::v1::*; - use env; use thread; use super::*; diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 6a6c19cfcc3..d926043fbbc 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -148,8 +148,6 @@ impl Drop for Queue { #[cfg(test)] mod tests { - use prelude::v1::*; - use sync::mpsc::channel; use super::{Queue, Data, Empty, Inconsistent}; use sync::Arc; diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 5aa4ce81b8a..677544d335e 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -369,8 +369,6 @@ impl<'rx, T:Send+'rx> fmt::Debug for Handle<'rx, T> { #[cfg(test)] #[allow(unused_imports)] mod tests { - use prelude::v1::*; - use thread; use sync::mpsc::*; diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index 02506e7c2f3..724d7b1be73 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -233,8 +233,6 @@ impl Drop for Queue { #[cfg(test)] mod tests { - use prelude::v1::*; - use sync::Arc; use super::Queue; use thread; diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index 9d13a71ff95..9985daaba8f 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -36,7 +36,6 @@ pub use self::Failure::*; use self::Blocker::*; -use vec::Vec; use core::mem; use core::ptr; diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 6bc458397f1..c8ae88c2331 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use cell::UnsafeCell; use fmt; use marker; @@ -355,8 +353,6 @@ pub fn guard_poison<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a poison::Fla #[cfg(test)] mod tests { - use prelude::v1::*; - use sync::mpsc::channel; use sync::{Arc, Mutex, Condvar}; use sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 54c1fe6c564..86d2986959c 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -369,8 +369,6 @@ impl OnceState { #[cfg(test)] mod tests { - use prelude::v1::*; - use panic; use sync::mpsc::channel; use thread; diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 65b5686de86..4801bcffd08 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use cell::UnsafeCell; use fmt; use marker; @@ -385,8 +383,6 @@ impl<'a, T: ?Sized> Drop for RwLockWriteGuard<'a, T> { mod tests { #![allow(deprecated)] // rand - use prelude::v1::*; - use rand::{self, Rng}; use sync::mpsc::channel; use thread; @@ -552,8 +548,6 @@ mod tests { #[test] fn test_rwlock_try_write() { - use mem::drop; - let lock = RwLock::new(0isize); let read_guard = lock.read().unwrap(); diff --git a/src/libstd/sys/common/args.rs b/src/libstd/sys/common/args.rs index e877391fb8b..fad2c277da4 100644 --- a/src/libstd/sys/common/args.rs +++ b/src/libstd/sys/common/args.rs @@ -21,8 +21,6 @@ #![allow(dead_code)] // different code on OSX/linux/etc -use vec::Vec; - /// One-time global initialization. pub unsafe fn init(argc: isize, argv: *const *const u8) { imp::init(argc, argv) } @@ -42,8 +40,6 @@ pub fn clone() -> Option>> { imp::clone() } target_os = "solaris", target_os = "emscripten"))] mod imp { - use prelude::v1::*; - use libc::c_char; use mem; use ffi::CStr; @@ -91,8 +87,6 @@ mod imp { target_os = "ios", target_os = "windows"))] mod imp { - use vec::Vec; - pub unsafe fn init(_argc: isize, _argv: *const *const u8) { } diff --git a/src/libstd/sys/common/at_exit_imp.rs b/src/libstd/sys/common/at_exit_imp.rs index b2683750d67..ce6fd4cb075 100644 --- a/src/libstd/sys/common/at_exit_imp.rs +++ b/src/libstd/sys/common/at_exit_imp.rs @@ -13,10 +13,8 @@ //! Documentation can be found on the `rt::at_exit` function. use alloc::boxed::FnBox; -use boxed::Box; use ptr; use sys_common::mutex::Mutex; -use vec::Vec; type Queue = Vec>; diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs index 4c23ceb63f2..c1d1792363d 100644 --- a/src/libstd/sys/common/backtrace.rs +++ b/src/libstd/sys/common/backtrace.rs @@ -191,7 +191,6 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> { #[cfg(test)] mod tests { - use prelude::v1::*; use sys_common; macro_rules! t { ($a:expr, $b:expr) => ({ let mut m = Vec::new(); diff --git a/src/libstd/sys/common/io.rs b/src/libstd/sys/common/io.rs index 7b08852ba51..3cd70eddb85 100644 --- a/src/libstd/sys/common/io.rs +++ b/src/libstd/sys/common/io.rs @@ -7,7 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use io; use io::ErrorKind; use io::Read; @@ -53,7 +52,6 @@ pub unsafe fn read_to_end_uninitialized(r: &mut Read, buf: &mut Vec) -> io:: #[cfg(test)] pub mod test { - use prelude::v1::*; use path::{Path, PathBuf}; use env; use rand::{self, Rng}; @@ -93,7 +91,6 @@ pub mod test { #[cfg(test)] mod tests { - use prelude::v1::*; use io::prelude::*; use super::*; use io; diff --git a/src/libstd/sys/common/mod.rs b/src/libstd/sys/common/mod.rs index a1f3f477b3a..d1ca6765107 100644 --- a/src/libstd/sys/common/mod.rs +++ b/src/libstd/sys/common/mod.rs @@ -10,7 +10,6 @@ #![allow(missing_docs)] -use boxed::Box; use sync::Once; use sys; diff --git a/src/libstd/sys/common/mutex.rs b/src/libstd/sys/common/mutex.rs index 7a2183c522f..d1a738770d3 100644 --- a/src/libstd/sys/common/mutex.rs +++ b/src/libstd/sys/common/mutex.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use marker::Sync; use sys::mutex as imp; /// An OS-based mutual exclusion lock. diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 442618c55b3..a777cfe35e5 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use cmp; use ffi::CString; use fmt; @@ -608,8 +606,6 @@ impl fmt::Debug for UdpSocket { #[cfg(test)] mod tests { - use prelude::v1::*; - use super::*; use collections::HashMap; diff --git a/src/libstd/sys/common/remutex.rs b/src/libstd/sys/common/remutex.rs index 39d41042467..cbdeaad7f6b 100644 --- a/src/libstd/sys/common/remutex.rs +++ b/src/libstd/sys/common/remutex.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use fmt; use marker; use ops::Deref; @@ -160,7 +158,6 @@ impl<'a, T> Drop for ReentrantMutexGuard<'a, T> { #[cfg(test)] mod tests { - use prelude::v1::*; use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; use cell::RefCell; use sync::Arc; diff --git a/src/libstd/sys/common/thread.rs b/src/libstd/sys/common/thread.rs index 16f4f01bf39..3ee160da5fa 100644 --- a/src/libstd/sys/common/thread.rs +++ b/src/libstd/sys/common/thread.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use alloc::boxed::FnBox; use libc; use sys::stack_overflow; diff --git a/src/libstd/sys/common/thread_info.rs b/src/libstd/sys/common/thread_info.rs index 0467c67167b..95d8b6cc951 100644 --- a/src/libstd/sys/common/thread_info.rs +++ b/src/libstd/sys/common/thread_info.rs @@ -11,7 +11,6 @@ #![allow(dead_code)] // stack_guard isn't used right now on all platforms use cell::RefCell; -use string::String; use thread::Thread; use thread::LocalKeyState; diff --git a/src/libstd/sys/common/thread_local.rs b/src/libstd/sys/common/thread_local.rs index 56885cdd56d..25a9d5720d9 100644 --- a/src/libstd/sys/common/thread_local.rs +++ b/src/libstd/sys/common/thread_local.rs @@ -233,7 +233,6 @@ impl Drop for Key { #[cfg(test)] mod tests { - use prelude::v1::*; use super::{Key, StaticKey}; fn assert_sync() {} diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index c1b4f8a8c88..8d357aa78c9 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -37,9 +37,7 @@ use mem; use ops; use slice; use str; -use string::String; use sys_common::AsInner; -use vec::Vec; const UTF8_REPLACEMENT_CHARACTER: &'static [u8] = b"\xEF\xBF\xBD"; @@ -807,7 +805,6 @@ impl AsciiExt for Wtf8 { #[cfg(test)] mod tests { - use prelude::v1::*; use borrow::Cow; use super::*; diff --git a/src/libstd/sys/unix/ext/ffi.rs b/src/libstd/sys/unix/ext/ffi.rs index 825e74cabde..d59b4fc0b70 100644 --- a/src/libstd/sys/unix/ext/ffi.rs +++ b/src/libstd/sys/unix/ext/ffi.rs @@ -14,7 +14,6 @@ use ffi::{OsStr, OsString}; use mem; -use prelude::v1::*; use sys::os_str::Buf; use sys_common::{FromInner, IntoInner, AsInner}; diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index a4564b9543b..3f93fce1935 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -14,7 +14,6 @@ use libc; -use prelude::v1::*; use ascii; use ffi::OsStr; use fmt; @@ -789,7 +788,6 @@ impl IntoRawFd for UnixDatagram { #[cfg(test)] mod test { - use prelude::v1::*; use thread; use io; use io::prelude::*; diff --git a/src/libstd/sys/unix/ext/process.rs b/src/libstd/sys/unix/ext/process.rs index dd70ba2e490..5bd92f2eb57 100644 --- a/src/libstd/sys/unix/ext/process.rs +++ b/src/libstd/sys/unix/ext/process.rs @@ -12,8 +12,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use prelude::v1::*; - use io; use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; use process; diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index b99f4a2eacd..b2b1f16f20a 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -10,8 +10,6 @@ #![unstable(reason = "not public", issue = "0", feature = "fd")] -use prelude::v1::*; - use io::{self, Read}; use libc::{self, c_int, size_t, c_void}; use mem; diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 3b132744f70..e6fe3eb112a 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use os::unix::prelude::*; use ffi::{CString, CStr, OsString, OsStr}; @@ -534,7 +533,6 @@ impl fmt::Debug for File { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { #[cfg(target_os = "linux")] fn get_path(fd: c_int) -> Option { - use string::ToString; let mut p = PathBuf::from("/proc/self/fd"); p.push(&fd.to_string()); readlink(&p).ok() diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index 6f1b70acb60..3f77abd7f44 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use ffi::CStr; use io; use libc::{self, c_int, size_t, sockaddr, socklen_t}; diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index c29e87f91c9..e61804efd50 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -12,7 +12,6 @@ #![allow(unused_imports)] // lots of cfg code here -use prelude::v1::*; use os::unix::prelude::*; use error::Error as StdError; diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index d5eea5d1f3b..5a733c0cb87 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -13,9 +13,7 @@ use borrow::Cow; use fmt::{self, Debug}; -use vec::Vec; use str; -use string::String; use mem; use sys_common::{AsInner, IntoInner}; diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index 01059413338..ffe8032e460 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use cmp; use io; use libc::{self, c_int}; diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index d68867fb3d2..50014f51f6c 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use os::unix::prelude::*; use collections::hash_map::{HashMap, Entry}; @@ -593,7 +592,6 @@ impl Process { #[cfg(test)] mod tests { use super::*; - use prelude::v1::*; use ffi::OsStr; use mem; diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs index 37d1d9a969e..972bdbc3818 100644 --- a/src/libstd/sys/unix/stdio.rs +++ b/src/libstd/sys/unix/stdio.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use io; use libc; use sys::fd::FileDesc; diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 75e10d25853..5db7086e427 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use alloc::boxed::FnBox; use cmp; use ffi::CStr; @@ -193,8 +191,6 @@ pub mod guard { target_os = "solaris"))] #[cfg_attr(test, allow(dead_code))] pub mod guard { - use prelude::v1::*; - use libc; use libc::mmap; use libc::{PROT_NONE, MAP_PRIVATE, MAP_ANON, MAP_FAILED, MAP_FIXED}; diff --git a/src/libstd/sys/windows/compat.rs b/src/libstd/sys/windows/compat.rs index acbfacce8bd..cd42b7d05ee 100644 --- a/src/libstd/sys/windows/compat.rs +++ b/src/libstd/sys/windows/compat.rs @@ -21,8 +21,6 @@ //! manner we pay a semi-large one-time cost up front for detecting whether a //! function is available but afterwards it's just a load and a jump. -use prelude::v1::*; - use ffi::CString; use sync::atomic::{AtomicUsize, Ordering}; use sys::c; diff --git a/src/libstd/sys/windows/dynamic_lib.rs b/src/libstd/sys/windows/dynamic_lib.rs index dde13ec8364..5227280808f 100644 --- a/src/libstd/sys/windows/dynamic_lib.rs +++ b/src/libstd/sys/windows/dynamic_lib.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use os::windows::prelude::*; use ffi::{CString, OsStr}; diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 4e6cef9a28d..fe448cdd78f 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use os::windows::prelude::*; use ffi::OsString; diff --git a/src/libstd/sys/windows/handle.rs b/src/libstd/sys/windows/handle.rs index d10abae2865..97e746ee345 100644 --- a/src/libstd/sys/windows/handle.rs +++ b/src/libstd/sys/windows/handle.rs @@ -10,8 +10,6 @@ #![unstable(issue = "0", feature = "windows_handle")] -use prelude::v1::*; - use cmp; use io::{ErrorKind, Read}; use io; diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index 12219c1e9d4..9741a704e8f 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -10,8 +10,6 @@ #![allow(missing_docs, bad_style)] -use prelude::v1::*; - use ffi::{OsStr, OsString}; use io::{self, ErrorKind}; use os::windows::ffi::{OsStrExt, OsStringExt}; diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index 8762b34e3da..85560368590 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -29,8 +29,6 @@ //! CriticalSection is used and we keep track of who's holding the mutex to //! detect recursive locks. -use prelude::v1::*; - use cell::UnsafeCell; use mem; use sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index 71e164f012f..aca6994503f 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -10,8 +10,6 @@ #![unstable(issue = "0", feature = "windows_net")] -use prelude::v1::*; - use cmp; use io::{self, Read}; use libc::{c_int, c_void, c_ulong}; diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 0cea7f81e36..260fc3c4db6 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -12,7 +12,6 @@ #![allow(bad_style)] -use prelude::v1::*; use os::windows::prelude::*; use error::Error as StdError; diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index 26767a1349e..a065c7a7fd0 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -14,9 +14,6 @@ use borrow::Cow; use fmt::{self, Debug}; use sys_common::wtf8::{Wtf8, Wtf8Buf}; -use string::String; -use result::Result; -use option::Option; use mem; use sys_common::{AsInner, IntoInner}; diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index 6e9c67051a6..ed7e88e72cd 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; use os::windows::prelude::*; use ffi::OsStr; diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 3ca75cf3643..d371714ff0e 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use ascii::*; use collections::HashMap; use collections; @@ -491,7 +489,6 @@ fn make_dirp(d: Option<&OsString>) -> io::Result<(*const u16, Vec)> { #[cfg(test)] mod tests { - use prelude::v1::*; use ffi::{OsStr, OsString}; use super::make_command_line; diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index fa3cab2191e..01249f05f62 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -10,7 +10,6 @@ #![unstable(issue = "0", feature = "windows_stdio")] -use prelude::v1::*; use io::prelude::*; use cmp; diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 0383e92c79e..5a376a867ee 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use alloc::boxed::FnBox; use io; use ffi::CStr; diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 59da74b7287..5d3084094fb 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::v1::*; - use ptr; use sys::c; use sys_common::mutex::Mutex; diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 152b9771086..c44dee49f14 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -369,7 +369,6 @@ pub mod elf { // Due to rust-lang/rust#18804, make sure this is not generic! #[cfg(target_os = "linux")] unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { - use prelude::v1::*; use mem; use libc; use sys_common::thread_local as os; @@ -460,8 +459,6 @@ pub mod elf { #[doc(hidden)] pub mod os { - use prelude::v1::*; - use cell::{Cell, UnsafeCell}; use marker; use ptr; @@ -529,8 +526,6 @@ pub mod os { #[cfg(test)] mod tests { - use prelude::v1::*; - use sync::mpsc::{channel, Sender}; use cell::{Cell, UnsafeCell}; use super::LocalKeyState; @@ -693,8 +688,6 @@ mod tests { #[cfg(test)] mod dynamic_tests { - use prelude::v1::*; - use cell::RefCell; use collections::HashMap; diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index f06c105d30e..f3e1710f50b 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -161,8 +161,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use prelude::v1::*; - use any::Any; use cell::UnsafeCell; use ffi::{CStr, CString}; @@ -732,8 +730,6 @@ fn _assert_sync_and_send() { #[cfg(test)] mod tests { - use prelude::v1::*; - use any::Any; use sync::mpsc::{channel, Sender}; use result; @@ -786,8 +782,6 @@ mod tests { #[test] fn test_spawn_sched() { - use clone::Clone; - let (tx, rx) = channel(); fn f(i: i32, tx: Sender<()>) { From a9a2979dbaddc540673cf66da52e8eb45e66b055 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Mon, 22 Aug 2016 20:16:36 +0000 Subject: [PATCH 3/3] Remove needless imports in `libcollections`. --- src/libcollections/binary_heap.rs | 2 +- src/libcollections/borrow.rs | 7 +------ src/libcollections/linked_list.rs | 4 ---- src/libcollections/range.rs | 1 - src/libcollections/vec_deque.rs | 3 --- 5 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index c062ae62b00..5ece27372e1 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -151,7 +151,7 @@ #![allow(missing_docs)] #![stable(feature = "rust1", since = "1.0.0")] -use core::ops::{Drop, Deref, DerefMut}; +use core::ops::{Deref, DerefMut}; use core::iter::{FromIterator, FusedIterator}; use core::mem::swap; use core::mem::size_of; diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 37dbeb4eae1..3ad1d082985 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -12,14 +12,9 @@ #![stable(feature = "rust1", since = "1.0.0")] -use core::clone::Clone; -use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; -use core::convert::AsRef; -use core::default::Default; +use core::cmp::Ordering; use core::hash::{Hash, Hasher}; -use core::marker::Sized; use core::ops::Deref; -use core::option::Option; use fmt; diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 8b8bea0ca45..769c5162a45 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -1159,9 +1159,6 @@ unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {} #[cfg(test)] mod tests { - use std::clone::Clone; - use std::iter::{Iterator, IntoIterator, Extend}; - use std::option::Option::{self, Some, None}; use std::__rand::{thread_rng, Rng}; use std::thread; use std::vec::Vec; @@ -1319,7 +1316,6 @@ mod tests { #[test] fn test_26021() { - use std::iter::ExactSizeIterator; // There was a bug in split_off that failed to null out the RHS's head's prev ptr. // This caused the RHS's dtor to walk up into the LHS at drop and delete all of // its nodes. diff --git a/src/libcollections/range.rs b/src/libcollections/range.rs index 1badc72aed0..d331ead2c5e 100644 --- a/src/libcollections/range.rs +++ b/src/libcollections/range.rs @@ -14,7 +14,6 @@ //! Range syntax. -use core::option::Option::{self, None, Some}; use core::ops::{RangeFull, Range, RangeTo, RangeFrom}; /// **RangeArgument** is implemented by Rust's built-in range types, produced diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 6f220c1d472..96624f121b2 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -2332,9 +2332,6 @@ impl From> for Vec { #[cfg(test)] mod tests { - use core::iter::Iterator; - use core::option::Option::Some; - use test; use super::VecDeque;