diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-15 22:44:51 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-15 23:05:00 +1100 |
| commit | 4f62c969f618463914b148d53bef1d0faeb2782f (patch) | |
| tree | 3a6a4bfd063c9b9caf606aff7ad0a409399897d1 /src/libstd/vec.rs | |
| parent | 0393c402a6f523993bb47c579d7382bec507bde7 (diff) | |
| download | rust-4f62c969f618463914b148d53bef1d0faeb2782f.tar.gz rust-4f62c969f618463914b148d53bef1d0faeb2782f.zip | |
std::vec: move pointless `raw::get` and `unsafe_get` functions.
This can easily be written as `(*v.unsafe_ref(i)).clone()`, or just `*v.unsafe_ref(i)` for primitive types like `i32` (the common case).
Diffstat (limited to 'src/libstd/vec.rs')
| -rw-r--r-- | src/libstd/vec.rs | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index c14068a7c88..fc051a7e2b5 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1270,8 +1270,6 @@ pub trait ImmutableCopyableVector<T> { * those that do not. */ fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]); - /// Returns the element at the given index, without doing bounds checking. - unsafe fn unsafe_get(&self, elem: uint) -> T; /// Create an iterator that yields every possible permutation of the /// vector in succession. @@ -1295,11 +1293,6 @@ impl<'a,T:Clone> ImmutableCopyableVector<T> for &'a [T] { (lefts, rights) } - #[inline] - unsafe fn unsafe_get(&self, index: uint) -> T { - (*self.unsafe_ref(index)).clone() - } - fn permutations(self) -> Permutations<T> { Permutations{ swaps: ElementSwaps::new(self.len()), @@ -2192,7 +2185,6 @@ pub unsafe fn from_buf<T>(ptr: *T, elts: uint) -> ~[T] { /// Unsafe operations pub mod raw { use cast; - use clone::Clone; use option::Some; use ptr; use mem; @@ -2270,14 +2262,6 @@ pub mod raw { } /** - * Unchecked vector indexing. - */ - #[inline] - pub unsafe fn get<T:Clone>(v: &[T], i: uint) -> T { - v.as_imm_buf(|p, _len| (*ptr::offset(p, i as int)).clone()) - } - - /** * Unchecked vector index assignment. Does not drop the * old value and hence is only suitable when the vector * is newly allocated. |
