Skip to content

Commit

Permalink
Use assert instead of panic in an if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
jtdowney committed Mar 17, 2023
1 parent d8d64ac commit 32c674d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/matrix.rs
Expand Up @@ -96,9 +96,7 @@ impl Matrix4 {

pub fn inverse(self) -> Matrix4 {
let determinant = self.determinant();
if determinant == 0.0 {
panic!("matrix is not invertable");
}
debug_assert!(determinant != 0.0, "matrix is not invertable");

let mut result = Matrix4::default();
for i in 0..4 {
Expand Down

0 comments on commit 32c674d

Please sign in to comment.