Skip to content

Commit 0ff9314

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 162262 b: refs/heads/auto c: 5a24058 h: refs/heads/master v: v3
1 parent d0158c2 commit 0ff9314

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: a0621f8eba169780c592916eeaf2855c69541f4b
13+
refs/heads/auto: 5a240588895b733f4e41fb8f9cb0a3d2f80b1e87
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libcollections/binary_heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ impl<T: Ord> BinaryHeap<T> {
485485
let mut end = q.len();
486486
while end > 1 {
487487
end -= 1;
488-
q.data.as_mut_slice().swap(0, end);
488+
q.data.swap(0, end);
489489
q.siftdown_range(0, end)
490490
}
491491
q.into_vec()

branches/auto/src/libcollections/btree/node.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ impl <K, V> Node<K, V> {
158158
/// Swap the given key-value pair with the key-value pair stored in the node's index,
159159
/// without checking bounds.
160160
pub unsafe fn unsafe_swap(&mut self, index: uint, key: &mut K, val: &mut V) {
161-
mem::swap(self.keys.as_mut_slice().unsafe_mut(index), key);
162-
mem::swap(self.vals.as_mut_slice().unsafe_mut(index), val);
161+
mem::swap(self.keys.unsafe_mut(index), key);
162+
mem::swap(self.vals.unsafe_mut(index), val);
163163
}
164164

165165
/// Get the node's key mutably without any bounds checks.
166166
pub unsafe fn unsafe_key_mut(&mut self, index: uint) -> &mut K {
167-
self.keys.as_mut_slice().unsafe_mut(index)
167+
self.keys.unsafe_mut(index)
168168
}
169169

170170
/// Get the node's value at the given index
@@ -189,12 +189,12 @@ impl <K, V> Node<K, V> {
189189

190190
/// Get the node's edge mutably at the given index
191191
pub fn edge_mut(&mut self, index: uint) -> Option<&mut Node<K,V>> {
192-
self.edges.as_mut_slice().get_mut(index)
192+
self.edges.get_mut(index)
193193
}
194194

195195
/// Get the node's edge mutably without any bounds checks.
196196
pub unsafe fn unsafe_edge_mut(&mut self, index: uint) -> &mut Node<K,V> {
197-
self.edges.as_mut_slice().unsafe_mut(index)
197+
self.edges.unsafe_mut(index)
198198
}
199199

200200
/// Pop an edge off the end of the node
@@ -292,8 +292,8 @@ impl <K, V> Node<K, V> {
292292
pub fn iter_mut<'a>(&'a mut self) -> MutTraversal<'a, K, V> {
293293
let is_leaf = self.is_leaf();
294294
MutTraversal {
295-
elems: self.keys.iter().zip(self.vals.as_mut_slice().iter_mut()),
296-
edges: self.edges.as_mut_slice().iter_mut(),
295+
elems: self.keys.iter().zip(self.vals.iter_mut()),
296+
edges: self.edges.iter_mut(),
297297
head_is_edge: true,
298298
tail_is_edge: true,
299299
has_edges: !is_leaf,
@@ -478,7 +478,7 @@ fn split<T>(left: &mut Vec<T>) -> Vec<T> {
478478
let mut right = Vec::with_capacity(left.capacity());
479479
unsafe {
480480
let left_ptr = left.unsafe_get(left_len) as *const _;
481-
let right_ptr = right.as_mut_slice().as_mut_ptr();
481+
let right_ptr = right.as_mut_ptr();
482482
ptr::copy_nonoverlapping_memory(right_ptr, left_ptr, right_len);
483483
left.set_len(left_len);
484484
right.set_len(right_len);

branches/auto/src/libcollections/slice.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl Iterator<(uint, uint)> for ElementSwaps {
201201
match max {
202202
Some((i, sd)) => {
203203
let j = new_pos(i, sd.dir);
204-
self.sdir.as_mut_slice().swap(i, j);
204+
self.sdir.swap(i, j);
205205

206206
// Swap the direction of each larger SizeDirection
207207
for x in self.sdir.iter_mut() {
@@ -256,7 +256,7 @@ impl<T: Clone> Iterator<Vec<T>> for Permutations<T> {
256256
Some((0,0)) => Some(self.v.clone()),
257257
Some((a, b)) => {
258258
let elt = self.v.clone();
259-
self.v.as_mut_slice().swap(a, b);
259+
self.v.swap(a, b);
260260
Some(elt)
261261
}
262262
}
@@ -779,11 +779,11 @@ mod tests {
779779
#[test]
780780
fn test_head_mut() {
781781
let mut a = vec![];
782-
assert_eq!(a.as_mut_slice().head_mut(), None);
782+
assert_eq!(a.head_mut(), None);
783783
a = vec![11i];
784-
assert_eq!(*a.as_mut_slice().head_mut().unwrap(), 11);
784+
assert_eq!(*a.head_mut().unwrap(), 11);
785785
a = vec![11i, 12];
786-
assert_eq!(*a.as_mut_slice().head_mut().unwrap(), 11);
786+
assert_eq!(*a.head_mut().unwrap(), 11);
787787
}
788788

789789
#[test]
@@ -800,10 +800,10 @@ mod tests {
800800
fn test_tail_mut() {
801801
let mut a = vec![11i];
802802
let b: &mut [int] = &mut [];
803-
assert!(a.as_mut_slice().tail_mut() == b);
803+
assert!(a.tail_mut() == b);
804804
a = vec![11i, 12];
805805
let b: &mut [int] = &mut [12];
806-
assert!(a.as_mut_slice().tail_mut() == b);
806+
assert!(a.tail_mut() == b);
807807
}
808808

809809
#[test]
@@ -817,7 +817,7 @@ mod tests {
817817
#[should_fail]
818818
fn test_tail_mut_empty() {
819819
let mut a: Vec<int> = vec![];
820-
a.as_mut_slice().tail_mut();
820+
a.tail_mut();
821821
}
822822

823823
#[test]
@@ -834,10 +834,10 @@ mod tests {
834834
fn test_init_mut() {
835835
let mut a = vec![11i];
836836
let b: &mut [int] = &mut [];
837-
assert!(a.as_mut_slice().init_mut() == b);
837+
assert!(a.init_mut() == b);
838838
a = vec![11i, 12];
839839
let b: &mut [int] = &mut [11];
840-
assert!(a.as_mut_slice().init_mut() == b);
840+
assert!(a.init_mut() == b);
841841
}
842842

843843
#[test]
@@ -851,7 +851,7 @@ mod tests {
851851
#[should_fail]
852852
fn test_init_mut_empty() {
853853
let mut a: Vec<int> = vec![];
854-
a.as_mut_slice().init_mut();
854+
a.init_mut();
855855
}
856856

857857
#[test]
@@ -867,11 +867,11 @@ mod tests {
867867
#[test]
868868
fn test_last_mut() {
869869
let mut a = vec![];
870-
assert_eq!(a.as_mut_slice().last_mut(), None);
870+
assert_eq!(a.last_mut(), None);
871871
a = vec![11i];
872-
assert_eq!(*a.as_mut_slice().last_mut().unwrap(), 11);
872+
assert_eq!(*a.last_mut().unwrap(), 11);
873873
a = vec![11i, 12];
874-
assert_eq!(*a.as_mut_slice().last_mut().unwrap(), 12);
874+
assert_eq!(*a.last_mut().unwrap(), 12);
875875
}
876876

877877
#[test]
@@ -1299,13 +1299,13 @@ mod tests {
12991299
.collect::<Vec<uint>>();
13001300
let mut v1 = v.clone();
13011301

1302-
v.as_mut_slice().sort();
1302+
v.sort();
13031303
assert!(v.as_slice().windows(2).all(|w| w[0] <= w[1]));
13041304

1305-
v1.as_mut_slice().sort_by(|a, b| a.cmp(b));
1305+
v1.sort_by(|a, b| a.cmp(b));
13061306
assert!(v1.as_slice().windows(2).all(|w| w[0] <= w[1]));
13071307

1308-
v1.as_mut_slice().sort_by(|a, b| b.cmp(a));
1308+
v1.sort_by(|a, b| b.cmp(a));
13091309
assert!(v1.as_slice().windows(2).all(|w| w[0] >= w[1]));
13101310
}
13111311
}

branches/auto/src/libcollections/vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl<T> Vec<T> {
211211
let mut xs = Vec::with_capacity(length);
212212
while xs.len < length {
213213
let len = xs.len;
214-
ptr::write(xs.as_mut_slice().unsafe_mut(len), op(len));
214+
ptr::write(xs.unsafe_mut(len), op(len));
215215
xs.len += 1;
216216
}
217217
xs
@@ -328,7 +328,7 @@ impl<T: Clone> Vec<T> {
328328
let mut xs = Vec::with_capacity(length);
329329
while xs.len < length {
330330
let len = xs.len;
331-
ptr::write(xs.as_mut_slice().unsafe_mut(len),
331+
ptr::write(xs.unsafe_mut(len),
332332
value.clone());
333333
xs.len += 1;
334334
}
@@ -361,7 +361,7 @@ impl<T: Clone> Vec<T> {
361361
// during the loop can prevent this optimisation.
362362
unsafe {
363363
ptr::write(
364-
self.as_mut_slice().unsafe_mut(len),
364+
self.unsafe_mut(len),
365365
other.unsafe_get(i).clone());
366366
self.set_len(len + 1);
367367
}
@@ -896,7 +896,7 @@ impl<T> Vec<T> {
896896
pub fn swap_remove(&mut self, index: uint) -> Option<T> {
897897
let length = self.len();
898898
if length > 0 && index < length - 1 {
899-
self.as_mut_slice().swap(index, length - 1);
899+
self.swap(index, length - 1);
900900
} else if index >= length {
901901
return None
902902
}
@@ -1231,7 +1231,7 @@ impl<T: PartialEq> Vec<T> {
12311231
if ln < 1 { return; }
12321232

12331233
// Avoid bounds checks by using unsafe pointers.
1234-
let p = self.as_mut_slice().as_mut_ptr();
1234+
let p = self.as_mut_ptr();
12351235
let mut r = 1;
12361236
let mut w = 1;
12371237

@@ -1293,7 +1293,7 @@ impl<T> Drop for Vec<T> {
12931293
// zeroed (when moving out, because of #[unsafe_no_drop_flag]).
12941294
if self.cap != 0 {
12951295
unsafe {
1296-
for x in self.as_mut_slice().iter() {
1296+
for x in self.iter() {
12971297
ptr::read(x);
12981298
}
12991299
dealloc(self.ptr, self.cap)

0 commit comments

Comments
 (0)