Skip to content

Commit eaf71f8

Browse files
authored
Auto merge of #35906 - jseyfried:local_prelude, r=eddyb
Use `#[prelude_import]` in `libcore` and `libstd` r? @eddyb
2 parents e07dd59 + a9a2979 commit eaf71f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+43
-403
lines changed

Diff for: src/libcollections/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
#![allow(missing_docs)]
152152
#![stable(feature = "rust1", since = "1.0.0")]
153153

154-
use core::ops::{Drop, Deref, DerefMut};
154+
use core::ops::{Deref, DerefMut};
155155
use core::iter::{FromIterator, FusedIterator};
156156
use core::mem::swap;
157157
use core::mem::size_of;

Diff for: src/libcollections/borrow.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,9 @@
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414

15-
use core::clone::Clone;
16-
use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
17-
use core::convert::AsRef;
18-
use core::default::Default;
15+
use core::cmp::Ordering;
1916
use core::hash::{Hash, Hasher};
20-
use core::marker::Sized;
2117
use core::ops::Deref;
22-
use core::option::Option;
2318

2419
use fmt;
2520

Diff for: src/libcollections/linked_list.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1159,9 +1159,6 @@ unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {}
11591159

11601160
#[cfg(test)]
11611161
mod tests {
1162-
use std::clone::Clone;
1163-
use std::iter::{Iterator, IntoIterator, Extend};
1164-
use std::option::Option::{self, Some, None};
11651162
use std::__rand::{thread_rng, Rng};
11661163
use std::thread;
11671164
use std::vec::Vec;
@@ -1319,7 +1316,6 @@ mod tests {
13191316

13201317
#[test]
13211318
fn test_26021() {
1322-
use std::iter::ExactSizeIterator;
13231319
// There was a bug in split_off that failed to null out the RHS's head's prev ptr.
13241320
// This caused the RHS's dtor to walk up into the LHS at drop and delete all of
13251321
// its nodes.

Diff for: src/libcollections/range.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
//! Range syntax.
1616
17-
use core::option::Option::{self, None, Some};
1817
use core::ops::{RangeFull, Range, RangeTo, RangeFrom};
1918

2019
/// **RangeArgument** is implemented by Rust's built-in range types, produced

Diff for: src/libcollections/vec_deque.rs

-3
Original file line numberDiff line numberDiff line change
@@ -2332,9 +2332,6 @@ impl<T> From<VecDeque<T>> for Vec<T> {
23322332

23332333
#[cfg(test)]
23342334
mod tests {
2335-
use core::iter::Iterator;
2336-
use core::option::Option::Some;
2337-
23382335
use test;
23392336

23402337
use super::VecDeque;

Diff for: src/libcore/any.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,10 @@
7272
#![stable(feature = "rust1", since = "1.0.0")]
7373

7474
use fmt;
75-
use marker::Send;
7675
use mem::transmute;
77-
use option::Option::{self, Some, None};
7876
use raw::TraitObject;
7977
use intrinsics;
80-
use marker::{Reflect, Sized};
78+
use marker::Reflect;
8179

8280
///////////////////////////////////////////////////////////////////////////////
8381
// Any trait

Diff for: src/libcore/array.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@
2020
issue = "27778")]
2121

2222
use borrow::{Borrow, BorrowMut};
23-
use clone::Clone;
24-
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
25-
use convert::{AsRef, AsMut};
26-
use default::Default;
23+
use cmp::Ordering;
2724
use fmt;
2825
use hash::{Hash, self};
29-
use iter::IntoIterator;
30-
use marker::{Copy, Sized, Unsize};
31-
use option::Option;
32-
use slice::{Iter, IterMut, SliceExt};
26+
use marker::Unsize;
27+
use slice::{Iter, IterMut};
3328

3429
/// Utility trait implemented only on arrays of fixed size
3530
///

Diff for: src/libcore/borrow.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414

15-
use marker::Sized;
16-
1715
/// A trait for borrowing data.
1816
///
1917
/// In general, there may be several ways to "borrow" a piece of data. The

Diff for: src/libcore/cell.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,10 @@
144144
145145
#![stable(feature = "rust1", since = "1.0.0")]
146146

147-
use clone::Clone;
148-
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
149-
use convert::From;
150-
use default::Default;
147+
use cmp::Ordering;
151148
use fmt::{self, Debug, Display};
152-
use marker::{Copy, PhantomData, Send, Sync, Sized, Unsize};
153-
use ops::{Deref, DerefMut, Drop, FnOnce, CoerceUnsized};
154-
use option::Option;
155-
use option::Option::{None, Some};
156-
use result::Result;
157-
use result::Result::{Ok, Err};
149+
use marker::{PhantomData, Unsize};
150+
use ops::{Deref, DerefMut, CoerceUnsized};
158151

159152
/// A mutable memory location that admits only `Copy` data.
160153
///

Diff for: src/libcore/char.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#![allow(non_snake_case)]
1616
#![stable(feature = "core_char", since = "1.2.0")]
1717

18-
use prelude::v1::*;
19-
2018
use char_private::is_printable;
2119
use iter::FusedIterator;
2220
use mem::transmute;

Diff for: src/libcore/char_private.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
// NOTE: The following code was generated by "src/etc/char_private.py",
1212
// do not edit directly!
1313

14-
use slice::SliceExt;
15-
1614
fn check(x: u16, singletons: &[u16], normal: &[u16]) -> bool {
1715
for &s in singletons {
1816
if x == s {

Diff for: src/libcore/clone.rs

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
4545
#![stable(feature = "rust1", since = "1.0.0")]
4646

47-
use marker::Sized;
48-
4947
/// A common trait for the ability to explicitly duplicate an object.
5048
///
5149
/// Differs from `Copy` in that `Copy` is implicit and extremely inexpensive, while

Diff for: src/libcore/cmp.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434

3535
use self::Ordering::*;
3636

37-
use marker::Sized;
38-
use option::Option::{self, Some};
39-
4037
/// Trait for equality comparisons which are [partial equivalence
4138
/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation).
4239
///
@@ -571,11 +568,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
571568

572569
// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
573570
mod impls {
574-
use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering};
575-
use cmp::Ordering::{Less, Greater, Equal};
576-
use marker::Sized;
577-
use option::Option;
578-
use option::Option::{Some, None};
571+
use cmp::Ordering::{self, Less, Greater, Equal};
579572

580573
macro_rules! partial_eq_impl {
581574
($($t:ty)*) => ($(

Diff for: src/libcore/convert.rs

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
4141
#![stable(feature = "rust1", since = "1.0.0")]
4242

43-
use marker::Sized;
44-
use result::Result;
45-
4643
/// A cheap, reference-to-reference conversion.
4744
///
4845
/// `AsRef` is very similar to, but different than, `Borrow`. See

Diff for: src/libcore/default.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414

15-
use marker::Sized;
16-
1715
/// A trait for giving a type a useful default value.
1816
///
1917
/// Sometimes, you want to fall back to some kind of default value, and

Diff for: src/libcore/fmt/builders.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use prelude::v1::*;
1211
use fmt::{self, FlagV1};
1312

1413
struct PadAdapter<'a, 'b: 'a> {

Diff for: src/libcore/fmt/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414

15-
use prelude::v1::*;
16-
1715
use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut, BorrowState};
1816
use marker::PhantomData;
1917
use mem;
@@ -905,8 +903,6 @@ impl<'a> Formatter<'a> {
905903
prefix: &str,
906904
buf: &str)
907905
-> Result {
908-
use char::CharExt;
909-
910906
let mut width = buf.len();
911907

912908
let mut sign = None;
@@ -1020,7 +1016,6 @@ impl<'a> Formatter<'a> {
10201016
f: F) -> Result
10211017
where F: FnOnce(&mut Formatter) -> Result,
10221018
{
1023-
use char::CharExt;
10241019
let align = match self.align {
10251020
rt::v1::Alignment::Unknown => default,
10261021
_ => self.align

Diff for: src/libcore/fmt/num.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
// FIXME: #6220 Implement floating point formatting
1616

17-
use prelude::v1::*;
18-
1917
use fmt;
2018
use num::Zero;
2119
use ops::{Div, Rem, Sub};

Diff for: src/libcore/hash/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@
7171
7272
#![stable(feature = "rust1", since = "1.0.0")]
7373

74-
use prelude::v1::*;
75-
7674
use fmt;
7775
use marker;
7876
use mem;
@@ -288,8 +286,6 @@ impl<H> Default for BuildHasherDefault<H> {
288286
//////////////////////////////////////////////////////////////////////////////
289287

290288
mod impls {
291-
use prelude::v1::*;
292-
293289
use mem;
294290
use slice;
295291
use super::*;

Diff for: src/libcore/hash/sip.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
//! An implementation of SipHash.
1212
13-
use prelude::v1::*;
14-
1513
use marker::PhantomData;
1614
use ptr;
1715

Diff for: src/libcore/intrinsics.rs

-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
issue = "0")]
4747
#![allow(missing_docs)]
4848

49-
use marker::Sized;
50-
5149
extern "rust-intrinsic" {
5250

5351
// NB: These intrinsics take raw pointers because they mutate aliased

Diff for: src/libcore/iter/iterator.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use clone::Clone;
12-
use cmp::{Ord, PartialOrd, PartialEq, Ordering};
13-
use default::Default;
14-
use ops::FnMut;
15-
use option::Option::{self, Some, None};
16-
use marker::Sized;
11+
use cmp::Ordering;
1712

1813
use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, FlatMap, Fuse};
1914
use super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, Take, TakeWhile, Rev};
2015
use super::{Zip, Sum, Product};
21-
use super::ChainState;
22-
use super::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator};
23-
use super::{IntoIterator, ZipImpl};
16+
use super::{ChainState, FromIterator, ZipImpl};
2417

2518
fn _assert_is_object_safe(_: &Iterator<Item=()>) {}
2619

Diff for: src/libcore/iter/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,9 @@
299299
300300
#![stable(feature = "rust1", since = "1.0.0")]
301301

302-
use clone::Clone;
303302
use cmp;
304-
use default::Default;
305303
use fmt;
306304
use iter_private::TrustedRandomAccess;
307-
use ops::FnMut;
308-
use option::Option::{self, Some, None};
309305
use usize;
310306

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

Diff for: src/libcore/iter/range.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use clone::Clone;
12-
use cmp::PartialOrd;
1311
use mem;
1412
use ops::{self, Add, Sub};
15-
use option::Option::{self, Some, None};
16-
use marker::Sized;
1713
use usize;
1814

19-
use super::{DoubleEndedIterator, ExactSizeIterator, Iterator, FusedIterator};
15+
use super::FusedIterator;
2016

2117
/// Objects that can be stepped over in both directions.
2218
///

Diff for: src/libcore/iter/sources.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use clone::Clone;
12-
use default::Default;
1311
use fmt;
1412
use marker;
15-
use option::Option::{self, Some, None};
1613
use usize;
1714

18-
use super::{DoubleEndedIterator, IntoIterator, Iterator, ExactSizeIterator, FusedIterator};
15+
use super::FusedIterator;
1916

2017
/// An iterator that repeats an element endlessly.
2118
///

Diff for: src/libcore/iter/traits.rs

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use option::Option::{self, Some};
12-
use marker::Sized;
13-
14-
use super::Iterator;
15-
1611
/// Conversion from an `Iterator`.
1712
///
1813
/// By implementing `FromIterator` for a type, you define how it will be

Diff for: src/libcore/iter_private.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
// except according to those terms.
1010

1111

12-
use iter::ExactSizeIterator;
13-
1412
/// An iterator whose items are random accessible efficiently
1513
///
1614
/// # Safety

Diff for: src/libcore/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@
9191
#![feature(unboxed_closures)]
9292
#![feature(question_mark)]
9393
#![feature(never_type)]
94+
#![feature(prelude_import)]
95+
96+
#[prelude_import]
97+
#[allow(unused)]
98+
use prelude::v1::*;
9499

95100
#[macro_use]
96101
mod macros;

Diff for: src/libcore/marker.rs

-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
1717
#![stable(feature = "rust1", since = "1.0.0")]
1818

19-
use clone::Clone;
2019
use cmp;
21-
use default::Default;
22-
use option::Option;
2320
use hash::Hash;
2421
use hash::Hasher;
2522

@@ -414,8 +411,6 @@ pub struct PhantomData<T:?Sized>;
414411
impls! { PhantomData }
415412

416413
mod impls {
417-
use super::{Send, Sync, Sized};
418-
419414
#[stable(feature = "rust1", since = "1.0.0")]
420415
unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {}
421416
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)