diff options
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/buffered.rs | 21 | ||||
| -rw-r--r-- | src/libstd/io/cursor.rs | 11 | ||||
| -rw-r--r-- | src/libstd/io/error.rs | 18 | ||||
| -rw-r--r-- | src/libstd/io/impls.rs | 11 | ||||
| -rw-r--r-- | src/libstd/io/lazy.rs | 10 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 23 | ||||
| -rw-r--r-- | src/libstd/io/stdio.rs | 30 | ||||
| -rw-r--r-- | src/libstd/io/util.rs | 10 |
8 files changed, 66 insertions, 68 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 6383a14cf18..559a54d3c8a 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -1,12 +1,12 @@ //! Buffering wrappers for I/O traits -use io::prelude::*; +use crate::io::prelude::*; -use cmp; -use error; -use fmt; -use io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; -use memchr; +use crate::cmp; +use crate::error; +use crate::fmt; +use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; +use crate::memchr; /// The `BufReader` struct adds buffering to any reader. /// @@ -977,11 +977,10 @@ impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{self, BufReader, BufWriter, LineWriter, SeekFrom}; - use sync::atomic::{AtomicUsize, Ordering}; - use thread; - use test; + use crate::io::prelude::*; + use crate::io::{self, BufReader, BufWriter, LineWriter, SeekFrom}; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::thread; /// A dummy reader intended at testing short-reads propagation. pub struct ShortReader { diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 577a115025b..873da0898c7 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -1,8 +1,9 @@ -use io::prelude::*; +use crate::io::prelude::*; + +use crate::cmp; +use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut}; use core::convert::TryInto; -use cmp; -use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut}; /// A `Cursor` wraps an in-memory buffer and provides it with a /// [`Seek`] implementation. @@ -378,8 +379,8 @@ impl Write for Cursor<Box<[u8]>> { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{Cursor, SeekFrom, IoVec, IoVecMut}; + use crate::io::prelude::*; + use crate::io::{Cursor, SeekFrom, IoVec, IoVecMut}; #[test] fn test_vec_writer() { diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index e9b4f60182c..fdc5625ff18 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -1,8 +1,8 @@ -use error; -use fmt; -use result; -use sys; -use convert::From; +use crate::error; +use crate::fmt; +use crate::result; +use crate::sys; +use crate::convert::From; /// A specialized [`Result`](../result/enum.Result.html) type for I/O /// operations. @@ -566,10 +566,10 @@ fn _assert_error_is_sync_send() { #[cfg(test)] mod test { use super::{Error, ErrorKind, Repr, Custom}; - use error; - use fmt; - use sys::os::error_string; - use sys::decode_error_kind; + use crate::error; + use crate::fmt; + use crate::sys::os::error_string; + use crate::sys::decode_error_kind; #[test] fn test_debug_error() { diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index aa8db177ffc..bd3d0a41638 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -1,8 +1,8 @@ -use cmp; -use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, +use crate::cmp; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, IoVec}; -use fmt; -use mem; +use crate::fmt; +use crate::mem; // ============================================================================= // Forwarding implementations @@ -323,8 +323,7 @@ impl Write for Vec<u8> { #[cfg(test)] mod tests { - use io::prelude::*; - use test; + use crate::io::prelude::*; #[bench] fn bench_read_slice(b: &mut test::Bencher) { diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs index e3ebe82e3da..e864aa2c864 100644 --- a/src/libstd/io/lazy.rs +++ b/src/libstd/io/lazy.rs @@ -1,8 +1,8 @@ -use cell::Cell; -use ptr; -use sync::Arc; -use sys_common; -use sys_common::mutex::Mutex; +use crate::cell::Cell; +use crate::ptr; +use crate::sync::Arc; +use crate::sys_common; +use crate::sys_common::mutex::Mutex; pub struct Lazy<T> { // We never call `lock.init()`, so it is UB to attempt to acquire this mutex reentrantly! diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 613ae7a6728..e3e2754a7aa 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -259,14 +259,14 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cmp; -use fmt; -use slice; -use str; -use memchr; -use ops::{Deref, DerefMut}; -use ptr; -use sys; +use crate::cmp; +use crate::fmt; +use crate::slice; +use crate::str; +use crate::memchr; +use crate::ops::{Deref, DerefMut}; +use crate::ptr; +use crate::sys; #[stable(feature = "rust1", since = "1.0.0")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; @@ -297,7 +297,7 @@ mod lazy; mod util; mod stdio; -const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +const DEFAULT_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; struct Guard<'a> { buf: &'a mut Vec<u8>, len: usize } @@ -2155,10 +2155,9 @@ impl<B: BufRead> Iterator for Lines<B> { #[cfg(test)] mod tests { - use io::prelude::*; - use io; + use crate::io::prelude::*; + use crate::io; use super::Cursor; - use test; use super::repeat; #[test] diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 0324568e6fb..13bf357e2eb 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -1,13 +1,13 @@ -use io::prelude::*; +use crate::io::prelude::*; -use cell::RefCell; -use fmt; -use io::lazy::Lazy; -use io::{self, Initializer, BufReader, LineWriter}; -use sync::{Arc, Mutex, MutexGuard}; -use sys::stdio; -use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; -use thread::LocalKey; +use crate::cell::RefCell; +use crate::fmt; +use crate::io::lazy::Lazy; +use crate::io::{self, Initializer, BufReader, LineWriter}; +use crate::sync::{Arc, Mutex, MutexGuard}; +use crate::sys::stdio; +use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; +use crate::thread::LocalKey; /// Stdout used by print! and println! macros thread_local! { @@ -668,8 +668,8 @@ impl fmt::Debug for StderrLock<'_> { issue = "0")] #[doc(hidden)] pub fn set_panic(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write + Send>> { - use panicking::LOCAL_STDERR; - use mem; + use crate::panicking::LOCAL_STDERR; + use crate::mem; LOCAL_STDERR.with(move |slot| { mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { @@ -692,7 +692,7 @@ pub fn set_panic(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write + issue = "0")] #[doc(hidden)] pub fn set_print(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write + Send>> { - use mem; + use crate::mem; LOCAL_STDOUT.with(move |slot| { mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { @@ -749,14 +749,14 @@ pub fn _print(args: fmt::Arguments) { issue = "0")] #[doc(hidden)] pub fn _eprint(args: fmt::Arguments) { - use panicking::LOCAL_STDERR; + use crate::panicking::LOCAL_STDERR; print_to(args, &LOCAL_STDERR, stderr, "stderr"); } #[cfg(test)] mod tests { - use panic::{UnwindSafe, RefUnwindSafe}; - use thread; + use crate::panic::{UnwindSafe, RefUnwindSafe}; + use crate::thread; use super::*; #[test] diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 5ce955eb1e4..6aaf8f1889a 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -1,8 +1,8 @@ #![allow(missing_copy_implementations)] -use fmt; -use io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use mem; +use crate::fmt; +use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; +use crate::mem; /// Copies the entire contents of a reader into a writer. /// @@ -224,8 +224,8 @@ impl fmt::Debug for Sink { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{copy, sink, empty, repeat}; + use crate::io::prelude::*; + use crate::io::{copy, sink, empty, repeat}; #[test] fn copy_copies() { |
