mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-25 21:34:18 +00:00
Mark vec::len as pure
This commit is contained in:
parent
9029416e28
commit
48c2c9b3a7
@ -18,7 +18,7 @@ fn reserve<@T>(&v: [mutable? T], n: uint) {
|
||||
rustrt::vec_reserve_shared(v, n);
|
||||
}
|
||||
|
||||
fn len<T>(v: [mutable? T]) -> uint { ret rusti::vec_len(v); }
|
||||
pure fn len<T>(v: [mutable? T]) -> uint { unchecked { rusti::vec_len(v) } }
|
||||
|
||||
type init_op<T> = fn(uint) -> T;
|
||||
|
||||
@ -271,9 +271,7 @@ fn position_pred<T>(f: fn(T) -> bool, v: [T]) -> option::t<uint> {
|
||||
}
|
||||
|
||||
pure fn same_length<T, U>(xs: [T], ys: [U]) -> bool {
|
||||
let xlen = unchecked{ vec::len(xs) };
|
||||
let ylen = unchecked{ vec::len(ys) };
|
||||
xlen == ylen
|
||||
vec::len(xs) == vec::len(ys)
|
||||
}
|
||||
|
||||
// FIXME: if issue #586 gets implemented, could have a postcondition
|
||||
|
Loading…
Reference in New Issue
Block a user