Skip to content

Commit d03057a

Browse files
thestingerbrson
authored andcommitted
---
yaml --- r: 36783 b: refs/heads/try2 c: f1e8773 h: refs/heads/master i: 36781: d916b43 36779: 277e8c0 36775: df43a1a 36767: 0edcaeb v: v3
1 parent 20a4a70 commit d03057a

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 02e804bba8e2e82e6e2112ceb297ffb237b42ea6
8+
refs/heads/try2: f1e87733bd4b669f2dcfe758a7ae2b1ddea60715
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/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)