rt(vk): use Option::filter instead of let_chains

This commit is contained in:
chyyran 2024-09-13 18:06:04 -04:00 committed by Ronny Chan
parent 57f9a13ee7
commit 0ba4c482b3
3 changed files with 3 additions and 6 deletions

View file

@ -185,8 +185,8 @@ impl FrameResiduals {
} }
} }
for framebuffer in self.framebuffers.drain(0..) { for framebuffer in self.framebuffers.drain(0..) {
if let Some(framebuffer) = framebuffer if let Some(framebuffer) =
&& framebuffer != vk::Framebuffer::null() framebuffer.filter(|framebuffer| *framebuffer != vk::Framebuffer::null())
{ {
unsafe { unsafe {
self.device.destroy_framebuffer(framebuffer, None); self.device.destroy_framebuffer(framebuffer, None);

View file

@ -34,9 +34,7 @@ impl PipelineDescriptors<'_> {
} }
pub fn add_ubo_binding(&mut self, ubo_meta: Option<&BufferReflection<u32>>) { pub fn add_ubo_binding(&mut self, ubo_meta: Option<&BufferReflection<u32>>) {
if let Some(ubo_meta) = ubo_meta if let Some(ubo_meta) = ubo_meta.filter(|ubo_meta| !ubo_meta.stage_mask.is_empty()) {
&& !ubo_meta.stage_mask.is_empty()
{
let ubo_mask = util::binding_stage_to_vulkan_stage(ubo_meta.stage_mask); let ubo_mask = util::binding_stage_to_vulkan_stage(ubo_meta.stage_mask);
self.layout_bindings.push(vk::DescriptorSetLayoutBinding { self.layout_bindings.push(vk::DescriptorSetLayoutBinding {

View file

@ -4,7 +4,6 @@
//! See [`librashader::runtime::vk`](https://docs.rs/librashader/latest/librashader/runtime/vk/index.html) instead. //! See [`librashader::runtime::vk`](https://docs.rs/librashader/latest/librashader/runtime/vk/index.html) instead.
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![feature(let_chains)]
mod draw_quad; mod draw_quad;
mod filter_chain; mod filter_chain;