Fix warnings

This commit is contained in:
Brendan Zabarauskas 2014-09-18 12:47:28 +10:00
parent 972bbcc845
commit d3abbfcd4c
3 changed files with 7 additions and 9 deletions

View File

@ -66,7 +66,7 @@ impl<N: Zero + Clone> DMat<N> {
#[inline]
pub fn reset(&mut self) {
for mij in self.mij.mut_iter() {
for mij in self.mij.iter_mut() {
*mij = Zero::zero();
}
}
@ -227,7 +227,7 @@ impl<N: Clone> Indexable<(uint, uint), N> for DMat<N> {
unsafe fn unsafe_set(&mut self, rowcol: (uint, uint), val: N) {
let (row, col) = rowcol;
let offset = self.offset(row, col);
*self.mij.as_mut_slice().unsafe_mut_ref(offset) = val
*self.mij.as_mut_slice().unsafe_mut(offset) = val
}
/// Reads the value of a component of the matrix.
@ -358,7 +358,6 @@ Inv for DMat<N> {
let dim = self.nrows;
let mut res: DMat<N> = Eye::new_identity(dim);
let _0T: N = Zero::zero();
// inversion using Gauss-Jordan elimination
for k in range(0u, dim) {
@ -369,7 +368,7 @@ Inv for DMat<N> {
let mut n0 = k; // index of a non-zero entry
while n0 != dim {
if unsafe { self.unsafe_at((n0, k)) } != _0T {
if unsafe { self.unsafe_at((n0, k)) } != Zero::zero() {
break;
}

View File

@ -430,7 +430,6 @@ macro_rules! inv_impl(
fn inv(&mut self) -> bool {
let mut res: $t<N> = One::one();
let _0N: N = Zero::zero();
// inversion using Gauss-Jordan elimination
for k in range(0u, $dim) {
@ -441,7 +440,7 @@ macro_rules! inv_impl(
let mut n0 = k; // index of a non-zero entry
while n0 != $dim {
if self.at((n0, k)) != _0N {
if self.at((n0, k)) != Zero::zero() {
break;
}

View File

@ -46,7 +46,7 @@ impl<N: 'static> Iterable<N> for vec::Vec0<N> {
impl<N: 'static> IterableMut<N> for vec::Vec0<N> {
#[inline]
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
unsafe { mem::transmute::<&'l mut vec::Vec0<N>, &'l mut [N, ..0]>(self).mut_iter() }
unsafe { mem::transmute::<&'l mut vec::Vec0<N>, &'l mut [N, ..0]>(self).iter_mut() }
}
}
@ -74,7 +74,7 @@ impl<N, T> Add<T, vec::Vec0<N>> for vec::Vec0<N> {
impl<N, T> Sub<T, vec::Vec0<N>> for vec::Vec0<N> {
#[inline]
fn sub(&self, _: &T) -> vec::Vec0<N> {
fn sub(&self, _: &T) -> vec::Vec0<N> {
vec::Vec0
}
}
@ -95,7 +95,7 @@ impl<N: Num> Dot<N> for vec::Vec0<N> {
#[inline]
fn sub_dot(_: &vec::Vec0<N>, _: &vec::Vec0<N>, _: &vec::Vec0<N>) -> N {
Zero::zero()
}
}
}
impl<N, T> Mul<T, vec::Vec0<N>> for vec::Vec0<N> {