Skip to content

Commit

Permalink
Convert boolean matches to if statements.
Browse files Browse the repository at this point in the history
This addresses #9770 (comment)
and #9770 (comment)
  • Loading branch information
tormeh committed Nov 7, 2023
1 parent 845775b commit 023fc5b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,18 @@ impl Camera {
.computed
.projection_matrix
.ok_or(BadProjectionMatrixError::ProjectionMatrixUndefined)?;
match projection_matrix.is_finite() {
false => Err(BadProjectionMatrixError::BadProjectionMatrixValues(
projection_matrix,
)),
true => {
if projection_matrix == Mat4::ZERO {
Err(BadProjectionMatrixError::BadProjectionMatrixValues(
projection_matrix,
))
} else {
Ok(projection_matrix)
}
if projection_matrix.is_finite() {
if projection_matrix == Mat4::ZERO {
Err(BadProjectionMatrixError::BadProjectionMatrixValues(
projection_matrix,
))
} else {
Ok(projection_matrix)
}
} else {
Err(BadProjectionMatrixError::BadProjectionMatrixValues(
projection_matrix,
))
}
}

Expand All @@ -258,9 +257,10 @@ impl Camera {
camera_transform: &GlobalTransform,
) -> Result<Mat4, CameraTransformNotFiniteError> {
let camera_transform_matrix = camera_transform.compute_matrix();
match camera_transform_matrix.is_finite() {
true => Ok(camera_transform_matrix),
false => Err(CameraTransformNotFiniteError(camera_transform_matrix)),
if camera_transform_matrix.is_finite() {
Ok(camera_transform_matrix)
} else {
Err(CameraTransformNotFiniteError(camera_transform_matrix))
}
}

Expand Down

0 comments on commit 023fc5b

Please sign in to comment.