liballoc: fix some idiom lints.

This commit is contained in:
Mazdak Farrokhzad
2019-02-02 12:48:12 +01:00
parent 95a9518957
commit 857530cef1
14 changed files with 90 additions and 87 deletions

View File

@@ -332,7 +332,7 @@ impl<B: ?Sized> fmt::Debug for Cow<'_, B>
where B: fmt::Debug + ToOwned, where B: fmt::Debug + ToOwned,
<B as ToOwned>::Owned: fmt::Debug <B as ToOwned>::Owned: fmt::Debug
{ {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self { match *self {
Borrowed(ref b) => fmt::Debug::fmt(b, f), Borrowed(ref b) => fmt::Debug::fmt(b, f),
Owned(ref o) => fmt::Debug::fmt(o, f), Owned(ref o) => fmt::Debug::fmt(o, f),
@@ -345,7 +345,7 @@ impl<B: ?Sized> fmt::Display for Cow<'_, B>
where B: fmt::Display + ToOwned, where B: fmt::Display + ToOwned,
<B as ToOwned>::Owned: fmt::Display <B as ToOwned>::Owned: fmt::Display
{ {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self { match *self {
Borrowed(ref b) => fmt::Display::fmt(b, f), Borrowed(ref b) => fmt::Display::fmt(b, f),
Owned(ref o) => fmt::Display::fmt(o, f), Owned(ref o) => fmt::Display::fmt(o, f),

View File

@@ -605,21 +605,21 @@ impl Box<dyn Any + Send> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Display + ?Sized> fmt::Display for Box<T> { impl<T: fmt::Display + ?Sized> fmt::Display for Box<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&**self, f) fmt::Display::fmt(&**self, f)
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Debug + ?Sized> fmt::Debug for Box<T> { impl<T: fmt::Debug + ?Sized> fmt::Debug for Box<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f) fmt::Debug::fmt(&**self, f)
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> fmt::Pointer for Box<T> { impl<T: ?Sized> fmt::Pointer for Box<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// It's not possible to extract the inner Uniq directly from the Box, // It's not possible to extract the inner Uniq directly from the Box,
// instead we cast it to a *const which aliases the Unique // instead we cast it to a *const which aliases the Unique
let ptr: *const T = &**self; let ptr: *const T = &**self;

View File

@@ -232,7 +232,7 @@ pub struct PeekMut<'a, T: 'a + Ord> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: Ord + fmt::Debug> fmt::Debug for PeekMut<'_, T> { impl<T: Ord + fmt::Debug> fmt::Debug for PeekMut<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("PeekMut") f.debug_tuple("PeekMut")
.field(&self.heap.data[0]) .field(&self.heap.data[0])
.finish() .finish()
@@ -295,7 +295,7 @@ impl<T: Ord> Default for BinaryHeap<T> {
#[stable(feature = "binaryheap_debug", since = "1.4.0")] #[stable(feature = "binaryheap_debug", since = "1.4.0")]
impl<T: fmt::Debug + Ord> fmt::Debug for BinaryHeap<T> { impl<T: fmt::Debug + Ord> fmt::Debug for BinaryHeap<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.iter()).finish() f.debug_list().entries(self.iter()).finish()
} }
} }
@@ -353,7 +353,7 @@ impl<T: Ord> BinaryHeap<T> {
/// } /// }
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<'_, T> {
Iter { iter: self.data.iter() } Iter { iter: self.data.iter() }
} }
@@ -404,7 +404,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(heap.peek(), Some(&2)); /// assert_eq!(heap.peek(), Some(&2));
/// ``` /// ```
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
pub fn peek_mut(&mut self) -> Option<PeekMut<T>> { pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T>> {
if self.is_empty() { if self.is_empty() {
None None
} else { } else {
@@ -765,7 +765,7 @@ impl<T: Ord> BinaryHeap<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "drain", since = "1.6.0")] #[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<T> { pub fn drain(&mut self) -> Drain<'_, T> {
Drain { iter: self.data.drain(..) } Drain { iter: self.data.drain(..) }
} }
@@ -937,7 +937,7 @@ pub struct Iter<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Iter") f.debug_tuple("Iter")
.field(&self.iter.as_slice()) .field(&self.iter.as_slice())
.finish() .finish()
@@ -1000,7 +1000,7 @@ pub struct IntoIter<T> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> { impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IntoIter") f.debug_tuple("IntoIter")
.field(&self.iter.as_slice()) .field(&self.iter.as_slice())
.finish() .finish()

View File

@@ -249,7 +249,7 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
fn replace(&mut self, key: K) -> Option<K> { fn replace(&mut self, key: K) -> Option<K> {
self.ensure_root_is_owned(); self.ensure_root_is_owned();
match search::search_tree::<marker::Mut, K, (), K>(self.root.as_mut(), &key) { match search::search_tree::<marker::Mut<'_>, K, (), K>(self.root.as_mut(), &key) {
Found(handle) => Some(mem::replace(handle.into_kv_mut().0, key)), Found(handle) => Some(mem::replace(handle.into_kv_mut().0, key)),
GoDown(handle) => { GoDown(handle) => {
VacantEntry { VacantEntry {
@@ -280,7 +280,7 @@ pub struct Iter<'a, K: 'a, V: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> { impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish() f.debug_list().entries(self.clone()).finish()
} }
} }
@@ -315,7 +315,7 @@ pub struct IntoIter<K, V> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> { impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let range = Range { let range = Range {
front: self.front.reborrow(), front: self.front.reborrow(),
back: self.back.reborrow(), back: self.back.reborrow(),
@@ -338,7 +338,7 @@ pub struct Keys<'a, K: 'a, V: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> { impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish() f.debug_list().entries(self.clone()).finish()
} }
} }
@@ -357,7 +357,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> { impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish() f.debug_list().entries(self.clone()).finish()
} }
} }
@@ -390,7 +390,7 @@ pub struct Range<'a, K: 'a, V: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Range<'_, K, V> { impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Range<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish() f.debug_list().entries(self.clone()).finish()
} }
} }
@@ -413,7 +413,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for RangeMut<'_, K, V> { impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for RangeMut<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let range = Range { let range = Range {
front: self.front.reborrow(), front: self.front.reborrow(),
back: self.back.reborrow(), back: self.back.reborrow(),
@@ -443,7 +443,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {
#[stable(feature= "debug_btree_map", since = "1.12.0")] #[stable(feature= "debug_btree_map", since = "1.12.0")]
impl<K: Debug + Ord, V: Debug> Debug for Entry<'_, K, V> { impl<K: Debug + Ord, V: Debug> Debug for Entry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self { match *self {
Vacant(ref v) => f.debug_tuple("Entry") Vacant(ref v) => f.debug_tuple("Entry")
.field(v) .field(v)
@@ -471,7 +471,7 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> {
#[stable(feature= "debug_btree_map", since = "1.12.0")] #[stable(feature= "debug_btree_map", since = "1.12.0")]
impl<K: Debug + Ord, V> Debug for VacantEntry<'_, K, V> { impl<K: Debug + Ord, V> Debug for VacantEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("VacantEntry") f.debug_tuple("VacantEntry")
.field(self.key()) .field(self.key())
.finish() .finish()
@@ -494,7 +494,7 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
#[stable(feature= "debug_btree_map", since = "1.12.0")] #[stable(feature= "debug_btree_map", since = "1.12.0")]
impl<K: Debug + Ord, V: Debug> Debug for OccupiedEntry<'_, K, V> { impl<K: Debug + Ord, V: Debug> Debug for OccupiedEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("OccupiedEntry") f.debug_struct("OccupiedEntry")
.field("key", self.key()) .field("key", self.key())
.field("value", self.get()) .field("value", self.get())
@@ -818,7 +818,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(Some((&5, &"b")), map.range(4..).next()); /// assert_eq!(Some((&5, &"b")), map.range(4..).next());
/// ``` /// ```
#[stable(feature = "btree_range", since = "1.17.0")] #[stable(feature = "btree_range", since = "1.17.0")]
pub fn range<T: ?Sized, R>(&self, range: R) -> Range<K, V> pub fn range<T: ?Sized, R>(&self, range: R) -> Range<'_, K, V>
where T: Ord, K: Borrow<T>, R: RangeBounds<T> where T: Ord, K: Borrow<T>, R: RangeBounds<T>
{ {
let root1 = self.root.as_ref(); let root1 = self.root.as_ref();
@@ -859,7 +859,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// } /// }
/// ``` /// ```
#[stable(feature = "btree_range", since = "1.17.0")] #[stable(feature = "btree_range", since = "1.17.0")]
pub fn range_mut<T: ?Sized, R>(&mut self, range: R) -> RangeMut<K, V> pub fn range_mut<T: ?Sized, R>(&mut self, range: R) -> RangeMut<'_, K, V>
where T: Ord, K: Borrow<T>, R: RangeBounds<T> where T: Ord, K: Borrow<T>, R: RangeBounds<T>
{ {
let root1 = self.root.as_mut(); let root1 = self.root.as_mut();
@@ -892,7 +892,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(count["a"], 3); /// assert_eq!(count["a"], 3);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn entry(&mut self, key: K) -> Entry<K, V> { pub fn entry(&mut self, key: K) -> Entry<'_, K, V> {
// FIXME(@porglezomp) Avoid allocating if we don't insert // FIXME(@porglezomp) Avoid allocating if we don't insert
self.ensure_root_is_owned(); self.ensure_root_is_owned();
match search::search_tree(self.root.as_mut(), &key) { match search::search_tree(self.root.as_mut(), &key) {
@@ -1783,7 +1783,7 @@ impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Debug, V: Debug> Debug for BTreeMap<K, V> { impl<K: Debug, V: Debug> Debug for BTreeMap<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_map().entries(self.iter()).finish() f.debug_map().entries(self.iter()).finish()
} }
} }
@@ -1940,7 +1940,7 @@ impl<K, V> BTreeMap<K, V> {
/// assert_eq!((*first_key, *first_value), (1, "a")); /// assert_eq!((*first_key, *first_value), (1, "a"));
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<K, V> { pub fn iter(&self) -> Iter<'_, K, V> {
Iter { Iter {
range: Range { range: Range {
front: first_leaf_edge(self.root.as_ref()), front: first_leaf_edge(self.root.as_ref()),
@@ -1972,7 +1972,7 @@ impl<K, V> BTreeMap<K, V> {
/// } /// }
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<K, V> { pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
let root1 = self.root.as_mut(); let root1 = self.root.as_mut();
let root2 = unsafe { ptr::read(&root1) }; let root2 = unsafe { ptr::read(&root1) };
IterMut { IterMut {
@@ -2049,7 +2049,7 @@ impl<K, V> BTreeMap<K, V> {
/// String::from("goodbye!")]); /// String::from("goodbye!")]);
/// ``` /// ```
#[stable(feature = "map_values_mut", since = "1.10.0")] #[stable(feature = "map_values_mut", since = "1.10.0")]
pub fn values_mut(&mut self) -> ValuesMut<K, V> { pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
ValuesMut { inner: self.iter_mut() } ValuesMut { inner: self.iter_mut() }
} }

View File

@@ -230,7 +230,7 @@ impl<K, V> Root<K, V> {
} }
pub fn as_ref(&self) pub fn as_ref(&self)
-> NodeRef<marker::Immut, K, V, marker::LeafOrInternal> { -> NodeRef<marker::Immut<'_>, K, V, marker::LeafOrInternal> {
NodeRef { NodeRef {
height: self.height, height: self.height,
node: self.node.as_ptr(), node: self.node.as_ptr(),
@@ -240,7 +240,7 @@ impl<K, V> Root<K, V> {
} }
pub fn as_mut(&mut self) pub fn as_mut(&mut self)
-> NodeRef<marker::Mut, K, V, marker::LeafOrInternal> { -> NodeRef<marker::Mut<'_>, K, V, marker::LeafOrInternal> {
NodeRef { NodeRef {
height: self.height, height: self.height,
node: self.node.as_ptr(), node: self.node.as_ptr(),
@@ -262,7 +262,7 @@ impl<K, V> Root<K, V> {
/// Adds a new internal node with a single edge, pointing to the previous root, and make that /// Adds a new internal node with a single edge, pointing to the previous root, and make that
/// new node the root. This increases the height by 1 and is the opposite of `pop_level`. /// new node the root. This increases the height by 1 and is the opposite of `pop_level`.
pub fn push_level(&mut self) pub fn push_level(&mut self)
-> NodeRef<marker::Mut, K, V, marker::Internal> { -> NodeRef<marker::Mut<'_>, K, V, marker::Internal> {
debug_assert!(!self.is_shared_root()); debug_assert!(!self.is_shared_root());
let mut new_node = Box::new(unsafe { InternalNode::new() }); let mut new_node = Box::new(unsafe { InternalNode::new() });
new_node.edges[0].set(unsafe { BoxedNode::from_ptr(self.node.as_ptr()) }); new_node.edges[0].set(unsafe { BoxedNode::from_ptr(self.node.as_ptr()) });
@@ -535,7 +535,7 @@ impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
/// Unsafely asserts to the compiler some static information about whether this /// Unsafely asserts to the compiler some static information about whether this
/// node is a `Leaf`. /// node is a `Leaf`.
unsafe fn cast_unchecked<NewType>(&mut self) unsafe fn cast_unchecked<NewType>(&mut self)
-> NodeRef<marker::Mut, K, V, NewType> { -> NodeRef<marker::Mut<'_>, K, V, NewType> {
NodeRef { NodeRef {
height: self.height, height: self.height,
@@ -555,7 +555,7 @@ impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
/// of a reborrowed handle, out of bounds. /// of a reborrowed handle, out of bounds.
// FIXME(@gereeter) consider adding yet another type parameter to `NodeRef` that restricts // FIXME(@gereeter) consider adding yet another type parameter to `NodeRef` that restricts
// the use of `ascend` and `into_root_mut` on reborrowed pointers, preventing this unsafety. // the use of `ascend` and `into_root_mut` on reborrowed pointers, preventing this unsafety.
unsafe fn reborrow_mut(&mut self) -> NodeRef<marker::Mut, K, V, Type> { unsafe fn reborrow_mut(&mut self) -> NodeRef<marker::Mut<'_>, K, V, Type> {
NodeRef { NodeRef {
height: self.height, height: self.height,
node: self.node, node: self.node,
@@ -932,7 +932,7 @@ impl<BorrowType, K, V, NodeType, HandleType>
/// Temporarily takes out another, immutable handle on the same location. /// Temporarily takes out another, immutable handle on the same location.
pub fn reborrow(&self) pub fn reborrow(&self)
-> Handle<NodeRef<marker::Immut, K, V, NodeType>, HandleType> { -> Handle<NodeRef<marker::Immut<'_>, K, V, NodeType>, HandleType> {
// We can't use Handle::new_kv or Handle::new_edge because we don't know our type // We can't use Handle::new_kv or Handle::new_edge because we don't know our type
Handle { Handle {
@@ -957,7 +957,7 @@ impl<'a, K, V, NodeType, HandleType>
// FIXME(@gereeter) consider adding yet another type parameter to `NodeRef` that restricts // FIXME(@gereeter) consider adding yet another type parameter to `NodeRef` that restricts
// the use of `ascend` and `into_root_mut` on reborrowed pointers, preventing this unsafety. // the use of `ascend` and `into_root_mut` on reborrowed pointers, preventing this unsafety.
pub unsafe fn reborrow_mut(&mut self) pub unsafe fn reborrow_mut(&mut self)
-> Handle<NodeRef<marker::Mut, K, V, NodeType>, HandleType> { -> Handle<NodeRef<marker::Mut<'_>, K, V, NodeType>, HandleType> {
// We can't use Handle::new_kv or Handle::new_edge because we don't know our type // We can't use Handle::new_kv or Handle::new_edge because we don't know our type
Handle { Handle {
@@ -1072,7 +1072,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
/// Unsafely asserts to the compiler some static information about whether the underlying /// Unsafely asserts to the compiler some static information about whether the underlying
/// node of this handle is a `Leaf`. /// node of this handle is a `Leaf`.
unsafe fn cast_unchecked<NewType>(&mut self) unsafe fn cast_unchecked<NewType>(&mut self)
-> Handle<NodeRef<marker::Mut, K, V, NewType>, marker::Edge> { -> Handle<NodeRef<marker::Mut<'_>, K, V, NewType>, marker::Edge> {
Handle::new_edge(self.node.cast_unchecked(), self.idx) Handle::new_edge(self.node.cast_unchecked(), self.idx)
} }
@@ -1562,8 +1562,8 @@ unsafe fn move_kv<K, V>(
// Source and destination must have the same height. // Source and destination must have the same height.
unsafe fn move_edges<K, V>( unsafe fn move_edges<K, V>(
mut source: NodeRef<marker::Mut, K, V, marker::Internal>, source_offset: usize, mut source: NodeRef<marker::Mut<'_>, K, V, marker::Internal>, source_offset: usize,
mut dest: NodeRef<marker::Mut, K, V, marker::Internal>, dest_offset: usize, mut dest: NodeRef<marker::Mut<'_>, K, V, marker::Internal>, dest_offset: usize,
count: usize) count: usize)
{ {
let source_ptr = source.as_internal_mut().edges.as_mut_ptr(); let source_ptr = source.as_internal_mut().edges.as_mut_ptr();

View File

@@ -80,7 +80,7 @@ pub struct Iter<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Iter") f.debug_tuple("Iter")
.field(&self.iter.clone()) .field(&self.iter.clone())
.finish() .finish()
@@ -128,7 +128,7 @@ pub struct Difference<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Difference<'_, T> { impl<T: fmt::Debug> fmt::Debug for Difference<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Difference") f.debug_tuple("Difference")
.field(&self.a) .field(&self.a)
.field(&self.b) .field(&self.b)
@@ -151,7 +151,7 @@ pub struct SymmetricDifference<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for SymmetricDifference<'_, T> { impl<T: fmt::Debug> fmt::Debug for SymmetricDifference<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("SymmetricDifference") f.debug_tuple("SymmetricDifference")
.field(&self.a) .field(&self.a)
.field(&self.b) .field(&self.b)
@@ -174,7 +174,7 @@ pub struct Intersection<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Intersection<'_, T> { impl<T: fmt::Debug> fmt::Debug for Intersection<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Intersection") f.debug_tuple("Intersection")
.field(&self.a) .field(&self.a)
.field(&self.b) .field(&self.b)
@@ -197,7 +197,7 @@ pub struct Union<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Union<'_, T> { impl<T: fmt::Debug> fmt::Debug for Union<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Union") f.debug_tuple("Union")
.field(&self.a) .field(&self.a)
.field(&self.b) .field(&self.b)
@@ -244,7 +244,7 @@ impl<T: Ord> BTreeSet<T> {
/// assert_eq!(Some(&5), set.range(4..).next()); /// assert_eq!(Some(&5), set.range(4..).next());
/// ``` /// ```
#[stable(feature = "btree_range", since = "1.17.0")] #[stable(feature = "btree_range", since = "1.17.0")]
pub fn range<K: ?Sized, R>(&self, range: R) -> Range<T> pub fn range<K: ?Sized, R>(&self, range: R) -> Range<'_, T>
where K: Ord, T: Borrow<K>, R: RangeBounds<K> where K: Ord, T: Borrow<K>, R: RangeBounds<K>
{ {
Range { iter: self.map.range(range) } Range { iter: self.map.range(range) }
@@ -706,7 +706,7 @@ impl<T> BTreeSet<T> {
/// assert_eq!(set_iter.next(), None); /// assert_eq!(set_iter.next(), None);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<'_, T> {
Iter { iter: self.map.keys() } Iter { iter: self.map.keys() }
} }
@@ -905,7 +905,7 @@ impl<T: Ord + Clone> BitOr<&BTreeSet<T>> for &BTreeSet<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Debug> Debug for BTreeSet<T> { impl<T: Debug> Debug for BTreeSet<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_set().entries(self.iter()).finish() f.debug_set().entries(self.iter()).finish()
} }
} }

View File

@@ -64,7 +64,7 @@ pub struct Iter<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Iter") f.debug_tuple("Iter")
.field(&self.len) .field(&self.len)
.finish() .finish()
@@ -96,7 +96,7 @@ pub struct IterMut<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> { impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IterMut") f.debug_tuple("IterMut")
.field(&self.list) .field(&self.list)
.field(&self.len) .field(&self.len)
@@ -119,7 +119,7 @@ pub struct IntoIter<T> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> { impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IntoIter") f.debug_tuple("IntoIter")
.field(&self.list) .field(&self.list)
.finish() .finish()
@@ -333,7 +333,7 @@ impl<T> LinkedList<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<'_, T> {
Iter { Iter {
head: self.head, head: self.head,
tail: self.tail, tail: self.tail,
@@ -367,7 +367,7 @@ impl<T> LinkedList<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<T> { pub fn iter_mut(&mut self) -> IterMut<'_, T> {
IterMut { IterMut {
head: self.head, head: self.head,
tail: self.tail, tail: self.tail,
@@ -766,7 +766,7 @@ impl<T> LinkedList<T> {
/// assert_eq!(odds.into_iter().collect::<Vec<_>>(), vec![1, 3, 5, 9, 11, 13, 15]); /// assert_eq!(odds.into_iter().collect::<Vec<_>>(), vec![1, 3, 5, 9, 11, 13, 15]);
/// ``` /// ```
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<T, F> pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, T, F>
where F: FnMut(&mut T) -> bool where F: FnMut(&mut T) -> bool
{ {
// avoid borrow issues. // avoid borrow issues.
@@ -1023,7 +1023,7 @@ impl<T, F> Drop for DrainFilter<'_, T, F>
impl<T: fmt::Debug, F> fmt::Debug for DrainFilter<'_, T, F> impl<T: fmt::Debug, F> fmt::Debug for DrainFilter<'_, T, F>
where F: FnMut(&mut T) -> bool where F: FnMut(&mut T) -> bool
{ {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("DrainFilter") f.debug_tuple("DrainFilter")
.field(&self.list) .field(&self.list)
.finish() .finish()
@@ -1166,7 +1166,7 @@ impl<T: Clone> Clone for LinkedList<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Debug> fmt::Debug for LinkedList<T> { impl<T: fmt::Debug> fmt::Debug for LinkedList<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self).finish() f.debug_list().entries(self).finish()
} }
} }

View File

@@ -801,7 +801,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(&c[..], b); /// assert_eq!(&c[..], b);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<'_, T> {
Iter { Iter {
tail: self.tail, tail: self.tail,
head: self.head, head: self.head,
@@ -827,7 +827,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(&buf.iter_mut().collect::<Vec<&mut i32>>()[..], b); /// assert_eq!(&buf.iter_mut().collect::<Vec<&mut i32>>()[..], b);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<T> { pub fn iter_mut(&mut self) -> IterMut<'_, T> {
IterMut { IterMut {
tail: self.tail, tail: self.tail,
head: self.head, head: self.head,
@@ -961,7 +961,7 @@ impl<T> VecDeque<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "drain", since = "1.6.0")] #[stable(feature = "drain", since = "1.6.0")]
pub fn drain<R>(&mut self, range: R) -> Drain<T> pub fn drain<R>(&mut self, range: R) -> Drain<'_, T>
where R: RangeBounds<usize> where R: RangeBounds<usize>
{ {
// Memory safety // Memory safety
@@ -2127,7 +2127,7 @@ pub struct Iter<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail); let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
f.debug_tuple("Iter") f.debug_tuple("Iter")
.field(&front) .field(&front)
@@ -2232,7 +2232,7 @@ pub struct IterMut<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<'a, T: fmt::Debug> fmt::Debug for IterMut<'_, T> { impl<'a, T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (front, back) = RingSlices::ring_slices(&*self.ring, self.head, self.tail); let (front, back) = RingSlices::ring_slices(&*self.ring, self.head, self.tail);
f.debug_tuple("IterMut") f.debug_tuple("IterMut")
.field(&front) .field(&front)
@@ -2323,7 +2323,7 @@ pub struct IntoIter<T> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> { impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IntoIter") f.debug_tuple("IntoIter")
.field(&self.inner) .field(&self.inner)
.finish() .finish()
@@ -2381,7 +2381,7 @@ pub struct Drain<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Drain<'_, T> { impl<T: fmt::Debug> fmt::Debug for Drain<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Drain") f.debug_tuple("Drain")
.field(&self.after_tail) .field(&self.after_tail)
.field(&self.after_head) .field(&self.after_head)
@@ -2657,7 +2657,7 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for VecDeque<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Debug> fmt::Debug for VecDeque<T> { impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self).finish() f.debug_list().entries(self).finish()
} }
} }

View File

@@ -552,7 +552,7 @@ use crate::string;
/// [`format_args!`]: ../../std/macro.format_args.html /// [`format_args!`]: ../../std/macro.format_args.html
/// [`format!`]: ../../std/macro.format.html /// [`format!`]: ../../std/macro.format.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn format(args: Arguments) -> string::String { pub fn format(args: Arguments<'_>) -> string::String {
let capacity = args.estimated_capacity(); let capacity = args.estimated_capacity();
let mut output = string::String::with_capacity(capacity); let mut output = string::String::with_capacity(capacity);
output output

View File

@@ -63,6 +63,9 @@
#![no_std] #![no_std]
#![needs_allocator] #![needs_allocator]
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
#![warn(deprecated_in_future)] #![warn(deprecated_in_future)]
#![warn(intra_doc_link_resolution_failure)] #![warn(intra_doc_link_resolution_failure)]
#![warn(missing_debug_implementations)] #![warn(missing_debug_implementations)]

View File

@@ -1122,21 +1122,21 @@ impl<T: ?Sized + Hash> Hash for Rc<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Display> fmt::Display for Rc<T> { impl<T: ?Sized + fmt::Display> fmt::Display for Rc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&**self, f) fmt::Display::fmt(&**self, f)
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for Rc<T> { impl<T: ?Sized + fmt::Debug> fmt::Debug for Rc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f) fmt::Debug::fmt(&**self, f)
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> fmt::Pointer for Rc<T> { impl<T: ?Sized> fmt::Pointer for Rc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Pointer::fmt(&(&**self as *const T), f) fmt::Pointer::fmt(&(&**self as *const T), f)
} }
} }
@@ -1460,7 +1460,7 @@ impl<T: ?Sized> Clone for Weak<T> {
#[stable(feature = "rc_weak", since = "1.4.0")] #[stable(feature = "rc_weak", since = "1.4.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> { impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "(Weak)") write!(f, "(Weak)")
} }
} }

View File

@@ -1494,7 +1494,7 @@ impl String {
/// assert_eq!(s, ""); /// assert_eq!(s, "");
/// ``` /// ```
#[stable(feature = "drain", since = "1.6.0")] #[stable(feature = "drain", since = "1.6.0")]
pub fn drain<R>(&mut self, range: R) -> Drain pub fn drain<R>(&mut self, range: R) -> Drain<'_>
where R: RangeBounds<usize> where R: RangeBounds<usize>
{ {
// Memory safety // Memory safety
@@ -1678,14 +1678,14 @@ impl FromUtf8Error {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for FromUtf8Error { impl fmt::Display for FromUtf8Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.error, f) fmt::Display::fmt(&self.error, f)
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for FromUtf16Error { impl fmt::Display for FromUtf16Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt("invalid utf-16: lone surrogate found", f) fmt::Display::fmt("invalid utf-16: lone surrogate found", f)
} }
} }
@@ -1876,7 +1876,7 @@ impl Default for String {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for String { impl fmt::Display for String {
#[inline] #[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&**self, f) fmt::Display::fmt(&**self, f)
} }
} }
@@ -1884,7 +1884,7 @@ impl fmt::Display for String {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for String { impl fmt::Debug for String {
#[inline] #[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f) fmt::Debug::fmt(&**self, f)
} }
} }
@@ -2106,14 +2106,14 @@ impl Clone for ParseError {
#[stable(feature = "str_parse_error", since = "1.5.0")] #[stable(feature = "str_parse_error", since = "1.5.0")]
impl fmt::Debug for ParseError { impl fmt::Debug for ParseError {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {} match *self {}
} }
} }
#[stable(feature = "str_parse_error2", since = "1.8.0")] #[stable(feature = "str_parse_error2", since = "1.8.0")]
impl fmt::Display for ParseError { impl fmt::Display for ParseError {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {} match *self {}
} }
} }
@@ -2374,7 +2374,7 @@ pub struct Drain<'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl fmt::Debug for Drain<'_> { impl fmt::Debug for Drain<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Drain { .. }") f.pad("Drain { .. }")
} }
} }

View File

@@ -257,7 +257,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Weak<U>> for Weak<T> {}
#[stable(feature = "arc_weak", since = "1.4.0")] #[stable(feature = "arc_weak", since = "1.4.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> { impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "(Weak)") write!(f, "(Weak)")
} }
} }
@@ -1554,21 +1554,21 @@ impl<T: ?Sized + Eq> Eq for Arc<T> {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Display> fmt::Display for Arc<T> { impl<T: ?Sized + fmt::Display> fmt::Display for Arc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&**self, f) fmt::Display::fmt(&**self, f)
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> { impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f) fmt::Debug::fmt(&**self, f)
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> fmt::Pointer for Arc<T> { impl<T: ?Sized> fmt::Pointer for Arc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Pointer::fmt(&(&**self as *const T), f) fmt::Pointer::fmt(&(&**self as *const T), f)
} }
} }

View File

@@ -1122,7 +1122,7 @@ impl<T> Vec<T> {
/// assert_eq!(v, &[]); /// assert_eq!(v, &[]);
/// ``` /// ```
#[stable(feature = "drain", since = "1.6.0")] #[stable(feature = "drain", since = "1.6.0")]
pub fn drain<R>(&mut self, range: R) -> Drain<T> pub fn drain<R>(&mut self, range: R) -> Drain<'_, T>
where R: RangeBounds<usize> where R: RangeBounds<usize>
{ {
// Memory safety // Memory safety
@@ -1979,7 +1979,7 @@ impl<T> Vec<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "vec_splice", since = "1.21.0")] #[stable(feature = "vec_splice", since = "1.21.0")]
pub fn splice<R, I>(&mut self, range: R, replace_with: I) -> Splice<I::IntoIter> pub fn splice<R, I>(&mut self, range: R, replace_with: I) -> Splice<'_, I::IntoIter>
where R: RangeBounds<usize>, I: IntoIterator<Item=T> where R: RangeBounds<usize>, I: IntoIterator<Item=T>
{ {
Splice { Splice {
@@ -2034,7 +2034,7 @@ impl<T> Vec<T> {
/// assert_eq!(odds, vec![1, 3, 5, 9, 11, 13, 15]); /// assert_eq!(odds, vec![1, 3, 5, 9, 11, 13, 15]);
/// ``` /// ```
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<T, F> pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, T, F>
where F: FnMut(&mut T) -> bool, where F: FnMut(&mut T) -> bool,
{ {
let old_len = self.len(); let old_len = self.len();
@@ -2150,7 +2150,7 @@ impl<T> Default for Vec<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Debug> fmt::Debug for Vec<T> { impl<T: fmt::Debug> fmt::Debug for Vec<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f) fmt::Debug::fmt(&**self, f)
} }
} }
@@ -2293,7 +2293,7 @@ pub struct IntoIter<T> {
#[stable(feature = "vec_intoiter_debug", since = "1.13.0")] #[stable(feature = "vec_intoiter_debug", since = "1.13.0")]
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> { impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IntoIter") f.debug_tuple("IntoIter")
.field(&self.as_slice()) .field(&self.as_slice())
.finish() .finish()
@@ -2463,7 +2463,7 @@ pub struct Drain<'a, T: 'a> {
#[stable(feature = "collection_debug", since = "1.17.0")] #[stable(feature = "collection_debug", since = "1.17.0")]
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Drain") f.debug_tuple("Drain")
.field(&self.iter.as_slice()) .field(&self.iter.as_slice())
.finish() .finish()
@@ -2652,7 +2652,7 @@ impl<T> Drain<'_, T> {
/// An iterator produced by calling `drain_filter` on Vec. /// An iterator produced by calling `drain_filter` on Vec.
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
#[derive(Debug)] #[derive(Debug)]
pub struct DrainFilter<'a, T: 'a, F> pub struct DrainFilter<'a, T, F>
where F: FnMut(&mut T) -> bool, where F: FnMut(&mut T) -> bool,
{ {
vec: &'a mut Vec<T>, vec: &'a mut Vec<T>,