Skip to content

Commit 4a22a8c

Browse files
committed
---
yaml --- r: 126750 b: refs/heads/snap-stage3 c: 94e42c2 h: refs/heads/master v: v3
1 parent 723f11d commit 4a22a8c

File tree

4 files changed

+19
-39
lines changed

4 files changed

+19
-39
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 7be8f0af0393dcdb077c2f6b1653836fd3fba235
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2d79bfa4150c356240d934b14623d6e90f7e48c4
4+
refs/heads/snap-stage3: 94e42c2d896cd26c1a48fa4a1748f2c62089fc2a
55
refs/heads/try: 502e4c045236682e9728539dc0d2b3d0b237f55c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcollections/dlist.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -249,29 +249,17 @@ impl<T> Deque<T> for DList<T> {
249249
fn pop_front(&mut self) -> Option<T> {
250250
self.pop_front_node().map(|box Node{value, ..}| value)
251251
}
252+
}
252253

253-
/// Add an element last in the list
254-
///
255-
/// O(1)
256-
#[deprecated = "use the `push` method"]
257-
fn push_back(&mut self, elt: T) {
254+
impl<T> MutableSeq<T> for DList<T> {
255+
fn push(&mut self, elt: T) {
258256
self.push_back_node(box Node::new(elt))
259257
}
260-
261-
/// Remove the last element and return it, or None if the list is empty
262-
///
263-
/// O(1)
264-
#[deprecated = "use the `pop` method"]
265-
fn pop_back(&mut self) -> Option<T> {
258+
fn pop(&mut self) -> Option<T> {
266259
self.pop_back_node().map(|box Node{value, ..}| value)
267260
}
268261
}
269262

270-
impl<T> MutableSeq<T> for DList<T> {
271-
fn push(&mut self, elt: T) { self.push_back(elt) }
272-
fn pop(&mut self) -> Option<T> { self.pop_back() }
273-
}
274-
275263
impl<T> Default for DList<T> {
276264
#[inline]
277265
fn default() -> DList<T> { DList::new() }

branches/snap-stage3/src/libcollections/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ pub trait Deque<T> : MutableSeq<T> {
516516
/// assert_eq!(d.front(), Some(&1i));
517517
/// ```
518518
#[deprecated = "use the `push` method"]
519-
fn push_back(&mut self, elt: T);
519+
fn push_back(&mut self, elt: T) { self.push(elt) }
520520

521521
/// Remove the last element and return it, or `None` if the sequence is empty.
522522
///
@@ -534,7 +534,7 @@ pub trait Deque<T> : MutableSeq<T> {
534534
/// assert_eq!(d.pop_back(), None);
535535
/// ```
536536
#[deprecated = "use the `pop` method"]
537-
fn pop_back(&mut self) -> Option<T>;
537+
fn pop_back(&mut self) -> Option<T> { self.pop() }
538538

539539
/// Remove the first element and return it, or `None` if the sequence is empty.
540540
///

branches/snap-stage3/src/libcollections/ringbuf.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,6 @@ impl<T> Deque<T> for RingBuf<T> {
8080
result
8181
}
8282

83-
/// Remove and return the last element in the RingBuf, or None if it is empty
84-
#[deprecated = "use the `pop` method"]
85-
fn pop_back(&mut self) -> Option<T> {
86-
if self.nelts > 0 {
87-
self.nelts -= 1;
88-
let hi = self.raw_index(self.nelts);
89-
self.elts.get_mut(hi).take()
90-
} else {
91-
None
92-
}
93-
}
94-
9583
/// Prepend an element to the RingBuf
9684
fn push_front(&mut self, t: T) {
9785
if self.nelts == self.elts.len() {
@@ -103,22 +91,26 @@ impl<T> Deque<T> for RingBuf<T> {
10391
*self.elts.get_mut(self.lo) = Some(t);
10492
self.nelts += 1u;
10593
}
94+
}
10695

107-
/// Append an element to the RingBuf
108-
#[deprecated = "use the `push` method"]
109-
fn push_back(&mut self, t: T) {
96+
impl<T> MutableSeq<T> for RingBuf<T> {
97+
fn push(&mut self, t: T) {
11098
if self.nelts == self.elts.len() {
11199
grow(self.nelts, &mut self.lo, &mut self.elts);
112100
}
113101
let hi = self.raw_index(self.nelts);
114102
*self.elts.get_mut(hi) = Some(t);
115103
self.nelts += 1u;
116104
}
117-
}
118-
119-
impl<T> MutableSeq<T> for RingBuf<T> {
120-
fn push(&mut self, t: T) { self.push_back(t) }
121-
fn pop(&mut self) -> Option<T> { self.pop_back() }
105+
fn pop(&mut self) -> Option<T> {
106+
if self.nelts > 0 {
107+
self.nelts -= 1;
108+
let hi = self.raw_index(self.nelts);
109+
self.elts.get_mut(hi).take()
110+
} else {
111+
None
112+
}
113+
}
122114
}
123115

124116
impl<T> Default for RingBuf<T> {

0 commit comments

Comments
 (0)