Merge pull request #20 from bjz/warnings

Fix warnings
This commit is contained in:
Sébastien Crozet 2014-09-19 23:43:46 +02:00
commit 1945cb09f2
3 changed files with 7 additions and 9 deletions

View File

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

View File

@ -442,7 +442,6 @@ macro_rules! inv_impl(
fn inv(&mut self) -> bool { fn inv(&mut self) -> bool {
let mut res: $t<N> = One::one(); let mut res: $t<N> = One::one();
let _0N: N = Zero::zero();
// inversion using Gauss-Jordan elimination // inversion using Gauss-Jordan elimination
for k in range(0u, $dim) { for k in range(0u, $dim) {
@ -453,7 +452,7 @@ macro_rules! inv_impl(
let mut n0 = k; // index of a non-zero entry let mut n0 = k; // index of a non-zero entry
while n0 != $dim { while n0 != $dim {
if self.at((n0, k)) != _0N { if self.at((n0, k)) != Zero::zero() {
break; 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> { impl<N: 'static> IterableMut<N> for vec::Vec0<N> {
#[inline] #[inline]
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> { 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> { impl<N, T> Sub<T, vec::Vec0<N>> for vec::Vec0<N> {
#[inline] #[inline]
fn sub(&self, _: &T) -> vec::Vec0<N> { fn sub(&self, _: &T) -> vec::Vec0<N> {
vec::Vec0 vec::Vec0
} }
} }
@ -95,7 +95,7 @@ impl<N: Num> Dot<N> for vec::Vec0<N> {
#[inline] #[inline]
fn sub_dot(_: &vec::Vec0<N>, _: &vec::Vec0<N>, _: &vec::Vec0<N>) -> N { fn sub_dot(_: &vec::Vec0<N>, _: &vec::Vec0<N>, _: &vec::Vec0<N>) -> N {
Zero::zero() Zero::zero()
} }
} }
impl<N, T> Mul<T, vec::Vec0<N>> for vec::Vec0<N> { impl<N, T> Mul<T, vec::Vec0<N>> for vec::Vec0<N> {