Skip to content

Commit 66c54b9

Browse files
thestingerbrson
authored andcommitted
---
yaml --- r: 34171 b: refs/heads/snap-stage3 c: f1e8773 h: refs/heads/master i: 34169: 76dff49 34167: edaa912 v: v3
1 parent 90f7a4e commit 66c54b9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
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: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 02e804bba8e2e82e6e2112ceb297ffb237b42ea6
4+
refs/heads/snap-stage3: f1e87733bd4b669f2dcfe758a7ae2b1ddea60715
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/priority_queue.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ impl <T: Ord> PriorityQueue<T> {
105105
q.to_vec()
106106
}
107107

108+
/// Create an empty PriorityQueue
109+
static pure fn new() -> PriorityQueue<T> { PriorityQueue{data: ~[],} }
110+
108111
/// Create a PriorityQueue from a vector (heapify)
109-
static pub pure fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
112+
static pure fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
110113
let mut q = PriorityQueue{data: xs,};
111114
let mut n = q.len() / 2;
112115
while n > 0 {
@@ -168,7 +171,7 @@ impl <T: Ord> PriorityQueue<T> {
168171
mod tests {
169172
use sort::merge_sort;
170173
use core::cmp::le;
171-
use priority_queue::PriorityQueue::from_vec;
174+
use priority_queue::PriorityQueue::{from_vec, new};
172175

173176
#[test]
174177
fn test_top_and_pop() {
@@ -279,30 +282,27 @@ mod tests {
279282
#[test]
280283
#[should_fail]
281284
#[ignore(cfg(windows))]
282-
fn test_empty_pop() { let mut heap = from_vec::<int>(~[]); heap.pop(); }
285+
fn test_empty_pop() { let mut heap = new::<int>(); heap.pop(); }
283286

284287
#[test]
285288
fn test_empty_maybe_pop() {
286-
let mut heap = from_vec::<int>(~[]);
289+
let mut heap = new::<int>();
287290
assert heap.maybe_pop().is_none();
288291
}
289292

290293
#[test]
291294
#[should_fail]
292295
#[ignore(cfg(windows))]
293-
fn test_empty_top() { let empty = from_vec::<int>(~[]); empty.top(); }
296+
fn test_empty_top() { let empty = new::<int>(); empty.top(); }
294297

295298
#[test]
296299
fn test_empty_maybe_top() {
297-
let empty = from_vec::<int>(~[]);
300+
let empty = new::<int>();
298301
assert empty.maybe_top().is_none();
299302
}
300303

301304
#[test]
302305
#[should_fail]
303306
#[ignore(cfg(windows))]
304-
fn test_empty_replace() {
305-
let mut heap = from_vec::<int>(~[]);
306-
heap.replace(5);
307-
}
307+
fn test_empty_replace() { let mut heap = new(); heap.replace(5); }
308308
}

0 commit comments

Comments
 (0)