@@ -150,9 +150,9 @@ pub fn rotate_matrix<
150150 }
151151 } ;
152152
153- for i in 0 .. rows {
154- for j in 0 .. columns {
155- rotation_matrix. update ( i, j, rotation [ i ] [ j ] ) ;
153+ for ( i , row ) in rotation . iter ( ) . enumerate ( ) . take ( rows) {
154+ for ( j , value ) in row . iter ( ) . enumerate ( ) . take ( columns) {
155+ rotation_matrix. update ( i, j, * value ) ;
156156 }
157157 }
158158
@@ -355,9 +355,8 @@ where
355355 }
356356 submatrix. push ( row) ;
357357 }
358- result += self . at ( 0 , i)
359- * submatrix. determinant ( )
360- * ( -1.0 as f32 ) . powi ( i as i32 ) ;
358+ result +=
359+ self . at ( 0 , i) * submatrix. determinant ( ) * ( -1.0_f32 ) . powi ( i as i32 ) ;
361360 }
362361 result
363362 }
@@ -374,7 +373,6 @@ where
374373 return & self . as_ref ( ) [ row] ;
375374 }
376375
377- ///
378376 fn at ( & self , row : usize , column : usize ) -> <V as Vector >:: Scalar {
379377 return self . as_ref ( ) [ row] . as_ref ( ) [ column] ;
380378 }
@@ -450,7 +448,7 @@ mod tests {
450448 fn non_square_matrix_determinant ( ) {
451449 let m = [ [ 3.0 , 8.0 ] , [ 4.0 , 6.0 ] , [ 0.0 , 1.0 ] ] ;
452450 let result = std:: panic:: catch_unwind ( || m. determinant ( ) ) ;
453- assert_eq ! ( false , result. is_ok ( ) ) ;
451+ assert ! ( result. is_err ( ) ) ;
454452 }
455453
456454 #[ test]
0 commit comments