mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
Use Rust 2021 prelude in std itself.
This commit is contained in:
parent
8a2fe75d0e
commit
4f212f08cf
@ -12,7 +12,7 @@ use crate::collections::TryReserveErrorKind;
|
||||
use crate::fmt::{self, Debug};
|
||||
#[allow(deprecated)]
|
||||
use crate::hash::{BuildHasher, Hash, Hasher, SipHasher13};
|
||||
use crate::iter::{FromIterator, FusedIterator};
|
||||
use crate::iter::FusedIterator;
|
||||
use crate::ops::Index;
|
||||
use crate::sys;
|
||||
|
||||
|
@ -7,7 +7,7 @@ use crate::borrow::Borrow;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::hash::{BuildHasher, Hash};
|
||||
use crate::iter::{Chain, FromIterator, FusedIterator};
|
||||
use crate::iter::{Chain, FusedIterator};
|
||||
use crate::ops::{BitAnd, BitOr, BitXor, Sub};
|
||||
|
||||
use super::map::{map_try_reserve_error, RandomState};
|
||||
|
@ -6,7 +6,7 @@ use crate::cmp;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::hash::{Hash, Hasher};
|
||||
use crate::iter::{Extend, FromIterator};
|
||||
use crate::iter::Extend;
|
||||
use crate::ops;
|
||||
use crate::rc::Rc;
|
||||
use crate::str::FromStr;
|
||||
|
@ -7,8 +7,6 @@ use crate::alloc::Allocator;
|
||||
use crate::cmp;
|
||||
use crate::io::{self, ErrorKind, IoSlice, IoSliceMut, ReadBuf, SeekFrom};
|
||||
|
||||
use core::convert::TryInto;
|
||||
|
||||
/// A `Cursor` wraps an in-memory buffer and provides it with a
|
||||
/// [`Seek`] implementation.
|
||||
///
|
||||
|
@ -252,7 +252,6 @@
|
||||
mod tests;
|
||||
|
||||
use crate::cmp;
|
||||
use crate::convert::TryInto;
|
||||
use crate::fmt;
|
||||
use crate::mem::replace;
|
||||
use crate::ops::{Deref, DerefMut};
|
||||
|
@ -345,7 +345,7 @@
|
||||
// to import the prelude implicitly when building crates that depend on std.
|
||||
#[prelude_import]
|
||||
#[allow(unused)]
|
||||
use prelude::v1::*;
|
||||
use prelude::rust_2021::*;
|
||||
|
||||
// Access to Bencher, etc.
|
||||
#[cfg(test)]
|
||||
|
@ -2,7 +2,6 @@
|
||||
mod tests;
|
||||
|
||||
use crate::cmp::Ordering;
|
||||
use crate::convert::TryInto;
|
||||
use crate::fmt;
|
||||
use crate::hash;
|
||||
use crate::io::{self, Write};
|
||||
|
@ -6,7 +6,6 @@
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use crate::convert::TryInto as _;
|
||||
use crate::error::Error;
|
||||
use crate::fmt;
|
||||
use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
|
||||
|
@ -1,5 +1,4 @@
|
||||
use super::{sockaddr_un, SocketAddr};
|
||||
use crate::convert::TryFrom;
|
||||
use crate::io::{self, IoSlice, IoSliceMut};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::mem::{size_of, zeroed};
|
||||
|
@ -10,7 +10,6 @@ use crate::io::{self, ErrorKind, IoSlice, IoSliceMut};
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd",
|
||||
))]
|
||||
use crate::iter::FromIterator;
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
target_os = "dragonfly",
|
||||
|
@ -3,7 +3,6 @@
|
||||
#![unstable(feature = "io_safety", issue = "87074")]
|
||||
|
||||
use super::raw::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle};
|
||||
use crate::convert::TryFrom;
|
||||
use crate::fmt;
|
||||
use crate::fs;
|
||||
use crate::io;
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::TryFrom;
|
||||
use crate::fmt;
|
||||
use crate::io::{self, ErrorKind, IoSlice, IoSliceMut};
|
||||
use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::cmp::Ordering;
|
||||
use crate::convert::TryInto;
|
||||
use crate::sys::hermit::abi;
|
||||
use crate::sys::hermit::abi::timespec;
|
||||
use crate::sys::hermit::abi::{CLOCK_MONOTONIC, CLOCK_REALTIME, NSEC_PER_SEC};
|
||||
|
@ -1,7 +1,6 @@
|
||||
use super::abi;
|
||||
use crate::{
|
||||
cell::UnsafeCell,
|
||||
convert::TryFrom,
|
||||
mem::MaybeUninit,
|
||||
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||
};
|
||||
|
@ -8,7 +8,6 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
cell::UnsafeCell,
|
||||
convert::TryFrom,
|
||||
ffi::CStr,
|
||||
hint, io,
|
||||
mem::ManuallyDrop,
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{abi, error::expect_success};
|
||||
use crate::{convert::TryInto, mem::MaybeUninit, time::Duration};
|
||||
use crate::{mem::MaybeUninit, time::Duration};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
|
||||
pub struct Instant(abi::SYSTIM);
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::cmp;
|
||||
use crate::convert::TryFrom;
|
||||
use crate::io::{Error as IoError, ErrorKind, IoSlice, IoSliceMut, Result as IoResult};
|
||||
use crate::sys::rand::rdrand64;
|
||||
use crate::time::{Duration, Instant};
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::TryFrom;
|
||||
use crate::error;
|
||||
use crate::fmt;
|
||||
use crate::io::{self, IoSlice, IoSliceMut};
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{abi, error::expect_success};
|
||||
use crate::{convert::TryInto, mem::MaybeUninit, time::Duration};
|
||||
use crate::{mem::MaybeUninit, time::Duration};
|
||||
|
||||
pub use super::itron::time::Instant;
|
||||
|
||||
|
@ -943,7 +943,6 @@ impl File {
|
||||
}
|
||||
|
||||
pub fn truncate(&self, size: u64) -> io::Result<()> {
|
||||
use crate::convert::TryInto;
|
||||
let size: off64_t =
|
||||
size.try_into().map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?;
|
||||
cvt_r(|| unsafe { ftruncate64(self.as_raw_fd(), size) }).map(drop)
|
||||
|
@ -136,7 +136,6 @@ pub fn futex_wake_all(futex: &AtomicU32) {
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool {
|
||||
use crate::convert::TryInto;
|
||||
use crate::ptr::{null, null_mut};
|
||||
let timespec = timeout.and_then(|d| {
|
||||
Some(libc::timespec {
|
||||
@ -185,8 +184,6 @@ pub fn futex_wake_all(futex: &AtomicU32) {
|
||||
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool {
|
||||
use crate::convert::TryFrom;
|
||||
|
||||
// A timeout of 0 means infinite.
|
||||
// We round smaller timeouts up to 1 millisecond.
|
||||
// Overflows are rounded up to an infinite timeout.
|
||||
|
@ -45,7 +45,6 @@
|
||||
//! * complexity
|
||||
|
||||
use crate::cmp::min;
|
||||
use crate::convert::TryInto;
|
||||
use crate::fs::{File, Metadata};
|
||||
use crate::io::copy::generic_copy;
|
||||
use crate::io::{
|
||||
|
@ -9,7 +9,6 @@ macro_rules! unimpl {
|
||||
|
||||
pub mod net {
|
||||
#![allow(warnings)]
|
||||
use crate::convert::TryFrom;
|
||||
use crate::fmt;
|
||||
use crate::io::{self, IoSlice, IoSliceMut};
|
||||
use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::{TryFrom, TryInto};
|
||||
use crate::fmt;
|
||||
use crate::io;
|
||||
use crate::mem;
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::{TryFrom, TryInto};
|
||||
use crate::fmt;
|
||||
use crate::io::{self, Error, ErrorKind};
|
||||
use crate::mem;
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::{TryFrom, TryInto};
|
||||
use crate::fmt;
|
||||
use crate::io;
|
||||
use crate::io::ErrorKind;
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::{TryFrom, TryInto};
|
||||
use crate::fmt;
|
||||
use crate::io::{self, Error, ErrorKind};
|
||||
use crate::num::NonZeroI32;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![allow(non_camel_case_types, unused)]
|
||||
|
||||
use crate::convert::TryInto;
|
||||
use crate::io;
|
||||
use crate::mem::MaybeUninit;
|
||||
use crate::os::raw::c_char;
|
||||
|
@ -2,7 +2,6 @@ use crate::fmt;
|
||||
use crate::time::Duration;
|
||||
|
||||
pub use self::inner::Instant;
|
||||
use crate::convert::TryInto;
|
||||
|
||||
const NSEC_PER_SEC: u64 = 1_000_000_000;
|
||||
pub const UNIX_EPOCH: SystemTime = SystemTime { t: Timespec::zero() };
|
||||
@ -127,7 +126,6 @@ impl Timespec {
|
||||
}
|
||||
|
||||
pub fn to_timespec(&self) -> Option<libc::timespec> {
|
||||
use crate::convert::TryInto;
|
||||
Some(libc::timespec {
|
||||
tv_sec: self.tv_sec.try_into().ok()?,
|
||||
tv_nsec: self.tv_nsec.try_into().ok()?,
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::TryFrom;
|
||||
use crate::fmt;
|
||||
use crate::io::{self, IoSlice, IoSliceMut};
|
||||
use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
use super::err2io;
|
||||
use super::fd::WasiFd;
|
||||
use crate::convert::TryFrom;
|
||||
use crate::fmt;
|
||||
use crate::io::{self, IoSlice, IoSliceMut};
|
||||
use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::arch::wasm32;
|
||||
use crate::convert::TryInto;
|
||||
use crate::sync::atomic::AtomicU32;
|
||||
use crate::time::Duration;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::os::windows::prelude::*;
|
||||
|
||||
use crate::convert::TryInto;
|
||||
use crate::ffi::OsString;
|
||||
use crate::fmt;
|
||||
use crate::io::{self, Error, IoSlice, IoSliceMut, ReadBuf, SeekFrom};
|
||||
|
@ -5,7 +5,6 @@ mod tests;
|
||||
|
||||
use crate::cmp;
|
||||
use crate::collections::BTreeMap;
|
||||
use crate::convert::{TryFrom, TryInto};
|
||||
use crate::env;
|
||||
use crate::env::consts::{EXE_EXTENSION, EXE_SUFFIX};
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::convert::TryInto;
|
||||
use crate::ffi::CStr;
|
||||
use crate::io;
|
||||
use crate::num::NonZeroUsize;
|
||||
|
@ -57,7 +57,6 @@
|
||||
// [3]: https://docs.microsoft.com/en-us/archive/msdn-magazine/2012/november/windows-with-c-the-evolution-of-synchronization-in-windows-and-c
|
||||
// [4]: Windows Internals, Part 1, ISBN 9780735671300
|
||||
|
||||
use crate::convert::TryFrom;
|
||||
use crate::pin::Pin;
|
||||
use crate::ptr;
|
||||
use crate::sync::atomic::{
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::cmp::Ordering;
|
||||
use crate::convert::TryInto;
|
||||
use crate::fmt;
|
||||
use crate::mem;
|
||||
use crate::sys::c;
|
||||
|
@ -2,7 +2,6 @@
|
||||
mod tests;
|
||||
|
||||
use crate::cmp;
|
||||
use crate::convert::{TryFrom, TryInto};
|
||||
use crate::ffi::CString;
|
||||
use crate::fmt;
|
||||
use crate::io::{self, ErrorKind, IoSlice, IoSliceMut};
|
||||
|
@ -25,7 +25,7 @@ use crate::char;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::hash::{Hash, Hasher};
|
||||
use crate::iter::{FromIterator, FusedIterator};
|
||||
use crate::iter::FusedIterator;
|
||||
use crate::mem;
|
||||
use crate::ops;
|
||||
use crate::rc::Rc;
|
||||
|
Loading…
Reference in New Issue
Block a user