From 0ba4c482b3e29cd853bda1d78a21ec68b4c1fa08 Mon Sep 17 00:00:00 2001 From: chyyran Date: Fri, 13 Sep 2024 18:06:04 -0400 Subject: [PATCH] rt(vk): use `Option::filter` instead of `let_chains` --- librashader-runtime-vk/src/filter_chain.rs | 4 ++-- librashader-runtime-vk/src/graphics_pipeline.rs | 4 +--- librashader-runtime-vk/src/lib.rs | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/librashader-runtime-vk/src/filter_chain.rs b/librashader-runtime-vk/src/filter_chain.rs index 3f2e674..296e63c 100644 --- a/librashader-runtime-vk/src/filter_chain.rs +++ b/librashader-runtime-vk/src/filter_chain.rs @@ -185,8 +185,8 @@ impl FrameResiduals { } } for framebuffer in self.framebuffers.drain(0..) { - if let Some(framebuffer) = framebuffer - && framebuffer != vk::Framebuffer::null() + if let Some(framebuffer) = + framebuffer.filter(|framebuffer| *framebuffer != vk::Framebuffer::null()) { unsafe { self.device.destroy_framebuffer(framebuffer, None); diff --git a/librashader-runtime-vk/src/graphics_pipeline.rs b/librashader-runtime-vk/src/graphics_pipeline.rs index 1eefb67..a52e317 100644 --- a/librashader-runtime-vk/src/graphics_pipeline.rs +++ b/librashader-runtime-vk/src/graphics_pipeline.rs @@ -34,9 +34,7 @@ impl PipelineDescriptors<'_> { } pub fn add_ubo_binding(&mut self, ubo_meta: Option<&BufferReflection>) { - if let Some(ubo_meta) = ubo_meta - && !ubo_meta.stage_mask.is_empty() - { + if let Some(ubo_meta) = ubo_meta.filter(|ubo_meta| !ubo_meta.stage_mask.is_empty()) { let ubo_mask = util::binding_stage_to_vulkan_stage(ubo_meta.stage_mask); self.layout_bindings.push(vk::DescriptorSetLayoutBinding { diff --git a/librashader-runtime-vk/src/lib.rs b/librashader-runtime-vk/src/lib.rs index bc6334b..8059e46 100644 --- a/librashader-runtime-vk/src/lib.rs +++ b/librashader-runtime-vk/src/lib.rs @@ -4,7 +4,6 @@ //! See [`librashader::runtime::vk`](https://docs.rs/librashader/latest/librashader/runtime/vk/index.html) instead. #![deny(unsafe_op_in_unsafe_fn)] #![feature(type_alias_impl_trait)] -#![feature(let_chains)] mod draw_quad; mod filter_chain;