aboutsummaryrefslogtreecommitdiff
path: root/src/lib/deque.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-08-05 10:10:39 -0700
committerGraydon Hoare <[email protected]>2010-08-05 10:10:39 -0700
commit935b4347e286b0022ae6f38b2875df6f05c55fa3 (patch)
treeda099f73a9db22b1fbd1aa52dbc8d2741a2dde88 /src/lib/deque.rs
parentMove 'as' precedence up to just above relational; support indexing str and ve... (diff)
downloadrust-935b4347e286b0022ae6f38b2875df6f05c55fa3.tar.xz
rust-935b4347e286b0022ae6f38b2875df6f05c55fa3.zip
Mop up workarounds in stdlib no longer required as issue #93 is closed.
Diffstat (limited to 'src/lib/deque.rs')
-rw-r--r--src/lib/deque.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/deque.rs b/src/lib/deque.rs
index bd42d7cb..bf7acb53 100644
--- a/src/lib/deque.rs
+++ b/src/lib/deque.rs
@@ -36,7 +36,7 @@ fn create[T]() -> t[T] {
fn fill[T](uint i, uint nelts, uint lo, &vec[cell[T]] old) -> cell[T] {
if (i < nelts) {
- ret old.(((lo + i) % nelts) as int);
+ ret old.((lo + i) % nelts);
} else {
ret util.none[T]();
}
@@ -47,14 +47,8 @@ fn create[T]() -> t[T] {
ret _vec.init_fn[cell[T]](copy_op, nalloc);
}
- /**
- * FIXME (issue #94): We're converting to int every time we index into the
- * vec, but we really want to index with the lo and hi uints that we have
- * around.
- */
-
fn get[T](&vec[cell[T]] elts, uint i) -> T {
- alt (elts.(i as int)) {
+ alt (elts.(i)) {
case (util.some[T](t)) { ret t; }
case (_) { fail; }
}
@@ -82,7 +76,7 @@ fn create[T]() -> t[T] {
hi = nelts;
}
- elts.(lo as int) = util.some[T](t);
+ elts.(lo) = util.some[T](t);
nelts += 1u;
}
@@ -93,7 +87,7 @@ fn create[T]() -> t[T] {
hi = nelts;
}
- elts.(hi as int) = util.some[T](t);
+ elts.(hi) = util.some[T](t);
hi = (hi + 1u) % _vec.len[cell[T]](elts);
nelts += 1u;
}
@@ -104,7 +98,7 @@ fn create[T]() -> t[T] {
*/
fn pop_front() -> T {
let T t = get[T](elts, lo);
- elts.(lo as int) = util.none[T]();
+ elts.(lo) = util.none[T]();
lo = (lo + 1u) % _vec.len[cell[T]](elts);
ret t;
}
@@ -117,7 +111,7 @@ fn create[T]() -> t[T] {
}
let T t = get[T](elts, hi);
- elts.(hi as int) = util.none[T]();
+ elts.(hi) = util.none[T]();
ret t;
}