Skip to content

Commit 48c2c9b

Browse files
committed
Mark vec::len as pure
1 parent 9029416 commit 48c2c9b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/lib/vec.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn reserve<@T>(&v: [mutable? T], n: uint) {
1818
rustrt::vec_reserve_shared(v, n);
1919
}
2020

21-
fn len<T>(v: [mutable? T]) -> uint { ret rusti::vec_len(v); }
21+
pure fn len<T>(v: [mutable? T]) -> uint { unchecked { rusti::vec_len(v) } }
2222

2323
type init_op<T> = fn(uint) -> T;
2424

@@ -271,9 +271,7 @@ fn position_pred<T>(f: fn(T) -> bool, v: [T]) -> option::t<uint> {
271271
}
272272

273273
pure fn same_length<T, U>(xs: [T], ys: [U]) -> bool {
274-
let xlen = unchecked{ vec::len(xs) };
275-
let ylen = unchecked{ vec::len(ys) };
276-
xlen == ylen
274+
vec::len(xs) == vec::len(ys)
277275
}
278276

279277
// FIXME: if issue #586 gets implemented, could have a postcondition

0 commit comments

Comments
 (0)