From ec5ece46ca1283e88cffdc03c4e4e30ce1820864 Mon Sep 17 00:00:00 2001 From: Eduard Bopp Date: Sun, 29 Mar 2015 12:57:16 +0200 Subject: [PATCH] Use slicing syntax instead of deprecated methods --- src/structs/dmat.rs | 14 +++++++------- src/structs/dvec_macros.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs index 0838f1de..c7c2481a 100644 --- a/src/structs/dmat.rs +++ b/src/structs/dmat.rs @@ -164,7 +164,7 @@ impl DMat { /// The returned vector contains the matrix data in column-major order. #[inline] pub fn as_mut_vec(&mut self) -> &mut [N] { - self.mij.as_mut_slice() + &mut self.mij[..] } } @@ -217,7 +217,7 @@ impl Indexable<(usize, usize), N> for DMat { unsafe fn unsafe_set(&mut self, rowcol: (usize, usize), val: N) { let (row, col) = rowcol; let offset = self.offset(row, col); - *self.mij.as_mut_slice().get_unchecked_mut(offset) = val + *self.mij[..].get_unchecked_mut(offset) = val } /// Reads the value of a component of the matrix. @@ -249,7 +249,7 @@ impl Indexable<(usize, usize), N> for DMat { let count = self.mij.len(); assert!(offset1 < count); assert!(offset2 < count); - self.mij.as_mut_slice().swap(offset1, offset2); + self.mij[..].swap(offset1, offset2); } } @@ -282,7 +282,7 @@ impl IndexMut<(usize, usize)> for DMat { let offset = self.offset(i, j); unsafe { - self.mij.as_mut_slice().get_unchecked_mut(offset) + self.mij[..].get_unchecked_mut(offset) } } } @@ -407,8 +407,8 @@ impl Inv for DMat { let off_n0_j = self.offset(n0, j); let off_k_j = self.offset(k, j); - self.mij.as_mut_slice().swap(off_n0_j, off_k_j); - res.mij.as_mut_slice().swap(off_n0_j, off_k_j); + self.mij[..].swap(off_n0_j, off_k_j); + res.mij[..].swap(off_n0_j, off_k_j); } } @@ -482,7 +482,7 @@ impl Transpose for DMat { let off_i_j = self.offset(i, j); let off_j_i = self.offset(j, i); - self.mij.as_mut_slice().swap(off_i_j, off_j_i); + self.mij[..].swap(off_i_j, off_j_i); } } diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index 15bdef9c..60d8c86d 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -72,7 +72,7 @@ macro_rules! dvec_impl( #[inline] unsafe fn unsafe_set(&mut self, i: usize, val: N) { - *self.at.as_mut_slice().get_unchecked_mut(i) = val + *self.at[..].get_unchecked_mut(i) = val } }