Skip to content

Commit 9a2c878

Browse files
committed
Use #[prelude_import] in libstd.
1 parent e2ad3be commit 9a2c878

Some content is hidden

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

81 files changed

+11
-205
lines changed

src/libstd/ascii.rs

-3
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 mem;
1816
use ops::Range;
1917
use iter::FusedIterator;
@@ -454,7 +452,6 @@ static ASCII_UPPERCASE_MAP: [u8; 256] = [
454452

455453
#[cfg(test)]
456454
mod tests {
457-
use prelude::v1::*;
458455
use super::*;
459456
use char::from_u32;
460457

src/libstd/collections/hash/map.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2059,8 +2059,6 @@ fn assert_covariance() {
20592059

20602060
#[cfg(test)]
20612061
mod test_map {
2062-
use prelude::v1::*;
2063-
20642062
use super::HashMap;
20652063
use super::Entry::{Occupied, Vacant};
20662064
use cell::RefCell;

src/libstd/collections/hash/set.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,6 @@ fn assert_covariance() {
10671067

10681068
#[cfg(test)]
10691069
mod test_set {
1070-
use prelude::v1::*;
1071-
10721070
use super::HashSet;
10731071

10741072
#[test]

src/libstd/env.rs

-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
1717
#![stable(feature = "env", since = "1.0.0")]
1818

19-
use prelude::v1::*;
20-
2119
use error::Error;
2220
use ffi::{OsStr, OsString};
2321
use fmt;
@@ -950,7 +948,6 @@ mod arch {
950948

951949
#[cfg(test)]
952950
mod tests {
953-
use prelude::v1::*;
954951
use super::*;
955952

956953
use iter::repeat;

src/libstd/error.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@
4848
// reconsider what crate these items belong in.
4949

5050
use any::TypeId;
51-
use boxed::Box;
5251
use cell;
5352
use char;
5453
use fmt::{self, Debug, Display};
55-
use marker::{Send, Sync, Reflect};
54+
use marker::Reflect;
5655
use mem::transmute;
5756
use num;
5857
use raw::TraitObject;
5958
use str;
60-
use string::{self, String};
59+
use string;
6160

6261
/// Base functionality for all errors in Rust.
6362
#[stable(feature = "rust1", since = "1.0.0")]
@@ -454,7 +453,6 @@ impl Error + Send + Sync {
454453

455454
#[cfg(test)]
456455
mod tests {
457-
use prelude::v1::*;
458456
use super::Error;
459457
use fmt;
460458

src/libstd/ffi/c_str.rs

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

1111
use ascii;
12-
use borrow::{Cow, ToOwned, Borrow};
13-
use boxed::Box;
14-
use convert::{Into, From};
15-
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
12+
use borrow::{Cow, Borrow};
13+
use cmp::Ordering;
1614
use error::Error;
1715
use fmt::{self, Write};
1816
use io;
19-
use iter::Iterator;
2017
use libc;
2118
use mem;
2219
use memchr;
2320
use ops;
24-
use option::Option::{self, Some, None};
2521
use os::raw::c_char;
26-
use result::Result::{self, Ok, Err};
2722
use slice;
2823
use str::{self, Utf8Error};
29-
use string::String;
30-
use vec::Vec;
3124

3225
/// A type representing an owned C-compatible string
3326
///
@@ -700,7 +693,6 @@ impl AsRef<CStr> for CString {
700693

701694
#[cfg(test)]
702695
mod tests {
703-
use prelude::v1::*;
704696
use super::*;
705697
use os::raw::c_char;
706698
use borrow::Cow::{Borrowed, Owned};

src/libstd/ffi/os_str.rs

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

11-
use borrow::{Borrow, Cow, ToOwned};
11+
use borrow::{Borrow, Cow};
1212
use fmt::{self, Debug};
1313
use mem;
14-
use string::String;
1514
use ops;
1615
use cmp;
1716
use hash::{Hash, Hasher};
18-
use vec::Vec;
1917

2018
use sys::os_str::{Buf, Slice};
2119
use sys_common::{AsInner, IntoInner, FromInner};

src/libstd/fs.rs

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use io::{self, SeekFrom, Seek, Read, Write};
2323
use path::{Path, PathBuf};
2424
use sys::fs as fs_imp;
2525
use sys_common::{AsInnerMut, FromInner, AsInner, IntoInner};
26-
use vec::Vec;
2726
use time::SystemTime;
2827

2928
/// A reference to an open file on the filesystem.
@@ -1677,7 +1676,6 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
16771676

16781677
#[cfg(test)]
16791678
mod tests {
1680-
use prelude::v1::*;
16811679
use io::prelude::*;
16821680

16831681
use fs::{self, File, OpenOptions};

src/libstd/io/buffered.rs

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

1111
//! Buffering wrappers for I/O traits
1212
13-
use prelude::v1::*;
1413
use io::prelude::*;
1514

1615
use marker::Reflect;
@@ -788,7 +787,6 @@ impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
788787

789788
#[cfg(test)]
790789
mod tests {
791-
use prelude::v1::*;
792790
use io::prelude::*;
793791
use io::{self, BufReader, BufWriter, LineWriter, SeekFrom};
794792
use sync::atomic::{AtomicUsize, Ordering};

src/libstd/io/cursor.rs

-2
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 io::prelude::*;
1312

1413
use cmp;
@@ -284,7 +283,6 @@ impl Write for Cursor<Box<[u8]>> {
284283
mod tests {
285284
use io::prelude::*;
286285
use io::{Cursor, SeekFrom};
287-
use vec::Vec;
288286

289287
#[test]
290288
fn test_vec_writer() {

src/libstd/io/error.rs

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

11-
use boxed::Box;
12-
use convert::Into;
1311
use error;
1412
use fmt;
15-
use marker::{Send, Sync};
16-
use option::Option::{self, Some, None};
1713
use result;
1814
use sys;
1915

@@ -522,7 +518,6 @@ fn _assert_error_is_sync_send() {
522518

523519
#[cfg(test)]
524520
mod test {
525-
use prelude::v1::*;
526521
use super::{Error, ErrorKind};
527522
use error;
528523
use fmt;

src/libstd/io/impls.rs

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

11-
use boxed::Box;
1211
use cmp;
1312
use io::{self, SeekFrom, Read, Write, Seek, BufRead, Error, ErrorKind};
1413
use fmt;
1514
use mem;
16-
use string::String;
17-
use vec::Vec;
1815

1916
// =============================================================================
2017
// Forwarding implementations
@@ -228,7 +225,6 @@ impl Write for Vec<u8> {
228225
#[cfg(test)]
229226
mod tests {
230227
use io::prelude::*;
231-
use vec::Vec;
232228
use test;
233229

234230
#[bench]

src/libstd/io/lazy.rs

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

11-
use prelude::v1::*;
12-
1311
use cell::Cell;
1412
use ptr;
1513
use sync::Arc;

src/libstd/io/mod.rs

-8
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,8 @@ use cmp;
253253
use rustc_unicode::str as core_str;
254254
use error as std_error;
255255
use fmt;
256-
use iter::{Iterator};
257-
use marker::Sized;
258-
use ops::{Drop, FnOnce};
259-
use option::Option::{self, Some, None};
260-
use result::Result::{Ok, Err};
261256
use result;
262-
use string::String;
263257
use str;
264-
use vec::Vec;
265258
use memchr;
266259

267260
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1734,7 +1727,6 @@ impl<B: BufRead> Iterator for Lines<B> {
17341727

17351728
#[cfg(test)]
17361729
mod tests {
1737-
use prelude::v1::*;
17381730
use io::prelude::*;
17391731
use io;
17401732
use super::Cursor;

src/libstd/io/stdio.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 io::prelude::*;
1312

1413
use cell::{RefCell, BorrowState};

src/libstd/io/util.rs

-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ impl Write for Sink {
167167

168168
#[cfg(test)]
169169
mod tests {
170-
use prelude::v1::*;
171-
172170
use io::prelude::*;
173171
use io::{copy, sink, empty, repeat};
174172

src/libstd/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@
252252
#![feature(optin_builtin_traits)]
253253
#![feature(panic_unwind)]
254254
#![feature(placement_in_syntax)]
255+
#![feature(prelude_import)]
255256
#![feature(question_mark)]
256257
#![feature(rand)]
257258
#![feature(raw)]
@@ -292,6 +293,10 @@
292293
#![allow(unused_features)] // std may use features in a platform-specific way
293294
#![cfg_attr(not(stage0), deny(warnings))]
294295

296+
#[prelude_import]
297+
#[allow(unused)]
298+
use prelude::v1::*;
299+
295300
#[cfg(test)] extern crate test;
296301

297302
// We want to reexport a few macros from core but libcore has already been

src/libstd/net/addr.rs

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

11-
use prelude::v1::*;
12-
1311
use fmt;
1412
use hash;
1513
use io;
@@ -523,7 +521,6 @@ impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T {
523521

524522
#[cfg(test)]
525523
mod tests {
526-
use prelude::v1::*;
527524
use net::*;
528525
use net::test::{tsa, sa6, sa4};
529526

src/libstd/net/ip.rs

-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,6 @@ impl From<[u8; 16]> for Ipv6Addr {
653653
// Tests for this module
654654
#[cfg(test)]
655655
mod tests {
656-
use prelude::v1::*;
657656
use net::*;
658657
use net::Ipv6MulticastScope::*;
659658
use net::test::{tsa, sa6, sa4};

src/libstd/net/mod.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 prelude::v1::*;
16-
1715
use io::{self, Error, ErrorKind};
1816
use sys_common::net as net_imp;
1917

src/libstd/net/parser.rs

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
//! This module is "publicly exported" through the `FromStr` implementations
1414
//! below.
1515
16-
use prelude::v1::*;
17-
1816
use error::Error;
1917
use fmt;
2018
use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};

src/libstd/net/tcp.rs

-3
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 io::prelude::*;
1312

1413
use fmt;
@@ -438,8 +437,6 @@ impl fmt::Debug for TcpListener {
438437

439438
#[cfg(test)]
440439
mod tests {
441-
use prelude::v1::*;
442-
443440
use io::ErrorKind;
444441
use io::prelude::*;
445442
use net::*;

src/libstd/net/test.rs

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

11-
use prelude::v1::*;
12-
1311
use env;
1412
use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs};
1513
use sync::atomic::{AtomicUsize, Ordering};

src/libstd/net/udp.rs

-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@ impl fmt::Debug for UdpSocket {
355355

356356
#[cfg(test)]
357357
mod tests {
358-
use prelude::v1::*;
359-
360358
use io::ErrorKind;
361359
use net::*;
362360
use net::test::{next_test_ip4, next_test_ip6};

src/libstd/num/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ pub use core::num::{FpCategory, ParseIntError, ParseFloatError, TryFromIntError}
2424
#[stable(feature = "rust1", since = "1.0.0")]
2525
pub use core::num::Wrapping;
2626

27-
#[cfg(test)] use cmp::PartialEq;
2827
#[cfg(test)] use fmt;
29-
#[cfg(test)] use marker::Copy;
3028
#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
3129

3230
/// Helper function for testing numeric operations
@@ -52,7 +50,6 @@ mod tests {
5250
use u32;
5351
use u64;
5452
use usize;
55-
use string::ToString;
5653
use ops::Mul;
5754

5855
#[test]
@@ -287,7 +284,6 @@ mod tests {
287284
mod bench {
288285
extern crate test;
289286
use self::test::Bencher;
290-
use prelude::v1::*;
291287

292288
#[bench]
293289
fn bench_pow_function(b: &mut Bencher) {

0 commit comments

Comments
 (0)