Skip to content

Commit

Permalink
Auto merge of #35906 - jseyfried:local_prelude, r=eddyb
Browse files Browse the repository at this point in the history
Use `#[prelude_import]` in `libcore` and `libstd`

r? @eddyb
  • Loading branch information
bors authored Aug 26, 2016
2 parents e07dd59 + a9a2979 commit eaf71f8
Show file tree
Hide file tree
Showing 132 changed files with 43 additions and 403 deletions.
2 changes: 1 addition & 1 deletion src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 0 additions & 4 deletions src/libcollections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/libcollections/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2332,9 +2332,6 @@ impl<T> From<VecDeque<T>> for Vec<T> {

#[cfg(test)]
mod tests {
use core::iter::Iterator;
use core::option::Option::Some;

use test;

use super::VecDeque;
Expand Down
4 changes: 1 addition & 3 deletions src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 3 additions & 8 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 3 additions & 10 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/char_private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
///
Expand Down Expand Up @@ -571,11 +568,7 @@ pub fn max<T: Ord>(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)*) => ($(
Expand Down
3 changes: 0 additions & 3 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/libcore/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
5 changes: 0 additions & 5 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

// FIXME: #6220 Implement floating point formatting

use prelude::v1::*;

use fmt;
use num::Zero;
use ops::{Div, Rem, Sub};
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@

#![stable(feature = "rust1", since = "1.0.0")]

use prelude::v1::*;

use fmt;
use marker;
use mem;
Expand Down Expand Up @@ -288,8 +286,6 @@ impl<H> Default for BuildHasherDefault<H> {
//////////////////////////////////////////////////////////////////////////////

mod impls {
use prelude::v1::*;

use mem;
use slice;
use super::*;
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

//! An implementation of SipHash.

use prelude::v1::*;

use marker::PhantomData;
use ptr;

Expand Down
2 changes: 0 additions & 2 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 2 additions & 9 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item=()>) {}

Expand Down
4 changes: 0 additions & 4 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
6 changes: 1 addition & 5 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
5 changes: 1 addition & 4 deletions src/libcore/iter/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
5 changes: 0 additions & 5 deletions src/libcore/iter/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/iter_private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.


use iter::ExactSizeIterator;

/// An iterator whose items are random accessible efficiently
///
/// # Safety
Expand Down
5 changes: 5 additions & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -414,8 +411,6 @@ pub struct PhantomData<T:?Sized>;
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")]
Expand Down
Loading

0 comments on commit eaf71f8

Please sign in to comment.