]> git.lizzy.rs Git - rust.git/commitdiff
Replace PlaceBack Debug implementation with derive
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 20 Jan 2017 23:33:38 +0000 (00:33 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 5 Feb 2017 08:46:15 +0000 (09:46 +0100)
src/libcollections/binary_heap.rs
src/libcollections/btree/map.rs
src/libcollections/btree/set.rs
src/libcollections/enum_set.rs
src/libcollections/linked_list.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcollections/vec.rs
src/libcollections/vec_deque.rs

index b9d90c358fe21c12a9b4ef5bbafd50cb7ac9216f..fa1c2b7d2aaf9aa77f76fca0e4316d0046f6c5b8 100644 (file)
@@ -228,7 +228,7 @@ pub struct PeekMut<'a, T: 'a + Ord> {
     sift: bool,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_tuple("PeekMut")
@@ -977,10 +977,10 @@ pub struct Iter<'a, T: 'a> {
     iter: slice::Iter<'a, T>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("BinaryHeap::Iter")
+        f.debug_tuple("Iter")
          .field(&self.iter.as_slice())
          .finish()
     }
@@ -1034,10 +1034,10 @@ pub struct IntoIter<T> {
     iter: vec::IntoIter<T>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[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 {
-        f.debug_tuple("BinaryHeap::IntoIter")
+        f.debug_tuple("IntoIter")
          .field(&self.iter.as_slice())
          .finish()
     }
@@ -1078,19 +1078,11 @@ impl<T> FusedIterator for IntoIter<T> {}
 
 /// An iterator that drains a `BinaryHeap`.
 #[stable(feature = "drain", since = "1.6.0")]
+#[derive(Debug)]
 pub struct Drain<'a, T: 'a> {
     iter: vec::Drain<'a, T>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
-impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("BinaryHeap::Drain")
-         .field(&self.iter)
-         .finish()
-    }
-}
-
 #[stable(feature = "drain", since = "1.6.0")]
 impl<'a, T: 'a> Iterator for Drain<'a, T> {
     type Item = T;
@@ -1236,11 +1228,13 @@ pub struct BinaryHeapPlace<'a, T: 'a>
     place: vec::PlaceBack<'a, T>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[unstable(feature = "collection_placement",
+           reason = "placement protocol is subject to change",
+           issue = "30172")]
 impl<'a, T: Clone + Ord + fmt::Debug> fmt::Debug for BinaryHeapPlace<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_tuple("BinaryHeapPlace")
-         .field(&self)
+         .field(&self.place)
          .finish()
     }
 }
index eb6a8ea26a3baa95a6d469951275088aabdddf5d..e1fabe2cc496b2fb18c63fcd6984aec9ddd8279b 100644 (file)
@@ -270,7 +270,7 @@ pub struct Iter<'a, K: 'a, V: 'a> {
     length: usize,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list().entries(self.clone()).finish()
@@ -279,18 +279,12 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 /// A mutable iterator over a BTreeMap's entries.
 #[stable(feature = "rust1", since = "1.0.0")]
+#[derive(Debug)]
 pub struct IterMut<'a, K: 'a, V: 'a> {
     range: RangeMut<'a, K, V>,
     length: usize,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
-impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.pad(&format!("BTreeMap::IterMut({:?})", self.range))
-    }
-}
-
 /// An owning iterator over a BTreeMap's entries.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct IntoIter<K, V> {
@@ -299,7 +293,7 @@ pub struct IntoIter<K, V> {
     length: usize,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[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 {
         let range = Range {
@@ -316,7 +310,7 @@ pub struct Keys<'a, K: 'a, V: 'a> {
     inner: Iter<'a, K, V>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list().entries(self.inner.clone()).finish()
@@ -329,7 +323,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
     inner: Iter<'a, K, V>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list().entries(self.inner.clone()).finish()
@@ -338,24 +332,18 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 /// A mutable iterator over a BTreeMap's values.
 #[stable(feature = "map_values_mut", since = "1.10.0")]
+#[derive(Debug)]
 pub struct ValuesMut<'a, K: 'a, V: 'a> {
     inner: IterMut<'a, K, V>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
-impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.pad(&format!("BTreeMap::ValuesMut({:?})", self.inner))
-    }
-}
-
 /// An iterator over a sub-range of BTreeMap's entries.
 pub struct Range<'a, K: 'a, V: 'a> {
     front: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
     back: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list().entries(self.clone()).finish()
@@ -371,7 +359,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
     _marker: PhantomData<&'a mut (K, V)>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let range = Range {
index f90d0df768b9ff4c9bcea4648c173e3675e21065..bfffa0b8efa1cb074168f78c6217055e5371caed 100644 (file)
@@ -85,10 +85,10 @@ pub struct Iter<'a, T: 'a> {
     iter: Keys<'a, T, ()>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("BTreeSet::Iter")
+        f.debug_tuple("Iter")
          .field(&self.iter.clone())
          .finish()
     }
@@ -101,34 +101,22 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 ///
 /// [`BTreeSet`]: struct.BTreeSet.html
 #[stable(feature = "rust1", since = "1.0.0")]
+#[derive(Debug)]
 pub struct IntoIter<T> {
     iter: ::btree_map::IntoIter<T, ()>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
-impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.pad(&format!("BTreeSet::IntoIter({:?})", self.iter))
-    }
-}
-
 /// An iterator over a sub-range of `BTreeSet`'s items.
 ///
 /// This structure is created by the [`range`] method on [`BTreeSet`].
 ///
 /// [`BTreeSet`]: struct.BTreeSet.html
 /// [`range`]: struct.BTreeSet.html#method.range
+#[derive(Debug)]
 pub struct Range<'a, T: 'a> {
     iter: ::btree_map::Range<'a, T, ()>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
-impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.pad(&format!("BTreeSet::Range({:?})", self.iter))
-    }
-}
-
 /// A lazy iterator producing elements in the set difference (in-order).
 ///
 /// This structure is created by the [`difference`] method on [`BTreeSet`].
@@ -141,10 +129,10 @@ pub struct Difference<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("BTreeSet::Difference")
+        f.debug_tuple("Difference")
          .field(&self.clone())
          .finish()
     }
@@ -163,10 +151,10 @@ pub struct SymmetricDifference<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("BTreeSet::SymmetricDifference")
+        f.debug_tuple("SymmetricDifference")
          .field(&self.clone())
          .finish()
     }
@@ -184,10 +172,10 @@ pub struct Intersection<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("BTreeSet::Intersection")
+        f.debug_tuple("Intersection")
          .field(&self.clone())
          .finish()
     }
@@ -205,10 +193,10 @@ pub struct Union<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("BTreeSet::Union")
+        f.debug_tuple("Union")
          .field(&self.clone())
          .finish()
     }
index e4498c176170909ea941fa3a8b482b0051f2648d..9bbb10136437c866cd089172783ed14d2fdf07d8 100644 (file)
@@ -220,10 +220,9 @@ pub struct Iter<E> {
     marker: marker::PhantomData<E>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
 impl<E: fmt::Debug> fmt::Debug for Iter<E> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("EnumSet::Iter")
+        f.debug_tuple("Iter")
          .field(&self.clone())
          .finish()
     }
index 21be9ac1aab879b6a95a31c940279788fd7f6b11..d4f77d625b361d4633f2a538486d02d1fc3dd218 100644 (file)
@@ -65,10 +65,10 @@ pub struct Iter<'a, T: 'a> {
     marker: PhantomData<&'a Node<T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("LinkedList::Iter")
+        f.debug_tuple("Iter")
          .field(&self.clone())
          .finish()
     }
@@ -91,10 +91,10 @@ pub struct IterMut<'a, T: 'a> {
     len: usize,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("LinkedList::IterMut")
+        f.debug_tuple("IterMut")
          .field(self.clone())
          .finish()
     }
@@ -107,10 +107,10 @@ pub struct IntoIter<T> {
     list: LinkedList<T>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[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 {
-        f.debug_tuple("LinkedList::IntoIter")
+        f.debug_tuple("IntoIter")
          .field(self.clone())
          .finish()
     }
@@ -1104,10 +1104,12 @@ pub struct FrontPlace<'a, T: 'a> {
     node: IntermediateBox<Node<T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[unstable(feature = "collection_placement",
+           reason = "struct name and placement protocol are subject to change",
+           issue = "30172")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("LinkedList::FrontPlace")
+        f.debug_tuple("FrontPlace")
          .field(self.clone())
          .finish()
     }
@@ -1157,10 +1159,12 @@ pub struct BackPlace<'a, T: 'a> {
     node: IntermediateBox<Node<T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[unstable(feature = "collection_placement",
+           reason = "struct name and placement protocol are subject to change",
+           issue = "30172")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("LinkedList::BackPlace")
+        f.debug_tuple("BackPlace")
          .field(self.clone())
          .finish()
     }
index 8dbddbb41d7bce198b8361c0d28c934ae38638e9..da5e8d03ea83efb2457b2cba0d437f679a4e6fe3 100644 (file)
@@ -123,7 +123,7 @@ pub struct EncodeUtf16<'a> {
     encoder: Utf16Encoder<Chars<'a>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a> fmt::Debug for EncodeUtf16<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("EncodeUtf16 { .. }")
index 1a9849f2352a33f4c76031334e00fd5ba35a3140..15a533d6d87cb95591c327eec0913a18e47f5c8c 100644 (file)
@@ -1979,10 +1979,10 @@ pub struct Drain<'a> {
     iter: Chars<'a>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a> fmt::Debug for Drain<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.pad("String::Drain { .. }")
+        f.pad("Drain { .. }")
     }
 }
 
index 2b6343782b1999a05935cd975b0f00e87f64ae9f..97ce404a11f7191a672cabc01089dcc82e77747f 100644 (file)
@@ -2092,10 +2092,10 @@ pub struct Drain<'a, T: 'a> {
     vec: Shared<Vec<T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[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 {
-        f.debug_tuple("Vec::Drain")
+        f.debug_tuple("Drain")
          .field(&self.iter.as_slice())
          .finish()
     }
@@ -2167,19 +2167,11 @@ impl<'a, T> FusedIterator for Drain<'a, T> {}
 #[unstable(feature = "collection_placement",
            reason = "struct name and placement protocol are subject to change",
            issue = "30172")]
+#[derive(Debug)]
 pub struct PlaceBack<'a, T: 'a> {
     vec: &'a mut Vec<T>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
-impl<'a, T: 'a + fmt::Debug> fmt::Debug for PlaceBack<'a, T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("Vec::PlaceBack")
-         .field(&self.vec.as_slice())
-         .finish()
-    }
-}
-
 #[unstable(feature = "collection_placement",
            reason = "placement protocol is subject to change",
            issue = "30172")]
index 11aacb0ff43d1861dbe3701a07b6f82df7902ff3..a88a70888c50c013efbc49fd6136a41cf2fffff3 100644 (file)
@@ -1866,10 +1866,10 @@ pub struct Iter<'a, T: 'a> {
     head: usize,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("VecDeque::Iter")
+        f.debug_tuple("Iter")
          .field(&self.clone())
          .finish()
     }
@@ -1947,10 +1947,10 @@ pub struct IterMut<'a, T: 'a> {
     head: usize,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[stable(feature = "collection_debug", since = "1.17.0")]
 impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("VecDeque::IterMut")
+        f.debug_tuple("IterMut")
          .field(&self.clone())
          .finish()
     }
@@ -2022,10 +2022,10 @@ pub struct IntoIter<T> {
     inner: VecDeque<T>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[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 {
-        f.debug_tuple("VecDeque::IntoIter")
+        f.debug_tuple("IntoIter")
          .field(&self.clone())
          .finish()
     }
@@ -2074,10 +2074,10 @@ pub struct Drain<'a, T: 'a> {
     deque: Shared<VecDeque<T>>,
 }
 
-#[stable(feature = "collection_debug", since = "1.15.0")]
+#[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 {
-        f.debug_tuple("VecDeque::Drain")
+        f.debug_tuple("Drain")
          .field(&self.clone())
          .finish()
     }