From 25bb1a406c1b66b8df89d431046cae591593dc01 Mon Sep 17 00:00:00 2001 From: Guillaume Pinot <texitoi@texitoi.eu> Date: Sun, 1 Dec 2013 18:19:39 +0100 Subject: [PATCH] rename MutableVector::mut_split(at) to MutableVector::mut_split_at(at) --- src/libextra/ringbuf.rs | 6 +++--- src/librustc/middle/borrowck/doc.rs | 4 ++-- src/libstd/vec.rs | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs index 5580ca32bf903..2274db6c63df4 100644 --- a/src/libextra/ringbuf.rs +++ b/src/libextra/ringbuf.rs @@ -207,14 +207,14 @@ impl<T> RingBuf<T> { // start_index to self.elts.len() // and then // 0 to end_index - let (temp, remaining1) = self.elts.mut_split(start_index); - let (remaining2, _) = temp.mut_split(end_index); + let (temp, remaining1) = self.elts.mut_split_at(start_index); + let (remaining2, _) = temp.mut_split_at(end_index); RingBufMutIterator { remaining1: remaining1, remaining2: remaining2, nelts: self.nelts } } else { // Items to iterate goes from start_index to end_index: - let (empty, elts) = self.elts.mut_split(0); + let (empty, elts) = self.elts.mut_split_at(0); let remaining1 = elts.mut_slice(start_index, end_index); RingBufMutIterator { remaining1: remaining1, remaining2: empty, diff --git a/src/librustc/middle/borrowck/doc.rs b/src/librustc/middle/borrowck/doc.rs index 7cc1395a9e5d6..5bd75dbdbd89f 100644 --- a/src/librustc/middle/borrowck/doc.rs +++ b/src/librustc/middle/borrowck/doc.rs @@ -666,8 +666,8 @@ The current rules could use some correction: function will fail to compile: fn mut_shift_ref<'a,T>(x: &mut &'a mut [T]) -> &'a mut T { - // `mut_split` will restrict mutation against *x: - let (head, tail) = (*x).mut_split(1); + // `mut_split_at` will restrict mutation against *x: + let (head, tail) = (*x).mut_split_at(1); // Hence mutating `*x` yields an error here: *x = tail; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 45667bdad2ef6..8cbdcbb36260b 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1995,7 +1995,7 @@ pub trait MutableVector<'self, T> { * itself) and the second will contain all indices from * `mid..len` (excluding the index `len` itself). */ - fn mut_split(self, mid: uint) -> (&'self mut [T], + fn mut_split_at(self, mid: uint) -> (&'self mut [T], &'self mut [T]); /// Reverse the order of elements in a vector, in place @@ -2052,7 +2052,7 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] { } #[inline] - fn mut_split(self, mid: uint) -> (&'self mut [T], &'self mut [T]) { + fn mut_split_at(self, mid: uint) -> (&'self mut [T], &'self mut [T]) { unsafe { let len = self.len(); let self2: &'self mut [T] = cast::transmute_copy(&self); @@ -2592,7 +2592,7 @@ impl<'self, T> Iterator<&'self mut [T]> for MutChunkIter<'self, T> { } else { let sz = cmp::min(self.remaining, self.chunk_size); let tmp = util::replace(&mut self.v, &mut []); - let (head, tail) = tmp.mut_split(sz); + let (head, tail) = tmp.mut_split_at(sz); self.v = tail; self.remaining -= sz; Some(head) @@ -2620,7 +2620,7 @@ impl<'self, T> DoubleEndedIterator<&'self mut [T]> for MutChunkIter<'self, T> { let remainder = self.remaining % self.chunk_size; let sz = if remainder != 0 { remainder } else { self.chunk_size }; let tmp = util::replace(&mut self.v, &mut []); - let (head, tail) = tmp.mut_split(self.remaining - sz); + let (head, tail) = tmp.mut_split_at(self.remaining - sz); self.v = head; self.remaining -= sz; Some(tail) @@ -3898,10 +3898,10 @@ mod tests { } #[test] - fn test_mut_split() { + fn test_mut_split_at() { let mut values = [1u8,2,3,4,5]; { - let (left, right) = values.mut_split(2); + let (left, right) = values.mut_split_at(2); assert_eq!(left.slice(0, left.len()), [1, 2]); for p in left.mut_iter() { *p += 1;