mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[hal/vulkan] Use Option::insert and avoid an unwrap.
In `wgpu_hal::vulkan::InstanceShared::inspect`, handle `PhysicalDeviceCapabilities::maintenance_3` more like the way we handle other extension-provided physical device properties. Specifically, use `Option::insert` to populate the `Option` and borrow a mutable reference to its value, rather than calling `.as_mut().unwrap()`. This change should have no observable effect on behavior. It simply replaces a runtime check (`unwrap`) with a statically checked borrow (`insert`).
This commit is contained in:
committed by
Teodor Tanasoaia
parent
0f4839c466
commit
ec1484b106
@@ -923,9 +923,10 @@ impl super::InstanceShared {
|
||||
|
||||
let mut builder = vk::PhysicalDeviceProperties2KHR::builder();
|
||||
if supports_maintenance3 {
|
||||
capabilities.maintenance_3 =
|
||||
Some(vk::PhysicalDeviceMaintenance3Properties::default());
|
||||
builder = builder.push_next(capabilities.maintenance_3.as_mut().unwrap());
|
||||
let next = capabilities
|
||||
.maintenance_3
|
||||
.insert(vk::PhysicalDeviceMaintenance3Properties::default());
|
||||
builder = builder.push_next(next);
|
||||
}
|
||||
|
||||
if supports_descriptor_indexing {
|
||||
|
||||
Reference in New Issue
Block a user