diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index 686a3ba4932ad5..5169a00fc4fefb 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -180,19 +180,15 @@ impl Camera { #[inline] pub fn logical_viewport_size(&self) -> Result { let viewport = self.viewport.as_ref(); - let logical_viewport_size = viewport.and_then(|v| self.to_logical(v.physical_size)); - if let Some(size) = logical_viewport_size { + if let Some(size) = viewport.and_then(|v| self.to_logical(v.physical_size)) { + Ok(size) + } else if let Some(size) = self.logical_target_size() { Ok(size) } else { - let logical_target_size = self.logical_target_size(); - if let Some(size) = logical_target_size { - Ok(size) - } else { - Err(LogicalViewportSizeError { - viewport_is_set: viewport.is_some(), - target_info_is_set: self.computed.target_info.is_some(), - }) - } + Err(LogicalViewportSizeError { + viewport_is_set: viewport.is_some(), + target_info_is_set: self.computed.target_info.is_some(), + }) } }