From 78afe0accfda4f907fbef08e051106bfc9c2da5f Mon Sep 17 00:00:00 2001 From: "Tormod G. Hellen" Date: Tue, 7 Nov 2023 19:53:52 +0100 Subject: [PATCH] Convert boolean matches to if statements. This addresses https://github.com/bevyengine/bevy/pull/9770#discussion_r1384477598 and https://github.com/bevyengine/bevy/pull/9770#discussion_r1384478388 --- crates/bevy_render/src/camera/camera.rs | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index 3fd8ba0e9e74b1..18712302b953fe 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -344,19 +344,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, + )) } } @@ -365,9 +364,10 @@ impl Camera { camera_transform: &GlobalTransform, ) -> Result { 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)) } }