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] #[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.
@ -358,7 +358,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) {
@ -369,7 +368,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

@ -430,7 +430,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) {
@ -441,7 +440,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() }
} }
} }