liballoc: fix some idiom lints.
This commit is contained in:
@@ -332,7 +332,7 @@ impl<B: ?Sized> fmt::Debug for Cow<'_, B>
|
||||
where B: fmt::Debug + ToOwned,
|
||||
<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 {
|
||||
Borrowed(ref b) => fmt::Debug::fmt(b, 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,
|
||||
<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 {
|
||||
Borrowed(ref b) => fmt::Display::fmt(b, f),
|
||||
Owned(ref o) => fmt::Display::fmt(o, f),
|
||||
|
||||
@@ -605,21 +605,21 @@ impl Box<dyn Any + Send> {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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,
|
||||
// instead we cast it to a *const which aliases the Unique
|
||||
let ptr: *const T = &**self;
|
||||
|
||||
@@ -232,7 +232,7 @@ pub struct PeekMut<'a, T: 'a + Ord> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.heap.data[0])
|
||||
.finish()
|
||||
@@ -295,7 +295,7 @@ impl<T: Ord> Default for BinaryHeap<T> {
|
||||
|
||||
#[stable(feature = "binaryheap_debug", since = "1.4.0")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
pub fn iter(&self) -> Iter<'_, T> {
|
||||
Iter { iter: self.data.iter() }
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
/// assert_eq!(heap.peek(), Some(&2));
|
||||
/// ```
|
||||
#[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() {
|
||||
None
|
||||
} else {
|
||||
@@ -765,7 +765,7 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[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(..) }
|
||||
}
|
||||
|
||||
@@ -937,7 +937,7 @@ pub struct Iter<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.iter.as_slice())
|
||||
.finish()
|
||||
@@ -1000,7 +1000,7 @@ pub struct IntoIter<T> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.iter.as_slice())
|
||||
.finish()
|
||||
|
||||
@@ -249,7 +249,7 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
|
||||
|
||||
fn replace(&mut self, key: K) -> Option<K> {
|
||||
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)),
|
||||
GoDown(handle) => {
|
||||
VacantEntry {
|
||||
@@ -280,7 +280,7 @@ pub struct Iter<'a, K: 'a, V: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ pub struct IntoIter<K, V> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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 {
|
||||
front: self.front.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")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -357,7 +357,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -390,7 +390,7 @@ pub struct Range<'a, K: 'a, V: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -413,7 +413,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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 {
|
||||
front: self.front.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")]
|
||||
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 {
|
||||
Vacant(ref v) => f.debug_tuple("Entry")
|
||||
.field(v)
|
||||
@@ -471,7 +471,7 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> {
|
||||
|
||||
#[stable(feature= "debug_btree_map", since = "1.12.0")]
|
||||
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")
|
||||
.field(self.key())
|
||||
.finish()
|
||||
@@ -494,7 +494,7 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
|
||||
|
||||
#[stable(feature= "debug_btree_map", since = "1.12.0")]
|
||||
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")
|
||||
.field("key", self.key())
|
||||
.field("value", self.get())
|
||||
@@ -818,7 +818,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
|
||||
/// assert_eq!(Some((&5, &"b")), map.range(4..).next());
|
||||
/// ```
|
||||
#[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>
|
||||
{
|
||||
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")]
|
||||
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>
|
||||
{
|
||||
let root1 = self.root.as_mut();
|
||||
@@ -892,7 +892,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
|
||||
/// assert_eq!(count["a"], 3);
|
||||
/// ```
|
||||
#[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
|
||||
self.ensure_root_is_owned();
|
||||
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")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -1940,7 +1940,7 @@ impl<K, V> BTreeMap<K, V> {
|
||||
/// assert_eq!((*first_key, *first_value), (1, "a"));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<K, V> {
|
||||
pub fn iter(&self) -> Iter<'_, K, V> {
|
||||
Iter {
|
||||
range: Range {
|
||||
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")]
|
||||
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 root2 = unsafe { ptr::read(&root1) };
|
||||
IterMut {
|
||||
@@ -2049,7 +2049,7 @@ impl<K, V> BTreeMap<K, V> {
|
||||
/// String::from("goodbye!")]);
|
||||
/// ```
|
||||
#[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() }
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ impl<K, V> Root<K, V> {
|
||||
}
|
||||
|
||||
pub fn as_ref(&self)
|
||||
-> NodeRef<marker::Immut, K, V, marker::LeafOrInternal> {
|
||||
-> NodeRef<marker::Immut<'_>, K, V, marker::LeafOrInternal> {
|
||||
NodeRef {
|
||||
height: self.height,
|
||||
node: self.node.as_ptr(),
|
||||
@@ -240,7 +240,7 @@ impl<K, V> Root<K, V> {
|
||||
}
|
||||
|
||||
pub fn as_mut(&mut self)
|
||||
-> NodeRef<marker::Mut, K, V, marker::LeafOrInternal> {
|
||||
-> NodeRef<marker::Mut<'_>, K, V, marker::LeafOrInternal> {
|
||||
NodeRef {
|
||||
height: self.height,
|
||||
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
|
||||
/// new node the root. This increases the height by 1 and is the opposite of `pop_level`.
|
||||
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());
|
||||
let mut new_node = Box::new(unsafe { InternalNode::new() });
|
||||
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
|
||||
/// node is a `Leaf`.
|
||||
unsafe fn cast_unchecked<NewType>(&mut self)
|
||||
-> NodeRef<marker::Mut, K, V, NewType> {
|
||||
-> NodeRef<marker::Mut<'_>, K, V, NewType> {
|
||||
|
||||
NodeRef {
|
||||
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.
|
||||
// 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.
|
||||
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 {
|
||||
height: self.height,
|
||||
node: self.node,
|
||||
@@ -932,7 +932,7 @@ impl<BorrowType, K, V, NodeType, HandleType>
|
||||
|
||||
/// Temporarily takes out another, immutable handle on the same location.
|
||||
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
|
||||
Handle {
|
||||
@@ -957,7 +957,7 @@ impl<'a, K, V, NodeType, HandleType>
|
||||
// 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.
|
||||
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
|
||||
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
|
||||
/// node of this handle is a `Leaf`.
|
||||
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)
|
||||
}
|
||||
@@ -1562,8 +1562,8 @@ unsafe fn move_kv<K, V>(
|
||||
|
||||
// Source and destination must have the same height.
|
||||
unsafe fn move_edges<K, V>(
|
||||
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 source: NodeRef<marker::Mut<'_>, K, V, marker::Internal>, source_offset: usize,
|
||||
mut dest: NodeRef<marker::Mut<'_>, K, V, marker::Internal>, dest_offset: usize,
|
||||
count: usize)
|
||||
{
|
||||
let source_ptr = source.as_internal_mut().edges.as_mut_ptr();
|
||||
|
||||
@@ -80,7 +80,7 @@ pub struct Iter<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.iter.clone())
|
||||
.finish()
|
||||
@@ -128,7 +128,7 @@ pub struct Difference<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.a)
|
||||
.field(&self.b)
|
||||
@@ -151,7 +151,7 @@ pub struct SymmetricDifference<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.a)
|
||||
.field(&self.b)
|
||||
@@ -174,7 +174,7 @@ pub struct Intersection<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.a)
|
||||
.field(&self.b)
|
||||
@@ -197,7 +197,7 @@ pub struct Union<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.a)
|
||||
.field(&self.b)
|
||||
@@ -244,7 +244,7 @@ impl<T: Ord> BTreeSet<T> {
|
||||
/// assert_eq!(Some(&5), set.range(4..).next());
|
||||
/// ```
|
||||
#[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>
|
||||
{
|
||||
Range { iter: self.map.range(range) }
|
||||
@@ -706,7 +706,7 @@ impl<T> BTreeSet<T> {
|
||||
/// assert_eq!(set_iter.next(), None);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
pub fn iter(&self) -> Iter<'_, T> {
|
||||
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")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ pub struct Iter<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.len)
|
||||
.finish()
|
||||
@@ -96,7 +96,7 @@ pub struct IterMut<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.list)
|
||||
.field(&self.len)
|
||||
@@ -119,7 +119,7 @@ pub struct IntoIter<T> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.list)
|
||||
.finish()
|
||||
@@ -333,7 +333,7 @@ impl<T> LinkedList<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
pub fn iter(&self) -> Iter<'_, T> {
|
||||
Iter {
|
||||
head: self.head,
|
||||
tail: self.tail,
|
||||
@@ -367,7 +367,7 @@ impl<T> LinkedList<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter_mut(&mut self) -> IterMut<T> {
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
|
||||
IterMut {
|
||||
head: self.head,
|
||||
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]);
|
||||
/// ```
|
||||
#[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
|
||||
{
|
||||
// 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>
|
||||
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")
|
||||
.field(&self.list)
|
||||
.finish()
|
||||
@@ -1166,7 +1166,7 @@ impl<T: Clone> Clone for LinkedList<T> {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -801,7 +801,7 @@ impl<T> VecDeque<T> {
|
||||
/// assert_eq!(&c[..], b);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
pub fn iter(&self) -> Iter<'_, T> {
|
||||
Iter {
|
||||
tail: self.tail,
|
||||
head: self.head,
|
||||
@@ -827,7 +827,7 @@ impl<T> VecDeque<T> {
|
||||
/// assert_eq!(&buf.iter_mut().collect::<Vec<&mut i32>>()[..], b);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter_mut(&mut self) -> IterMut<T> {
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
|
||||
IterMut {
|
||||
tail: self.tail,
|
||||
head: self.head,
|
||||
@@ -961,7 +961,7 @@ impl<T> VecDeque<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[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>
|
||||
{
|
||||
// Memory safety
|
||||
@@ -2127,7 +2127,7 @@ pub struct Iter<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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);
|
||||
f.debug_tuple("Iter")
|
||||
.field(&front)
|
||||
@@ -2232,7 +2232,7 @@ pub struct IterMut<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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);
|
||||
f.debug_tuple("IterMut")
|
||||
.field(&front)
|
||||
@@ -2323,7 +2323,7 @@ pub struct IntoIter<T> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.inner)
|
||||
.finish()
|
||||
@@ -2381,7 +2381,7 @@ pub struct Drain<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.after_tail)
|
||||
.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")]
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ use crate::string;
|
||||
/// [`format_args!`]: ../../std/macro.format_args.html
|
||||
/// [`format!`]: ../../std/macro.format.html
|
||||
#[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 mut output = string::String::with_capacity(capacity);
|
||||
output
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
#![no_std]
|
||||
#![needs_allocator]
|
||||
|
||||
#![deny(rust_2018_idioms)]
|
||||
#![allow(explicit_outlives_requirements)]
|
||||
|
||||
#![warn(deprecated_in_future)]
|
||||
#![warn(intra_doc_link_resolution_failure)]
|
||||
#![warn(missing_debug_implementations)]
|
||||
|
||||
@@ -1122,21 +1122,21 @@ impl<T: ?Sized + Hash> Hash for Rc<T> {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -1460,7 +1460,7 @@ impl<T: ?Sized> Clone for Weak<T> {
|
||||
|
||||
#[stable(feature = "rc_weak", since = "1.4.0")]
|
||||
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)")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1494,7 +1494,7 @@ impl String {
|
||||
/// assert_eq!(s, "");
|
||||
/// ```
|
||||
#[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>
|
||||
{
|
||||
// Memory safety
|
||||
@@ -1678,14 +1678,14 @@ impl FromUtf8Error {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -1876,7 +1876,7 @@ impl Default for String {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Display for String {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&**self, f)
|
||||
}
|
||||
}
|
||||
@@ -1884,7 +1884,7 @@ impl fmt::Display for String {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Debug for String {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(&**self, f)
|
||||
}
|
||||
}
|
||||
@@ -2106,14 +2106,14 @@ impl Clone for ParseError {
|
||||
|
||||
#[stable(feature = "str_parse_error", since = "1.5.0")]
|
||||
impl fmt::Debug for ParseError {
|
||||
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "str_parse_error2", since = "1.8.0")]
|
||||
impl fmt::Display for ParseError {
|
||||
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
@@ -2374,7 +2374,7 @@ pub struct Drain<'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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 { .. }")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")]
|
||||
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)")
|
||||
}
|
||||
}
|
||||
@@ -1554,21 +1554,21 @@ impl<T: ?Sized + Eq> Eq for Arc<T> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,7 +1122,7 @@ impl<T> Vec<T> {
|
||||
/// assert_eq!(v, &[]);
|
||||
/// ```
|
||||
#[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>
|
||||
{
|
||||
// Memory safety
|
||||
@@ -1979,7 +1979,7 @@ impl<T> Vec<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[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>
|
||||
{
|
||||
Splice {
|
||||
@@ -2034,7 +2034,7 @@ impl<T> Vec<T> {
|
||||
/// assert_eq!(odds, vec![1, 3, 5, 9, 11, 13, 15]);
|
||||
/// ```
|
||||
#[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,
|
||||
{
|
||||
let old_len = self.len();
|
||||
@@ -2150,7 +2150,7 @@ impl<T> Default for Vec<T> {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -2293,7 +2293,7 @@ pub struct IntoIter<T> {
|
||||
|
||||
#[stable(feature = "vec_intoiter_debug", since = "1.13.0")]
|
||||
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")
|
||||
.field(&self.as_slice())
|
||||
.finish()
|
||||
@@ -2463,7 +2463,7 @@ pub struct Drain<'a, T: 'a> {
|
||||
|
||||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
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")
|
||||
.field(&self.iter.as_slice())
|
||||
.finish()
|
||||
@@ -2652,7 +2652,7 @@ impl<T> Drain<'_, T> {
|
||||
/// An iterator produced by calling `drain_filter` on Vec.
|
||||
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
|
||||
#[derive(Debug)]
|
||||
pub struct DrainFilter<'a, T: 'a, F>
|
||||
pub struct DrainFilter<'a, T, F>
|
||||
where F: FnMut(&mut T) -> bool,
|
||||
{
|
||||
vec: &'a mut Vec<T>,
|
||||
|
||||
Reference in New Issue
Block a user