[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:
Jim Blandy authored and Teodor Tanasoaia committed 2024-03-29 11:54:04 +01:00
1 parent 0f4839c466
commit ec1484b106
1 file changed
+4 -3
+4 -3
View File
@@ -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 {