Skip to content

Commit 814d994

Browse files
committed
---
yaml --- r: 42635 b: refs/heads/try c: e43cff6 h: refs/heads/master i: 42633: 0bfc506 42631: 637b412 v: v3
1 parent 054f624 commit 814d994

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 86b8bf37bbd5c83953933c9c38a20567843c3a7f
5+
refs/heads/try: e43cff6657b5ba4245480ede5230e3f00aa52185
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libstd/priority_queue.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ impl <T: Ord> PriorityQueue<T> {
4747
if self.is_empty() { None } else { Some(self.top()) }
4848
}
4949

50-
/// Returns true if a queue contains some elements
51-
pure fn is_not_empty(&self) -> bool { self.data.is_not_empty() }
52-
5350
/// Returns the number of elements the queue can hold without reallocating
5451
pure fn capacity(&self) -> uint { vec::capacity(&self.data) }
5552

@@ -62,7 +59,7 @@ impl <T: Ord> PriorityQueue<T> {
6259
/// Pop the greatest item from the queue - fails if empty
6360
fn pop(&mut self) -> T {
6461
let mut item = self.data.pop();
65-
if self.is_not_empty() { item <-> self.data[0]; self.siftdown(0); }
62+
if !self.is_empty() { item <-> self.data[0]; self.siftdown(0); }
6663
item
6764
}
6865

@@ -80,7 +77,7 @@ impl <T: Ord> PriorityQueue<T> {
8077
/// Optimized version of a push followed by a pop
8178
fn push_pop(&mut self, item: T) -> T {
8279
let mut item = item;
83-
if self.is_not_empty() && self.data[0] > item {
80+
if !self.is_empty() && self.data[0] > item {
8481
item <-> self.data[0];
8582
self.siftdown(0);
8683
}
@@ -189,7 +186,7 @@ mod tests {
189186
let data = ~[2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
190187
let mut sorted = merge_sort(data, le);
191188
let mut heap = from_vec(data);
192-
while heap.is_not_empty() {
189+
while !heap.is_empty() {
193190
assert *heap.top() == sorted.last();
194191
assert heap.pop() == sorted.pop();
195192
}

0 commit comments

Comments
 (0)