liballoc: revert nested imports style changes.

This commit is contained in:
Mazdak Farrokhzad 2019-02-03 08:27:44 +01:00
parent 285106a40e
commit 2396780cda
34 changed files with 294 additions and 395 deletions

View File

@ -2,11 +2,9 @@
#![stable(feature = "alloc_module", since = "1.28.0")]
use core::{
intrinsics::{min_align_of_val, size_of_val},
ptr::{NonNull, Unique},
usize,
};
use core::intrinsics::{min_align_of_val, size_of_val};
use core::ptr::{NonNull, Unique};
use core::usize;
#[stable(feature = "alloc_module", since = "1.28.0")]
#[doc(inline)]
@ -230,10 +228,8 @@ pub fn handle_alloc_error(layout: Layout) -> ! {
mod tests {
extern crate test;
use test::Bencher;
use crate::{
boxed::Box,
alloc::{Global, Alloc, Layout, handle_alloc_error},
};
use crate::boxed::Box;
use crate::alloc::{Global, Alloc, Layout, handle_alloc_error};
#[test]
fn allocate_zeroed() {

View File

@ -1,8 +1,7 @@
use std::{
iter::Iterator,
vec::Vec,
collections::BTreeMap,
};
use std::iter::Iterator;
use std::vec::Vec;
use std::collections::BTreeMap;
use rand::{Rng, seq::SliceRandom, thread_rng};
use test::{Bencher, black_box};

View File

@ -1,8 +1,7 @@
use std::{mem, ptr};
use rand::{
thread_rng, Rng, SeedableRng,
distributions::{Standard, Alphanumeric},
};
use rand::{thread_rng, Rng, SeedableRng};
use rand::distributions::{Standard, Alphanumeric};
use rand_xorshift::XorShiftRng;
use test::{Bencher, black_box};

View File

@ -2,16 +2,15 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::{
cmp::Ordering,
hash::{Hash, Hasher},
ops::{Add, AddAssign, Deref},
};
use core::cmp::Ordering;
use core::hash::{Hash, Hasher};
use core::ops::{Add, AddAssign, Deref};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::borrow::{Borrow, BorrowMut};
use crate::{fmt, string::String};
use crate::fmt;
use crate::string::String;
use Cow::*;

View File

@ -56,28 +56,26 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::{
any::Any,
borrow,
cmp::Ordering,
convert::From,
fmt,
future::Future,
hash::{Hash, Hasher},
iter::{Iterator, FromIterator, FusedIterator},
marker::{Unpin, Unsize},
mem,
pin::Pin,
ops::{CoerceUnsized, DispatchFromDyn, Deref, DerefMut, Receiver, Generator, GeneratorState},
ptr::{self, NonNull, Unique},
task::{LocalWaker, Poll},
use core::any::Any;
use core::borrow;
use core::cmp::Ordering;
use core::convert::From;
use core::fmt;
use core::future::Future;
use core::hash::{Hash, Hasher};
use core::iter::{Iterator, FromIterator, FusedIterator};
use core::marker::{Unpin, Unsize};
use core::mem;
use core::pin::Pin;
use core::ops::{
CoerceUnsized, DispatchFromDyn, Deref, DerefMut, Receiver, Generator, GeneratorState
};
use core::ptr::{self, NonNull, Unique};
use core::task::{LocalWaker, Poll};
use crate::{
vec::Vec,
raw_vec::RawVec,
str::from_boxed_utf8_unchecked,
};
use crate::vec::Vec;
use crate::raw_vec::RawVec;
use crate::str::from_boxed_utf8_unchecked;
/// A pointer type for heap allocation.
///

View File

@ -1,13 +1,11 @@
//! Test for `boxed` mod.
use core::{
any::Any,
ops::Deref,
result::Result::{Err, Ok},
clone::Clone,
f64,
i64,
};
use core::any::Any;
use core::ops::Deref;
use core::result::Result::{Err, Ok};
use core::clone::Clone;
use core::f64;
use core::i64;
use std::boxed::Box;

View File

@ -145,18 +145,14 @@
#![allow(missing_docs)]
#![stable(feature = "rust1", since = "1.0.0")]
use core::{
ops::{Deref, DerefMut},
iter::{FromIterator, FusedIterator},
mem::{swap, size_of, ManuallyDrop},
ptr,
fmt,
};
use core::ops::{Deref, DerefMut};
use core::iter::{FromIterator, FusedIterator};
use core::mem::{swap, size_of, ManuallyDrop};
use core::ptr;
use core::fmt;
use crate::{
slice,
vec::{self, Vec},
};
use crate::slice;
use crate::vec::{self, Vec};
use super::SpecExtend;

View File

@ -1,21 +1,15 @@
use core::{
borrow::Borrow,
cmp::Ordering,
fmt::Debug,
hash::{Hash, Hasher},
iter::{FromIterator, Peekable, FusedIterator},
marker::PhantomData,
ops::{
Bound::{Excluded, Included, Unbounded},
Index, RangeBounds,
},
fmt, intrinsics, mem, ptr,
};
use core::borrow::Borrow;
use core::cmp::Ordering;
use core::fmt::Debug;
use core::hash::{Hash, Hasher};
use core::iter::{FromIterator, Peekable, FusedIterator};
use core::marker::PhantomData;
use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::{Index, RangeBounds};
use core::{fmt, intrinsics, mem, ptr};
use super::{
node::{self, Handle, NodeRef, marker, InsertResult::*, ForceResult::*},
search::{self, SearchResult::*},
};
use super::node::{self, Handle, NodeRef, marker, InsertResult::*, ForceResult::*};
use super::search::{self, SearchResult::*};
use UnderflowResult::*;
use Entry::*;

View File

@ -31,17 +31,13 @@
// - A node of length `n` has `n` keys, `n` values, and (in an internal node) `n + 1` edges.
// This implies that even an empty internal node has at least one edge.
use core::{
marker::PhantomData,
mem::{self, MaybeUninit},
ptr::{self, Unique, NonNull},
slice,
};
use core::marker::PhantomData;
use core::mem::{self, MaybeUninit};
use core::ptr::{self, Unique, NonNull};
use core::slice;
use crate::{
alloc::{Global, Alloc, Layout},
boxed::Box,
};
use crate::alloc::{Global, Alloc, Layout};
use crate::boxed::Box;
const B: usize = 6;
pub const MIN_LEN: usize = B - 1;

View File

@ -1,7 +1,5 @@
use core::{
borrow::Borrow,
cmp::Ordering,
};
use core::borrow::Borrow;
use core::cmp::Ordering;
use super::node::{Handle, NodeRef, marker, ForceResult::*};

View File

@ -1,16 +1,12 @@
// This is pretty much entirely stolen from TreeSet, since BTreeMap has an identical interface
// to TreeMap
use core::{
borrow::Borrow,
cmp::{
Ordering::{self, Less, Greater, Equal},
min, max,
},
fmt::{self, Debug},
iter::{Peekable, FromIterator, FusedIterator},
ops::{BitOr, BitAnd, BitXor, Sub, RangeBounds},
};
use core::borrow::Borrow;
use core::cmp::Ordering::{self, Less, Greater, Equal};
use core::cmp::{min, max};
use core::fmt::{self, Debug};
use core::iter::{Peekable, FromIterator, FusedIterator};
use core::ops::{BitOr, BitAnd, BitXor, Sub, RangeBounds};
use crate::collections::btree_map::{self, BTreeMap, Keys};
use super::Recover;

View File

@ -12,15 +12,13 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::{
cmp::Ordering,
fmt,
hash::{Hasher, Hash},
iter::{FromIterator, FusedIterator},
marker::PhantomData,
mem,
ptr::NonNull,
};
use core::cmp::Ordering;
use core::fmt;
use core::hash::{Hasher, Hash};
use core::iter::{FromIterator, FusedIterator};
use core::marker::PhantomData;
use core::mem;
use core::ptr::NonNull;
use crate::boxed::Box;
use super::SpecExtend;
@ -1215,8 +1213,11 @@ unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {}
#[cfg(test)]
mod tests {
use std::{thread, vec::Vec};
use std::thread;
use std::vec::Vec;
use rand::{thread_rng, RngCore};
use super::{LinkedList, Node};
#[cfg(test)]

View File

@ -7,25 +7,19 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::{
cmp::{self, Ordering},
fmt,
iter::{repeat_with, FromIterator, FusedIterator},
mem,
ops::{
Bound::{Excluded, Included, Unbounded},
Index, IndexMut, RangeBounds, Try,
},
ptr::{self, NonNull},
slice,
hash::{Hash, Hasher},
};
use core::cmp::{self, Ordering};
use core::fmt;
use core::iter::{repeat_with, FromIterator, FusedIterator};
use core::mem;
use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::{Index, IndexMut, RangeBounds, Try};
use core::ptr::{self, NonNull};
use core::slice;
use core::hash::{Hash, Hasher};
use crate::{
collections::CollectionAllocErr,
raw_vec::RawVec,
vec::Vec,
};
use crate::collections::CollectionAllocErr;
use crate::raw_vec::RawVec;
use crate::vec::Vec;
const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
const MINIMUM_CAPACITY: usize = 1; // 2 - 1

View File

@ -509,16 +509,21 @@
#[unstable(feature = "fmt_internals", issue = "0")]
pub use core::fmt::rt;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{
Formatter, Result, Write,
Binary, Octal,
Debug, Display,
LowerHex, Pointer, UpperHex,
LowerExp, UpperExp,
Error,
write, ArgumentV1, Arguments,
DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple
};
pub use core::fmt::{Formatter, Result, Write};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Binary, Octal};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Debug, Display};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{LowerHex, Pointer, UpperHex};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{LowerExp, UpperExp};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::Error;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{write, ArgumentV1, Arguments};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
#[stable(feature = "fmt_flags_align", since = "1.28.0")]
pub use core::fmt::{Alignment};

View File

@ -12,11 +12,8 @@
#![unstable(feature = "alloc", issue = "27783")]
#[unstable(feature = "alloc", issue = "27783")]
pub use crate::{
borrow::ToOwned,
boxed::Box,
slice::SliceConcatExt,
string::{String, ToString},
vec::Vec,
};
#[unstable(feature = "alloc", issue = "27783")] pub use crate::borrow::ToOwned;
#[unstable(feature = "alloc", issue = "27783")] pub use crate::boxed::Box;
#[unstable(feature = "alloc", issue = "27783")] pub use crate::slice::SliceConcatExt;
#[unstable(feature = "alloc", issue = "27783")] pub use crate::string::{String, ToString};
#[unstable(feature = "alloc", issue = "27783")] pub use crate::vec::Vec;

View File

@ -1,19 +1,15 @@
#![unstable(feature = "raw_vec_internals", reason = "implementation detail", issue = "0")]
#![doc(hidden)]
use core::{
cmp,
mem,
ops::Drop,
ptr::{self, NonNull, Unique},
slice,
};
use core::cmp;
use core::mem;
use core::ops::Drop;
use core::ptr::{self, NonNull, Unique};
use core::slice;
use crate::{
alloc::{Alloc, Layout, Global, handle_alloc_error},
collections::CollectionAllocErr::{self, *},
boxed::Box,
};
use crate::alloc::{Alloc, Layout, Global, handle_alloc_error};
use crate::collections::CollectionAllocErr::{self, *};
use crate::boxed::Box;
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
/// a buffer of memory on the heap without having to worry about all the corner cases

View File

@ -231,29 +231,25 @@ use crate::boxed::Box;
#[cfg(test)]
use std::boxed::Box;
use core::{
any::Any,
borrow,
cell::Cell,
cmp::Ordering,
fmt,
hash::{Hash, Hasher},
intrinsics::abort,
marker::{self, Unpin, Unsize, PhantomData},
mem::{self, align_of_val, forget, size_of_val},
ops::{Deref, Receiver, CoerceUnsized, DispatchFromDyn},
pin::Pin,
ptr::{self, NonNull},
slice::from_raw_parts_mut,
convert::From,
usize,
};
use core::any::Any;
use core::borrow;
use core::cell::Cell;
use core::cmp::Ordering;
use core::fmt;
use core::hash::{Hash, Hasher};
use core::intrinsics::abort;
use core::marker::{self, Unpin, Unsize, PhantomData};
use core::mem::{self, align_of_val, forget, size_of_val};
use core::ops::{Deref, Receiver, CoerceUnsized, DispatchFromDyn};
use core::pin::Pin;
use core::ptr::{self, NonNull};
use core::slice::from_raw_parts_mut;
use core::convert::From;
use core::usize;
use crate::{
alloc::{Global, Alloc, Layout, box_free, handle_alloc_error},
string::String,
vec::Vec,
};
use crate::alloc::{Global, Alloc, Layout, box_free, handle_alloc_error};
use crate::string::String;
use crate::vec::Vec;
struct RcBox<T: ?Sized> {
strong: Cell<usize>,
@ -1563,15 +1559,13 @@ impl<T: ?Sized> RcBoxPtr<T> for RcBox<T> {
#[cfg(test)]
mod tests {
use super::{Rc, Weak};
use std::{
boxed::Box,
cell::RefCell,
option::Option::{self, None, Some},
result::Result::{Err, Ok},
mem::drop,
clone::Clone,
convert::From,
};
use std::boxed::Box;
use std::cell::RefCell;
use std::option::Option::{self, None, Some};
use std::result::Result::{Err, Ok};
use std::mem::drop;
use std::clone::Clone;
use std::convert::From;
#[test]
fn test_clone() {
@ -1735,7 +1729,8 @@ mod tests {
#[test]
fn test_into_from_raw_unsized() {
use std::{fmt::Display, string::ToString};
use std::fmt::Display;
use std::string::ToString;
let rc: Rc<str> = Rc::from("foo");
@ -1943,7 +1938,8 @@ mod tests {
#[test]
fn test_from_box_trait() {
use std::{fmt::Display, string::ToString};
use std::fmt::Display;
use std::string::ToString;
let b: Box<dyn Display> = box 123;
let r: Rc<dyn Display> = Rc::from(b);

View File

@ -87,19 +87,15 @@
// It's cleaner to just turn off the unused_imports warning than to fix them.
#![cfg_attr(test, allow(unused_imports, dead_code))]
use core::{
borrow::{Borrow, BorrowMut},
cmp::Ordering::{self, Less},
mem::{self, size_of},
ptr,
u8, u16, u32,
};
use core::borrow::{Borrow, BorrowMut};
use core::cmp::Ordering::{self, Less};
use core::mem::{self, size_of};
use core::ptr;
use core::{u8, u16, u32};
use crate::{
borrow::ToOwned,
boxed::Box,
vec::Vec,
};
use crate::borrow::ToOwned;
use crate::boxed::Box;
use crate::vec::Vec;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{Chunks, Windows};
@ -142,8 +138,9 @@ pub use hack::to_vec;
// `test_permutations` test
mod hack {
use core::mem;
use crate::{boxed::Box, vec::Vec};
use crate::boxed::Box;
use crate::vec::Vec;
#[cfg(test)]
use crate::string::ToString;

View File

@ -28,26 +28,20 @@
// It's cleaner to just turn off the unused_imports warning than to fix them.
#![allow(unused_imports)]
use core::{
borrow::Borrow,
fmt,
str::{
self as core_str,
pattern::{Pattern, Searcher, ReverseSearcher, DoubleEndedSearcher},
},
mem,
ptr,
iter::FusedIterator,
unicode::conversions,
};
use core::borrow::Borrow;
use core::fmt;
use core::str as core_str;
use core::str::pattern::{Pattern, Searcher, ReverseSearcher, DoubleEndedSearcher};
use core::mem;
use core::ptr;
use core::iter::FusedIterator;
use core::unicode::conversions;
use crate::{
borrow::ToOwned,
boxed::Box,
slice::{SliceConcatExt, SliceIndex},
string::String,
vec::Vec,
};
use crate::borrow::ToOwned;
use crate::boxed::Box;
use crate::slice::{SliceConcatExt, SliceIndex};
use crate::string::String;
use crate::vec::Vec;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{FromStr, Utf8Error};

View File

@ -46,30 +46,20 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::{
char::{decode_utf16, REPLACEMENT_CHARACTER},
fmt,
hash,
iter::{FromIterator, FusedIterator},
ops::{
self,
Bound::{Excluded, Included, Unbounded},
Add, AddAssign, Index, IndexMut, RangeBounds,
},
ptr,
str::{
pattern::Pattern,
lossy,
}
};
use core::char::{decode_utf16, REPLACEMENT_CHARACTER};
use core::fmt;
use core::hash;
use core::iter::{FromIterator, FusedIterator};
use core::ops::{self, Add, AddAssign, Index, IndexMut, RangeBounds};
use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ptr;
use core::str::{pattern::Pattern, lossy};
use crate::{
borrow::{Cow, ToOwned},
collections::CollectionAllocErr,
boxed::Box,
str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars},
vec::Vec,
};
use crate::borrow::{Cow, ToOwned};
use crate::collections::CollectionAllocErr;
use crate::boxed::Box;
use crate::str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
use crate::vec::Vec;
/// A UTF-8 encoded, growable string.
///

View File

@ -6,34 +6,28 @@
//!
//! [arc]: struct.Arc.html
use core::{
any::Any,
sync::atomic::{
self,
Ordering::{Acquire, Relaxed, Release, SeqCst}
},
borrow,
fmt,
cmp::{self, Ordering},
intrinsics::abort,
mem::{self, align_of_val, size_of_val},
ops::{Deref, Receiver, CoerceUnsized, DispatchFromDyn},
pin::Pin,
ptr::{self, NonNull},
marker::{Unpin, Unsize, PhantomData},
hash::{Hash, Hasher},
isize, usize,
convert::From,
slice::from_raw_parts_mut,
};
use core::any::Any;
use core::sync::atomic;
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
use core::borrow;
use core::fmt;
use core::cmp::{self, Ordering};
use core::intrinsics::abort;
use core::mem::{self, align_of_val, size_of_val};
use core::ops::{Deref, Receiver, CoerceUnsized, DispatchFromDyn};
use core::pin::Pin;
use core::ptr::{self, NonNull};
use core::marker::{Unpin, Unsize, PhantomData};
use core::hash::{Hash, Hasher};
use core::{isize, usize};
use core::convert::From;
use core::slice::from_raw_parts_mut;
use crate::{
alloc::{Global, Alloc, Layout, box_free, handle_alloc_error},
boxed::Box,
rc::is_dangling,
string::String,
vec::Vec,
};
use crate::alloc::{Global, Alloc, Layout, box_free, handle_alloc_error};
use crate::boxed::Box;
use crate::rc::is_dangling;
use crate::string::String;
use crate::vec::Vec;
/// A soft limit on the amount of references that may be made to an `Arc`.
///
@ -1654,18 +1648,16 @@ impl<T> From<Vec<T>> for Arc<[T]> {
#[cfg(test)]
mod tests {
use std::{
boxed::Box,
clone::Clone,
sync::mpsc::channel,
mem::drop,
ops::Drop,
option::Option::{self, None, Some},
sync::atomic::{self, Ordering::{Acquire, SeqCst}},
thread,
sync::Mutex,
convert::From,
};
use std::boxed::Box;
use std::clone::Clone;
use std::sync::mpsc::channel;
use std::mem::drop;
use std::ops::Drop;
use std::option::Option::{self, None, Some};
use std::sync::atomic::{self, Ordering::{Acquire, SeqCst}};
use std::thread;
use std::sync::Mutex;
use std::convert::From;
use super::{Arc, Weak};
use crate::vec::Vec;
@ -1774,7 +1766,8 @@ mod tests {
#[test]
fn test_into_from_raw_unsized() {
use std::{fmt::Display, string::ToString};
use std::fmt::Display;
use std::string::ToString;
let arc: Arc<str> = Arc::from("foo");
@ -2086,7 +2079,8 @@ mod tests {
#[test]
fn test_from_box_trait() {
use std::{fmt::Display, string::ToString};
use std::fmt::Display;
use std::string::ToString;
let b: Box<dyn Display> = box 123;
let r: Arc<dyn Display> = Arc::from(b);

View File

@ -8,11 +8,9 @@ pub use if_arc::*;
#[cfg(all(target_has_atomic = "ptr", target_has_atomic = "cas"))]
mod if_arc {
use super::*;
use core::{
marker::PhantomData,
mem,
ptr::{self, NonNull},
};
use core::marker::PhantomData;
use core::mem;
use core::ptr::{self, NonNull};
use crate::sync::Arc;
/// A way of waking up a specific task.

View File

@ -1,9 +1,7 @@
use std::{
any::Any,
sync::{Arc, Weak},
cell::RefCell,
cmp::PartialEq,
};
use std::any::Any;
use std::sync::{Arc, Weak};
use std::cell::RefCell;
use std::cmp::PartialEq;
#[test]
fn uninhabited() {

View File

@ -1,9 +1,8 @@
use std::{
cmp,
collections::{BinaryHeap, binary_heap::{Drain, PeekMut}},
panic::{self, AssertUnwindSafe},
sync::atomic::{AtomicUsize, Ordering},
};
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::binary_heap::{Drain, PeekMut};
use std::panic::{self, AssertUnwindSafe};
use std::sync::atomic::{AtomicUsize, Ordering};
use rand::{thread_rng, seq::SliceRandom};

View File

@ -1,9 +1,8 @@
use std::{
collections::{BTreeMap, btree_map::Entry::{Occupied, Vacant}},
ops::Bound::{self, Excluded, Included, Unbounded},
rc::Rc,
iter::FromIterator,
};
use std::collections::BTreeMap;
use std::collections::btree_map::Entry::{Occupied, Vacant};
use std::ops::Bound::{self, Excluded, Included, Unbounded};
use std::rc::Rc;
use std::iter::FromIterator;
use super::DeterministicRng;

View File

@ -1,7 +1,6 @@
use std::{
collections::BTreeSet,
iter::FromIterator
};
use std::collections::BTreeSet;
use std::iter::FromIterator;
use super::DeterministicRng;
#[test]

View File

@ -13,10 +13,8 @@
extern crate core;
extern crate rand;
use std::{
hash::{Hash, Hasher},
collections::hash_map::DefaultHasher,
};
use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
mod arc;
mod binary_heap;

View File

@ -1,9 +1,7 @@
use std::{
any::Any,
rc::{Rc, Weak},
cell::RefCell,
cmp::PartialEq,
};
use std::any::Any;
use std::rc::{Rc, Weak};
use std::cell::RefCell;
use std::cmp::PartialEq;
#[test]
fn uninhabited() {

View File

@ -1,18 +1,14 @@
use std::{
cell::Cell,
cmp::Ordering::{self, Equal, Greater, Less},
mem,
panic,
rc::Rc,
sync::atomic::{Ordering::Relaxed, AtomicUsize},
thread,
};
use std::cell::Cell;
use std::cmp::Ordering::{self, Equal, Greater, Less};
use std::mem;
use std::panic;
use std::rc::Rc;
use std::sync::atomic::{Ordering::Relaxed, AtomicUsize};
use std::thread;
use rand::{
Rng, RngCore, thread_rng,
seq::SliceRandom,
distributions::Standard,
};
use rand::{Rng, RngCore, thread_rng};
use rand::seq::SliceRandom;
use rand::distributions::Standard;
fn square(n: usize) -> usize {
n * n

View File

@ -1,8 +1,6 @@
use std::{
borrow::Cow,
cmp::Ordering::{Equal, Greater, Less},
str::from_utf8,
};
use std::borrow::Cow;
use std::cmp::Ordering::{Equal, Greater, Less};
use std::str::from_utf8;
#[test]
fn test_le() {
@ -1601,10 +1599,8 @@ fn test_repeat() {
}
mod pattern {
use std::str::pattern::{
Pattern, Searcher, ReverseSearcher,
SearchStep::{self, Match, Reject, Done},
};
use std::str::pattern::{Pattern, Searcher, ReverseSearcher};
use std::str::pattern::SearchStep::{self, Match, Reject, Done};
macro_rules! make_test {
($name:ident, $p:expr, $h:expr, [$($e:expr,)*]) => {

View File

@ -1,9 +1,7 @@
use std::{
borrow::Cow,
collections::CollectionAllocErr::*,
mem::size_of,
usize, isize,
};
use std::borrow::Cow;
use std::collections::CollectionAllocErr::*;
use std::mem::size_of;
use std::{usize, isize};
pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
fn into_cow(self) -> Cow<'a, B>;

View File

@ -1,10 +1,8 @@
use std::{
borrow::Cow,
mem::size_of,
usize, isize,
vec::{Drain, IntoIter},
collections::CollectionAllocErr::*,
};
use std::borrow::Cow;
use std::mem::size_of;
use std::{usize, isize};
use std::vec::{Drain, IntoIter};
use std::collections::CollectionAllocErr::*;
struct DropCounter<'a> {
count: &'a mut u32,

View File

@ -1,12 +1,8 @@
use std::{
fmt::Debug,
collections::{
VecDeque, vec_deque::Drain,
CollectionAllocErr::*,
},
mem::size_of,
usize, isize,
};
use std::fmt::Debug;
use std::collections::{VecDeque, vec_deque::Drain};
use std::collections::CollectionAllocErr::*;
use std::mem::size_of;
use std::{usize, isize};
use crate::hash;

View File

@ -56,29 +56,22 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::{
cmp::{self, Ordering},
fmt,
hash::{self, Hash},
intrinsics::{arith_offset, assume},
iter::{FromIterator, FusedIterator, TrustedLen},
marker::PhantomData,
mem,
ops::{
self,
Bound::{Excluded, Included, Unbounded},
Index, IndexMut, RangeBounds,
},
ptr::{self, NonNull},
slice::{self, SliceIndex},
};
use core::cmp::{self, Ordering};
use core::fmt;
use core::hash::{self, Hash};
use core::intrinsics::{arith_offset, assume};
use core::iter::{FromIterator, FusedIterator, TrustedLen};
use core::marker::PhantomData;
use core::mem;
use core::ops::{self, Index, IndexMut, RangeBounds};
use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ptr::{self, NonNull};
use core::slice::{self, SliceIndex};
use crate::{
borrow::{ToOwned, Cow},
collections::CollectionAllocErr,
boxed::Box,
raw_vec::RawVec,
};
use crate::borrow::{ToOwned, Cow};
use crate::collections::CollectionAllocErr;
use crate::boxed::Box;
use crate::raw_vec::RawVec;
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
///