Eliminate warnings

This commit is contained in:
Keegan McAllister 2014-09-18 16:29:46 -07:00
parent 2f46b9aede
commit dc86e83654
57 changed files with 223 additions and 221 deletions

View file

@ -262,7 +262,7 @@ impl BloomFilter {
/// on every element.
pub fn clear(&mut self) {
self.number_of_insertions = 0;
for x in self.buf.as_mut_slice().mut_iter() {
for x in self.buf.as_mut_slice().iter_mut() {
*x = 0u;
}
}

View file

@ -238,7 +238,7 @@ impl<K:Clone+PartialEq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> {
}
fn evict_all(&mut self) {
for slot in self.entries.mut_iter() {
for slot in self.entries.iter_mut() {
*slot = None
}
}

View file

@ -21,12 +21,12 @@ pub trait VecLike<T> {
fn vec_len(&self) -> uint;
fn vec_push(&mut self, value: T);
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T];
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T];
#[inline]
fn vec_mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
fn vec_slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
let len = self.vec_len();
self.vec_mut_slice(start, len)
self.vec_slice_mut(start, len)
}
}
@ -42,8 +42,8 @@ impl<T> VecLike<T> for Vec<T> {
}
#[inline]
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
self.mut_slice(start, end)
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
self.slice_mut(start, end)
}
}
@ -102,7 +102,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
/// NB: For efficiency reasons (avoiding making a second copy of the inline elements), this
/// actually clears out the original array instead of moving it.
fn move_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> {
fn into_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> {
unsafe {
let iter = mem::transmute(self.iter());
let ptr_opt = if self.spilled() {
@ -136,7 +136,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
}
fn push_all_move<V:SmallVec<T>>(&mut self, mut other: V) {
for value in other.move_iter() {
for value in other.into_iter() {
self.push(value)
}
}
@ -219,12 +219,12 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
self.slice(0, self.len())
}
fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
fn as_slice_mut<'a>(&'a mut self) -> &'a mut [T] {
let len = self.len();
self.mut_slice(0, len)
self.slice_mut(0, len)
}
fn mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
fn slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
assert!(start <= end);
assert!(end <= self.len());
unsafe {
@ -235,9 +235,9 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
}
}
fn mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
let len = self.len();
self.mut_slice(start, len)
self.slice_mut(start, len)
}
fn fail_bounds_check(&self, index: uint) {
@ -400,8 +400,8 @@ macro_rules! def_small_vector(
}
#[inline]
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
self.mut_slice(start, end)
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
self.slice_mut(start, end)
}
}

View file

@ -91,7 +91,7 @@ pub mod test {
let len: uint = rng.gen();
let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect();
fn compare_ints(a: &int, b: &int) -> Ordering { a.cmp(b) }
sort::quicksort_by(v.as_mut_slice(), compare_ints);
sort::quicksort_by(v.as_slice_mut(), compare_ints);
for i in range(0, v.len() - 1) {
assert!(v.get(i) <= v.get(i + 1))
}

View file

@ -210,7 +210,7 @@ impl TimeProfiler {
"_category_", "_incremental?_", "_iframe?_",
" _url_", " _mean (ms)_", " _median (ms)_",
" _min (ms)_", " _max (ms)_", " _events_");
for (&(ref category, ref meta), ref mut data) in self.buckets.mut_iter() {
for (&(ref category, ref meta), ref mut data) in self.buckets.iter_mut() {
data.sort_by(|a, b| {
if a < b {
Less

View file

@ -229,7 +229,7 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
}
// Spawn threads.
for thread in threads.move_iter() {
for thread in threads.into_iter() {
TaskBuilder::new().named(task_name).native().spawn(proc() {
let mut thread = thread;
thread.start()
@ -260,8 +260,8 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
pub fn run(&mut self) {
// Tell the workers to start.
let mut work_count = AtomicUint::new(self.work_count);
for worker in self.workers.mut_iter() {
worker.chan.send(StartMsg(worker.deque.take_unwrap(), &mut work_count, &self.data))
for worker in self.workers.iter_mut() {
worker.chan.send(StartMsg(worker.deque.take().unwrap(), &mut work_count, &self.data))
}
// Wait for the work to finish.