remove some unneeded imports
This commit is contained in:
parent
661b33f524
commit
ad2b34d0e3
55 changed files with 64 additions and 135 deletions
|
@ -1,5 +1,4 @@
|
|||
use std::collections::BTreeMap;
|
||||
use std::iter::Iterator;
|
||||
use std::ops::RangeBounds;
|
||||
use std::vec::Vec;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rand::RngCore;
|
||||
use std::iter::{repeat, FromIterator};
|
||||
use std::iter::repeat;
|
||||
use test::{black_box, Bencher};
|
||||
|
||||
#[bench]
|
||||
|
|
|
@ -150,16 +150,13 @@ use core::any::Any;
|
|||
use core::async_iter::AsyncIterator;
|
||||
use core::borrow;
|
||||
use core::cmp::Ordering;
|
||||
use core::convert::{From, TryFrom};
|
||||
use core::error::Error;
|
||||
use core::fmt;
|
||||
use core::future::Future;
|
||||
use core::hash::{Hash, Hasher};
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::iter::FromIterator;
|
||||
use core::iter::{FusedIterator, Iterator};
|
||||
use core::iter::FusedIterator;
|
||||
use core::marker::Tuple;
|
||||
use core::marker::{Unpin, Unsize};
|
||||
use core::marker::Unsize;
|
||||
use core::mem;
|
||||
use core::ops::{
|
||||
CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Generator, GeneratorState, Receiver,
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use core::fmt;
|
||||
use core::iter::{FromIterator, FusedIterator, InPlaceIterable, SourceIter, TrustedLen};
|
||||
use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedLen};
|
||||
use core::mem::{self, swap, ManuallyDrop};
|
||||
use core::num::NonZeroUsize;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
|
@ -263,7 +263,6 @@ mod tests;
|
|||
/// more detailed analysis.
|
||||
///
|
||||
/// [`core::cmp::Reverse`]: core::cmp::Reverse
|
||||
/// [`Ord`]: core::cmp::Ord
|
||||
/// [`Cell`]: core::cell::Cell
|
||||
/// [`RefCell`]: core::cell::RefCell
|
||||
/// [push]: BinaryHeap::push
|
||||
|
@ -1418,7 +1417,6 @@ impl<T> FusedIterator for Iter<'_, T> {}
|
|||
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: BinaryHeap::into_iter
|
||||
/// [`IntoIterator`]: core::iter::IntoIterator
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Clone)]
|
||||
pub struct IntoIter<T> {
|
||||
|
|
|
@ -3,7 +3,7 @@ use core::borrow::Borrow;
|
|||
use core::cmp::Ordering;
|
||||
use core::fmt::{self, Debug};
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::iter::{FromIterator, FusedIterator};
|
||||
use core::iter::FusedIterator;
|
||||
use core::marker::PhantomData;
|
||||
use core::mem::{self, ManuallyDrop};
|
||||
use core::ops::{Bound, Index, RangeBounds};
|
||||
|
@ -420,7 +420,6 @@ impl<'a, K: 'a, V: 'a> Default for IterMut<'a, K, V> {
|
|||
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: IntoIterator::into_iter
|
||||
/// [`IntoIterator`]: core::iter::IntoIterator
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_insignificant_dtor]
|
||||
pub struct IntoIter<
|
||||
|
@ -650,7 +649,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn clear(&mut self) {
|
||||
// avoid moving the allocator
|
||||
mem::drop(BTreeMap {
|
||||
drop(BTreeMap {
|
||||
root: mem::replace(&mut self.root, None),
|
||||
length: mem::replace(&mut self.length, 0),
|
||||
alloc: self.alloc.clone(),
|
||||
|
|
|
@ -9,8 +9,7 @@ use crate::testing::ord_chaos::{Cyclic3, Governed, Governor};
|
|||
use crate::testing::rng::DeterministicRng;
|
||||
use crate::vec::Vec;
|
||||
use std::cmp::Ordering;
|
||||
use std::convert::TryFrom;
|
||||
use std::iter::{self, FromIterator};
|
||||
use std::iter;
|
||||
use std::mem;
|
||||
use std::ops::Bound::{self, Excluded, Included, Unbounded};
|
||||
use std::ops::RangeBounds;
|
||||
|
|
|
@ -4,7 +4,7 @@ use core::cmp::Ordering::{self, Equal, Greater, Less};
|
|||
use core::cmp::{max, min};
|
||||
use core::fmt::{self, Debug};
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::iter::{FromIterator, FusedIterator, Peekable};
|
||||
use core::iter::{FusedIterator, Peekable};
|
||||
use core::mem::ManuallyDrop;
|
||||
use core::ops::{BitAnd, BitOr, BitXor, RangeBounds, Sub};
|
||||
|
||||
|
@ -30,7 +30,6 @@ use crate::alloc::{Allocator, Global};
|
|||
/// Iterators returned by [`BTreeSet::iter`] produce their items in order, and take worst-case
|
||||
/// logarithmic and amortized constant time per item returned.
|
||||
///
|
||||
/// [`Ord`]: core::cmp::Ord
|
||||
/// [`Cell`]: core::cell::Cell
|
||||
/// [`RefCell`]: core::cell::RefCell
|
||||
///
|
||||
|
@ -147,7 +146,6 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
|
|||
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: BTreeSet#method.into_iter
|
||||
/// [`IntoIterator`]: core::iter::IntoIterator
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Debug)]
|
||||
pub struct IntoIter<
|
||||
|
|
|
@ -4,7 +4,6 @@ use crate::testing::rng::DeterministicRng;
|
|||
use crate::vec::Vec;
|
||||
use std::cmp::Ordering;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::iter::FromIterator;
|
||||
use std::ops::Bound::{Excluded, Included};
|
||||
use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
use core::cmp::Ordering;
|
||||
use core::fmt;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::iter::{FromIterator, FusedIterator};
|
||||
use core::iter::FusedIterator;
|
||||
use core::marker::PhantomData;
|
||||
use core::mem;
|
||||
use core::ptr::NonNull;
|
||||
|
@ -130,7 +130,6 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
|
|||
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: LinkedList::into_iter
|
||||
/// [`IntoIterator`]: core::iter::IntoIterator
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<T> {
|
||||
|
|
|
@ -12,7 +12,6 @@ use super::VecDeque;
|
|||
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: VecDeque::into_iter
|
||||
/// [`IntoIterator`]: core::iter::IntoIterator
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
use core::cmp::{self, Ordering};
|
||||
use core::fmt;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::iter::{repeat_n, repeat_with, ByRefSized, FromIterator};
|
||||
use core::iter::{repeat_n, repeat_with, ByRefSized};
|
||||
use core::mem::{ManuallyDrop, SizedTypeProperties};
|
||||
use core::ops::{Index, IndexMut, Range, RangeBounds};
|
||||
use core::ptr;
|
||||
|
|
|
@ -4,7 +4,6 @@ use core::alloc::LayoutError;
|
|||
use core::cmp;
|
||||
use core::intrinsics;
|
||||
use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
|
||||
use core::ops::Drop;
|
||||
use core::ptr::{self, NonNull, Unique};
|
||||
use core::slice;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//!
|
||||
//! [`Rc`] uses non-atomic reference counting. This means that overhead is very
|
||||
//! low, but an [`Rc`] cannot be sent between threads, and consequently [`Rc`]
|
||||
//! does not implement [`Send`][send]. As a result, the Rust compiler
|
||||
//! does not implement [`Send`]. As a result, the Rust compiler
|
||||
//! will check *at compile time* that you are not sending [`Rc`]s between
|
||||
//! threads. If you need multi-threaded, atomic reference counting, use
|
||||
//! [`sync::Arc`][arc].
|
||||
|
@ -232,7 +232,6 @@
|
|||
//! [clone]: Clone::clone
|
||||
//! [`Cell`]: core::cell::Cell
|
||||
//! [`RefCell`]: core::cell::RefCell
|
||||
//! [send]: core::marker::Send
|
||||
//! [arc]: crate::sync::Arc
|
||||
//! [`Deref`]: core::ops::Deref
|
||||
//! [downgrade]: Rc::downgrade
|
||||
|
@ -251,13 +250,12 @@ use core::any::Any;
|
|||
use core::borrow;
|
||||
use core::cell::Cell;
|
||||
use core::cmp::Ordering;
|
||||
use core::convert::{From, TryFrom};
|
||||
use core::fmt;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::intrinsics::abort;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::iter;
|
||||
use core::marker::{self, PhantomData, Unpin, Unsize};
|
||||
use core::marker::{PhantomData, Unsize};
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::mem::size_of_val;
|
||||
use core::mem::{self, align_of_val_raw, forget};
|
||||
|
@ -321,7 +319,7 @@ pub struct Rc<T: ?Sized> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized> !marker::Send for Rc<T> {}
|
||||
impl<T: ?Sized> !Send for Rc<T> {}
|
||||
|
||||
// Note that this negative impl isn't strictly necessary for correctness,
|
||||
// as `Rc` transitively contains a `Cell`, which is itself `!Sync`.
|
||||
|
@ -329,7 +327,7 @@ impl<T: ?Sized> !marker::Send for Rc<T> {}
|
|||
// having an explicit negative impl is nice for documentation purposes
|
||||
// and results in nicer error messages.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized> !marker::Sync for Rc<T> {}
|
||||
impl<T: ?Sized> !Sync for Rc<T> {}
|
||||
|
||||
#[stable(feature = "catch_unwind", since = "1.9.0")]
|
||||
impl<T: RefUnwindSafe + ?Sized> UnwindSafe for Rc<T> {}
|
||||
|
@ -1060,7 +1058,7 @@ impl<T: ?Sized> Rc<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rc_mutate_strong_count", since = "1.53.0")]
|
||||
pub unsafe fn decrement_strong_count(ptr: *const T) {
|
||||
unsafe { mem::drop(Rc::from_raw(ptr)) };
|
||||
unsafe { drop(Rc::from_raw(ptr)) };
|
||||
}
|
||||
|
||||
/// Returns `true` if there are no other `Rc` or [`Weak`] pointers to
|
||||
|
@ -1496,7 +1494,7 @@ impl<T> Rc<[T]> {
|
|||
///
|
||||
/// Behavior is undefined should the size be wrong.
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
unsafe fn from_iter_exact(iter: impl iter::Iterator<Item = T>, len: usize) -> Rc<[T]> {
|
||||
unsafe fn from_iter_exact(iter: impl Iterator<Item = T>, len: usize) -> Rc<[T]> {
|
||||
// Panic guard while cloning T elements.
|
||||
// In the event of a panic, elements that have been written
|
||||
// into the new RcBox will be dropped, then the memory freed.
|
||||
|
@ -2088,7 +2086,7 @@ impl<T, const N: usize> TryFrom<Rc<[T]>> for Rc<[T; N]> {
|
|||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "shared_from_iter", since = "1.37.0")]
|
||||
impl<T> iter::FromIterator<T> for Rc<[T]> {
|
||||
impl<T> FromIterator<T> for Rc<[T]> {
|
||||
/// Takes each element in the `Iterator` and collects it into an `Rc<[T]>`.
|
||||
///
|
||||
/// # Performance characteristics
|
||||
|
@ -2127,7 +2125,7 @@ impl<T> iter::FromIterator<T> for Rc<[T]> {
|
|||
/// let evens: Rc<[u8]> = (0..10).collect(); // Just a single allocation happens here.
|
||||
/// # assert_eq!(&*evens, &*(0..10).collect::<Vec<_>>());
|
||||
/// ```
|
||||
fn from_iter<I: iter::IntoIterator<Item = T>>(iter: I) -> Self {
|
||||
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
|
||||
ToRcSlice::to_rc_slice(iter.into_iter())
|
||||
}
|
||||
}
|
||||
|
@ -2204,9 +2202,9 @@ pub struct Weak<T: ?Sized> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rc_weak", since = "1.4.0")]
|
||||
impl<T: ?Sized> !marker::Send for Weak<T> {}
|
||||
impl<T: ?Sized> !Send for Weak<T> {}
|
||||
#[stable(feature = "rc_weak", since = "1.4.0")]
|
||||
impl<T: ?Sized> !marker::Sync for Weak<T> {}
|
||||
impl<T: ?Sized> !Sync for Weak<T> {}
|
||||
|
||||
#[unstable(feature = "coerce_unsized", issue = "18598")]
|
||||
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Weak<U>> for Weak<T> {}
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
use core::error::Error;
|
||||
use core::fmt;
|
||||
use core::hash;
|
||||
use core::iter::FusedIterator;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::iter::{from_fn, FromIterator};
|
||||
use core::iter::from_fn;
|
||||
use core::iter::FusedIterator;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::ops::Add;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
use core::any::Any;
|
||||
use core::borrow;
|
||||
use core::cmp::Ordering;
|
||||
use core::convert::{From, TryFrom};
|
||||
use core::fmt;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::hint;
|
||||
use core::intrinsics::abort;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::iter;
|
||||
use core::marker::{PhantomData, Unpin, Unsize};
|
||||
use core::marker::{PhantomData, Unsize};
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::mem::size_of_val;
|
||||
use core::mem::{self, align_of_val_raw};
|
||||
|
@ -188,8 +187,6 @@ macro_rules! acquire {
|
|||
/// [mutex]: ../../std/sync/struct.Mutex.html
|
||||
/// [rwlock]: ../../std/sync/struct.RwLock.html
|
||||
/// [atomic]: core::sync::atomic
|
||||
/// [`Send`]: core::marker::Send
|
||||
/// [`Sync`]: core::marker::Sync
|
||||
/// [deref]: core::ops::Deref
|
||||
/// [downgrade]: Arc::downgrade
|
||||
/// [upgrade]: Weak::upgrade
|
||||
|
@ -1241,7 +1238,7 @@ impl<T: ?Sized> Arc<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "arc_mutate_strong_count", since = "1.51.0")]
|
||||
pub unsafe fn decrement_strong_count(ptr: *const T) {
|
||||
unsafe { mem::drop(Arc::from_raw(ptr)) };
|
||||
unsafe { drop(Arc::from_raw(ptr)) };
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -1404,7 +1401,7 @@ impl<T> Arc<[T]> {
|
|||
///
|
||||
/// Behavior is undefined should the size be wrong.
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
unsafe fn from_iter_exact(iter: impl iter::Iterator<Item = T>, len: usize) -> Arc<[T]> {
|
||||
unsafe fn from_iter_exact(iter: impl Iterator<Item = T>, len: usize) -> Arc<[T]> {
|
||||
// Panic guard while cloning T elements.
|
||||
// In the event of a panic, elements that have been written
|
||||
// into the new ArcInner will be dropped, then the memory freed.
|
||||
|
@ -2818,7 +2815,7 @@ impl<T, const N: usize> TryFrom<Arc<[T]>> for Arc<[T; N]> {
|
|||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "shared_from_iter", since = "1.37.0")]
|
||||
impl<T> iter::FromIterator<T> for Arc<[T]> {
|
||||
impl<T> FromIterator<T> for Arc<[T]> {
|
||||
/// Takes each element in the `Iterator` and collects it into an `Arc<[T]>`.
|
||||
///
|
||||
/// # Performance characteristics
|
||||
|
@ -2857,7 +2854,7 @@ impl<T> iter::FromIterator<T> for Arc<[T]> {
|
|||
/// let evens: Arc<[u8]> = (0..10).collect(); // Just a single allocation happens here.
|
||||
/// # assert_eq!(&*evens, &*(0..10).collect::<Vec<_>>());
|
||||
/// ```
|
||||
fn from_iter<I: iter::IntoIterator<Item = T>>(iter: I) -> Self {
|
||||
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
|
||||
ToArcSlice::to_arc_slice(iter.into_iter())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::borrow::Cow;
|
||||
use core::iter::FromIterator;
|
||||
|
||||
use super::Vec;
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ impl<T, A: Allocator> IntoIter<T, A> {
|
|||
/// ```
|
||||
/// # let mut into_iter = Vec::<u8>::with_capacity(10).into_iter();
|
||||
/// let mut into_iter = std::mem::replace(&mut into_iter, Vec::new().into_iter());
|
||||
/// (&mut into_iter).for_each(core::mem::drop);
|
||||
/// (&mut into_iter).for_each(drop);
|
||||
/// std::mem::forget(into_iter);
|
||||
/// ```
|
||||
///
|
||||
|
|
|
@ -56,12 +56,9 @@
|
|||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::cmp;
|
||||
use core::cmp::Ordering;
|
||||
use core::convert::TryFrom;
|
||||
use core::fmt;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::iter;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::iter::FromIterator;
|
||||
use core::marker::PhantomData;
|
||||
use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
|
||||
use core::ops::{self, Index, IndexMut, Range, RangeBounds};
|
||||
|
@ -2990,7 +2987,7 @@ impl<'a, T: Copy + 'a, A: Allocator + 'a> Extend<&'a T> for Vec<T, A> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Implements comparison of vectors, [lexicographically](core::cmp::Ord#lexicographical-comparison).
|
||||
/// Implements comparison of vectors, [lexicographically](Ord#lexicographical-comparison).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: PartialOrd, A: Allocator> PartialOrd for Vec<T, A> {
|
||||
#[inline]
|
||||
|
@ -3002,7 +2999,7 @@ impl<T: PartialOrd, A: Allocator> PartialOrd for Vec<T, A> {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Eq, A: Allocator> Eq for Vec<T, A> {}
|
||||
|
||||
/// Implements ordering of vectors, [lexicographically](core::cmp::Ord#lexicographical-comparison).
|
||||
/// Implements ordering of vectors, [lexicographically](Ord#lexicographical-comparison).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Ord, A: Allocator> Ord for Vec<T, A> {
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue