Skip to content

Commit 0cc2448

Browse files
Replace PlaceBack Debug implementation with derive
1 parent 668af80 commit 0cc2448

File tree

9 files changed

+59
-94
lines changed

9 files changed

+59
-94
lines changed

src/libcollections/binary_heap.rs

+10-16
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pub struct PeekMut<'a, T: 'a + Ord> {
228228
sift: bool,
229229
}
230230

231-
#[stable(feature = "collection_debug", since = "1.15.0")]
231+
#[stable(feature = "collection_debug", since = "1.17.0")]
232232
impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> {
233233
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
234234
f.debug_tuple("PeekMut")
@@ -977,10 +977,10 @@ pub struct Iter<'a, T: 'a> {
977977
iter: slice::Iter<'a, T>,
978978
}
979979

980-
#[stable(feature = "collection_debug", since = "1.15.0")]
980+
#[stable(feature = "collection_debug", since = "1.17.0")]
981981
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
982982
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
983-
f.debug_tuple("BinaryHeap::Iter")
983+
f.debug_tuple("Iter")
984984
.field(&self.iter.as_slice())
985985
.finish()
986986
}
@@ -1034,10 +1034,10 @@ pub struct IntoIter<T> {
10341034
iter: vec::IntoIter<T>,
10351035
}
10361036

1037-
#[stable(feature = "collection_debug", since = "1.15.0")]
1037+
#[stable(feature = "collection_debug", since = "1.17.0")]
10381038
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
10391039
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1040-
f.debug_tuple("BinaryHeap::IntoIter")
1040+
f.debug_tuple("IntoIter")
10411041
.field(&self.iter.as_slice())
10421042
.finish()
10431043
}
@@ -1078,19 +1078,11 @@ impl<T> FusedIterator for IntoIter<T> {}
10781078

10791079
/// An iterator that drains a `BinaryHeap`.
10801080
#[stable(feature = "drain", since = "1.6.0")]
1081+
#[derive(Debug)]
10811082
pub struct Drain<'a, T: 'a> {
10821083
iter: vec::Drain<'a, T>,
10831084
}
10841085

1085-
#[stable(feature = "collection_debug", since = "1.15.0")]
1086-
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> {
1087-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1088-
f.debug_tuple("BinaryHeap::Drain")
1089-
.field(&self.iter)
1090-
.finish()
1091-
}
1092-
}
1093-
10941086
#[stable(feature = "drain", since = "1.6.0")]
10951087
impl<'a, T: 'a> Iterator for Drain<'a, T> {
10961088
type Item = T;
@@ -1236,11 +1228,13 @@ where T: Clone + Ord {
12361228
place: vec::PlaceBack<'a, T>,
12371229
}
12381230

1239-
#[stable(feature = "collection_debug", since = "1.15.0")]
1231+
#[unstable(feature = "collection_placement",
1232+
reason = "placement protocol is subject to change",
1233+
issue = "30172")]
12401234
impl<'a, T: Clone + Ord + fmt::Debug> fmt::Debug for BinaryHeapPlace<'a, T> {
12411235
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12421236
f.debug_tuple("BinaryHeapPlace")
1243-
.field(&self)
1237+
.field(&self.place)
12441238
.finish()
12451239
}
12461240
}

src/libcollections/btree/map.rs

+8-20
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub struct Iter<'a, K: 'a, V: 'a> {
270270
length: usize,
271271
}
272272

273-
#[stable(feature = "collection_debug", since = "1.15.0")]
273+
#[stable(feature = "collection_debug", since = "1.17.0")]
274274
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> {
275275
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
276276
f.debug_list().entries(self.clone()).finish()
@@ -279,18 +279,12 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> {
279279

280280
/// A mutable iterator over a BTreeMap's entries.
281281
#[stable(feature = "rust1", since = "1.0.0")]
282+
#[derive(Debug)]
282283
pub struct IterMut<'a, K: 'a, V: 'a> {
283284
range: RangeMut<'a, K, V>,
284285
length: usize,
285286
}
286287

287-
#[stable(feature = "collection_debug", since = "1.15.0")]
288-
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> {
289-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
290-
f.pad(&format!("BTreeMap::IterMut({:?})", self.range))
291-
}
292-
}
293-
294288
/// An owning iterator over a BTreeMap's entries.
295289
#[stable(feature = "rust1", since = "1.0.0")]
296290
pub struct IntoIter<K, V> {
@@ -299,7 +293,7 @@ pub struct IntoIter<K, V> {
299293
length: usize,
300294
}
301295

302-
#[stable(feature = "collection_debug", since = "1.15.0")]
296+
#[stable(feature = "collection_debug", since = "1.17.0")]
303297
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> {
304298
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
305299
let range = Range {
@@ -316,7 +310,7 @@ pub struct Keys<'a, K: 'a, V: 'a> {
316310
inner: Iter<'a, K, V>,
317311
}
318312

319-
#[stable(feature = "collection_debug", since = "1.15.0")]
313+
#[stable(feature = "collection_debug", since = "1.17.0")]
320314
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> {
321315
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
322316
f.debug_list().entries(self.inner.clone()).finish()
@@ -329,7 +323,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
329323
inner: Iter<'a, K, V>,
330324
}
331325

332-
#[stable(feature = "collection_debug", since = "1.15.0")]
326+
#[stable(feature = "collection_debug", since = "1.17.0")]
333327
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> {
334328
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
335329
f.debug_list().entries(self.inner.clone()).finish()
@@ -338,24 +332,18 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V>
338332

339333
/// A mutable iterator over a BTreeMap's values.
340334
#[stable(feature = "map_values_mut", since = "1.10.0")]
335+
#[derive(Debug)]
341336
pub struct ValuesMut<'a, K: 'a, V: 'a> {
342337
inner: IterMut<'a, K, V>,
343338
}
344339

345-
#[stable(feature = "collection_debug", since = "1.15.0")]
346-
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> {
347-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
348-
f.pad(&format!("BTreeMap::ValuesMut({:?})", self.inner))
349-
}
350-
}
351-
352340
/// An iterator over a sub-range of BTreeMap's entries.
353341
pub struct Range<'a, K: 'a, V: 'a> {
354342
front: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
355343
back: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
356344
}
357345

358-
#[stable(feature = "collection_debug", since = "1.15.0")]
346+
#[stable(feature = "collection_debug", since = "1.17.0")]
359347
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> {
360348
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
361349
f.debug_list().entries(self.clone()).finish()
@@ -371,7 +359,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
371359
_marker: PhantomData<&'a mut (K, V)>,
372360
}
373361

374-
#[stable(feature = "collection_debug", since = "1.15.0")]
362+
#[stable(feature = "collection_debug", since = "1.17.0")]
375363
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> {
376364
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
377365
let range = Range {

src/libcollections/btree/set.rs

+12-24
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ pub struct Iter<'a, T: 'a> {
8585
iter: Keys<'a, T, ()>,
8686
}
8787

88-
#[stable(feature = "collection_debug", since = "1.15.0")]
88+
#[stable(feature = "collection_debug", since = "1.17.0")]
8989
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
9090
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
91-
f.debug_tuple("BTreeSet::Iter")
91+
f.debug_tuple("Iter")
9292
.field(&self.iter.clone())
9393
.finish()
9494
}
@@ -101,34 +101,22 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
101101
///
102102
/// [`BTreeSet`]: struct.BTreeSet.html
103103
#[stable(feature = "rust1", since = "1.0.0")]
104+
#[derive(Debug)]
104105
pub struct IntoIter<T> {
105106
iter: ::btree_map::IntoIter<T, ()>,
106107
}
107108

108-
#[stable(feature = "collection_debug", since = "1.15.0")]
109-
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
110-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
111-
f.pad(&format!("BTreeSet::IntoIter({:?})", self.iter))
112-
}
113-
}
114-
115109
/// An iterator over a sub-range of `BTreeSet`'s items.
116110
///
117111
/// This structure is created by the [`range`] method on [`BTreeSet`].
118112
///
119113
/// [`BTreeSet`]: struct.BTreeSet.html
120114
/// [`range`]: struct.BTreeSet.html#method.range
115+
#[derive(Debug)]
121116
pub struct Range<'a, T: 'a> {
122117
iter: ::btree_map::Range<'a, T, ()>,
123118
}
124119

125-
#[stable(feature = "collection_debug", since = "1.15.0")]
126-
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> {
127-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
128-
f.pad(&format!("BTreeSet::Range({:?})", self.iter))
129-
}
130-
}
131-
132120
/// A lazy iterator producing elements in the set difference (in-order).
133121
///
134122
/// This structure is created by the [`difference`] method on [`BTreeSet`].
@@ -141,10 +129,10 @@ pub struct Difference<'a, T: 'a> {
141129
b: Peekable<Iter<'a, T>>,
142130
}
143131

144-
#[stable(feature = "collection_debug", since = "1.15.0")]
132+
#[stable(feature = "collection_debug", since = "1.17.0")]
145133
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> {
146134
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
147-
f.debug_tuple("BTreeSet::Difference")
135+
f.debug_tuple("Difference")
148136
.field(&self.clone())
149137
.finish()
150138
}
@@ -163,10 +151,10 @@ pub struct SymmetricDifference<'a, T: 'a> {
163151
b: Peekable<Iter<'a, T>>,
164152
}
165153

166-
#[stable(feature = "collection_debug", since = "1.15.0")]
154+
#[stable(feature = "collection_debug", since = "1.17.0")]
167155
impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> {
168156
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
169-
f.debug_tuple("BTreeSet::SymmetricDifference")
157+
f.debug_tuple("SymmetricDifference")
170158
.field(&self.clone())
171159
.finish()
172160
}
@@ -184,10 +172,10 @@ pub struct Intersection<'a, T: 'a> {
184172
b: Peekable<Iter<'a, T>>,
185173
}
186174

187-
#[stable(feature = "collection_debug", since = "1.15.0")]
175+
#[stable(feature = "collection_debug", since = "1.17.0")]
188176
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> {
189177
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
190-
f.debug_tuple("BTreeSet::Intersection")
178+
f.debug_tuple("Intersection")
191179
.field(&self.clone())
192180
.finish()
193181
}
@@ -205,10 +193,10 @@ pub struct Union<'a, T: 'a> {
205193
b: Peekable<Iter<'a, T>>,
206194
}
207195

208-
#[stable(feature = "collection_debug", since = "1.15.0")]
196+
#[stable(feature = "collection_debug", since = "1.17.0")]
209197
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> {
210198
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
211-
f.debug_tuple("BTreeSet::Union")
199+
f.debug_tuple("Union")
212200
.field(&self.clone())
213201
.finish()
214202
}

src/libcollections/enum_set.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,9 @@ pub struct Iter<E> {
220220
marker: marker::PhantomData<E>,
221221
}
222222

223-
#[stable(feature = "collection_debug", since = "1.15.0")]
224223
impl<E: fmt::Debug> fmt::Debug for Iter<E> {
225224
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
226-
f.debug_tuple("EnumSet::Iter")
225+
f.debug_tuple("Iter")
227226
.field(&self.clone())
228227
.finish()
229228
}

src/libcollections/linked_list.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ pub struct Iter<'a, T: 'a> {
6565
marker: PhantomData<&'a Node<T>>,
6666
}
6767

68-
#[stable(feature = "collection_debug", since = "1.15.0")]
68+
#[stable(feature = "collection_debug", since = "1.17.0")]
6969
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
7070
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
71-
f.debug_tuple("LinkedList::Iter")
71+
f.debug_tuple("Iter")
7272
.field(&self.clone())
7373
.finish()
7474
}
@@ -91,10 +91,10 @@ pub struct IterMut<'a, T: 'a> {
9191
len: usize,
9292
}
9393

94-
#[stable(feature = "collection_debug", since = "1.15.0")]
94+
#[stable(feature = "collection_debug", since = "1.17.0")]
9595
impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> {
9696
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
97-
f.debug_tuple("LinkedList::IterMut")
97+
f.debug_tuple("IterMut")
9898
.field(self.clone())
9999
.finish()
100100
}
@@ -107,10 +107,10 @@ pub struct IntoIter<T> {
107107
list: LinkedList<T>,
108108
}
109109

110-
#[stable(feature = "collection_debug", since = "1.15.0")]
110+
#[stable(feature = "collection_debug", since = "1.17.0")]
111111
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
112112
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
113-
f.debug_tuple("LinkedList::IntoIter")
113+
f.debug_tuple("IntoIter")
114114
.field(self.clone())
115115
.finish()
116116
}
@@ -1104,10 +1104,12 @@ pub struct FrontPlace<'a, T: 'a> {
11041104
node: IntermediateBox<Node<T>>,
11051105
}
11061106

1107-
#[stable(feature = "collection_debug", since = "1.15.0")]
1107+
#[unstable(feature = "collection_placement",
1108+
reason = "struct name and placement protocol are subject to change",
1109+
issue = "30172")]
11081110
impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> {
11091111
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1110-
f.debug_tuple("LinkedList::FrontPlace")
1112+
f.debug_tuple("FrontPlace")
11111113
.field(self.clone())
11121114
.finish()
11131115
}
@@ -1157,10 +1159,12 @@ pub struct BackPlace<'a, T: 'a> {
11571159
node: IntermediateBox<Node<T>>,
11581160
}
11591161

1160-
#[stable(feature = "collection_debug", since = "1.15.0")]
1162+
#[unstable(feature = "collection_placement",
1163+
reason = "struct name and placement protocol are subject to change",
1164+
issue = "30172")]
11611165
impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> {
11621166
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1163-
f.debug_tuple("LinkedList::BackPlace")
1167+
f.debug_tuple("BackPlace")
11641168
.field(self.clone())
11651169
.finish()
11661170
}

src/libcollections/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub struct EncodeUtf16<'a> {
123123
encoder: Utf16Encoder<Chars<'a>>,
124124
}
125125

126-
#[stable(feature = "collection_debug", since = "1.15.0")]
126+
#[stable(feature = "collection_debug", since = "1.17.0")]
127127
impl<'a> fmt::Debug for EncodeUtf16<'a> {
128128
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
129129
f.pad("EncodeUtf16 { .. }")

src/libcollections/string.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1979,10 +1979,10 @@ pub struct Drain<'a> {
19791979
iter: Chars<'a>,
19801980
}
19811981

1982-
#[stable(feature = "collection_debug", since = "1.15.0")]
1982+
#[stable(feature = "collection_debug", since = "1.17.0")]
19831983
impl<'a> fmt::Debug for Drain<'a> {
19841984
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1985-
f.pad("String::Drain { .. }")
1985+
f.pad("Drain { .. }")
19861986
}
19871987
}
19881988

0 commit comments

Comments
 (0)