pvmfw: Make use of Rust 1.65 let-else
Test: m pvmfw_bin
Change-Id: I78f31e1df914c837a0ddc7f64c63cbbdf5012770
diff --git a/pvmfw/src/memory.rs b/pvmfw/src/memory.rs
index 7eecb97..ec2a687 100644
--- a/pvmfw/src/memory.rs
+++ b/pvmfw/src/memory.rs
@@ -314,10 +314,7 @@
// non-zero size.
let buffer = unsafe { alloc_zeroed(layout) };
- // TODO: Use let-else once we have Rust 1.65 in AOSP.
- let buffer = if let Some(buffer) = NonNull::new(buffer) {
- buffer
- } else {
+ let Some(buffer) = NonNull::new(buffer) else {
handle_alloc_error(layout);
};
diff --git a/pvmfw/src/virtio/pci.rs b/pvmfw/src/virtio/pci.rs
index dd9e34e..b61403b 100644
--- a/pvmfw/src/virtio/pci.rs
+++ b/pvmfw/src/virtio/pci.rs
@@ -93,9 +93,7 @@
info, device_function, status, command
);
- let virtio_type = if let Some(t) = virtio_device_type(&info) {
- t
- } else {
+ let Some(virtio_type) = virtio_device_type(&info) else {
continue;
};
debug!(" VirtIO {:?}", virtio_type);