diff --git a/src/base/vec_storage.rs b/src/base/vec_storage.rs index eaf28dd55..2b53fc3ca 100644 --- a/src/base/vec_storage.rs +++ b/src/base/vec_storage.rs @@ -473,7 +473,7 @@ impl Extend for VecStorage { self.data.extend(iter); self.ncols = Dyn(self.data.len() / self.nrows.value()); assert!( - self.data.len() % self.nrows.value() == 0, + self.data.len().is_multiple_of(self.nrows.value()), "The number of elements produced by the given iterator was not a multiple of the number of rows." ); } diff --git a/src/linalg/permutation_sequence.rs b/src/linalg/permutation_sequence.rs index 22f13dfb3..5bfd6a334 100644 --- a/src/linalg/permutation_sequence.rs +++ b/src/linalg/permutation_sequence.rs @@ -156,7 +156,7 @@ where #[inline] #[must_use] pub fn determinant(&self) -> T { - if self.len % 2 == 0 { + if self.len.is_multiple_of(2) { T::one() } else { -T::one() diff --git a/src/linalg/pow.rs b/src/linalg/pow.rs index 8e619c4df..71dd567f4 100644 --- a/src/linalg/pow.rs +++ b/src/linalg/pow.rs @@ -26,7 +26,7 @@ where let mut x = self.clone_owned(); let mut workspace = self.clone_owned(); - if exp % 2 == 0 { + if exp.is_multiple_of(2) { self.fill_with_identity(); } else { // Avoid an useless multiplication by the identity