summary refs log tree commit diff
path: root/kvm/src/lib.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-15 15:30:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-17 17:22:57 -0700
commit1c5e2557e2eb3992c320b658ef117cb578bc6fe1 (patch)
tree03c48568332467b36db736f8d173ead442c7963e /kvm/src/lib.rs
parent35ee9d918404ee87abdd23a450fdb483388e1932 (diff)
downloadcrosvm-1c5e2557e2eb3992c320b658ef117cb578bc6fe1.tar
crosvm-1c5e2557e2eb3992c320b658ef117cb578bc6fe1.tar.gz
crosvm-1c5e2557e2eb3992c320b658ef117cb578bc6fe1.tar.bz2
crosvm-1c5e2557e2eb3992c320b658ef117cb578bc6fe1.tar.lz
crosvm-1c5e2557e2eb3992c320b658ef117cb578bc6fe1.tar.xz
crosvm-1c5e2557e2eb3992c320b658ef117cb578bc6fe1.tar.zst
crosvm-1c5e2557e2eb3992c320b658ef117cb578bc6fe1.zip
edition: Eliminate blocks superseded by NLL
Before the new borrow checker in the 2018 edition, we sometimes used to
have to manually insert curly braced blocks to limit the scope of
borrows. These are no longer needed.

Details in:

https://doc.rust-lang.org/edition-guide/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html

TEST=cargo check --all-features
TEST=local kokoro

Change-Id: I59f9f98dcc03c8790c53e080a527ad9b68c8d6f3
Reviewed-on: https://chromium-review.googlesource.com/1568075
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'kvm/src/lib.rs')
-rw-r--r--kvm/src/lib.rs36
1 files changed, 17 insertions, 19 deletions
diff --git a/kvm/src/lib.rs b/kvm/src/lib.rs
index dd8fd00..60ec2d1 100644
--- a/kvm/src/lib.rs
+++ b/kvm/src/lib.rs
@@ -956,25 +956,23 @@ impl Vm {
             vec_with_array_field::<kvm_irq_routing, kvm_irq_routing_entry>(routes.len());
         irq_routing[0].nr = routes.len() as u32;
 
-        {
-            // Safe because we ensured there is enough space in irq_routing to hold the number of
-            // route entries.
-            let irq_routes = unsafe { irq_routing[0].entries.as_mut_slice(routes.len()) };
-            for (route, irq_route) in routes.iter().zip(irq_routes.iter_mut()) {
-                irq_route.gsi = route.gsi;
-                match route.source {
-                    IrqSource::Irqchip { chip, pin } => {
-                        irq_route.type_ = KVM_IRQ_ROUTING_IRQCHIP;
-                        irq_route.u.irqchip = kvm_irq_routing_irqchip { irqchip: chip, pin }
-                    }
-                    IrqSource::Msi { address, data } => {
-                        irq_route.type_ = KVM_IRQ_ROUTING_MSI;
-                        irq_route.u.msi = kvm_irq_routing_msi {
-                            address_lo: address as u32,
-                            address_hi: (address >> 32) as u32,
-                            data,
-                            ..Default::default()
-                        }
+        // Safe because we ensured there is enough space in irq_routing to hold the number of
+        // route entries.
+        let irq_routes = unsafe { irq_routing[0].entries.as_mut_slice(routes.len()) };
+        for (route, irq_route) in routes.iter().zip(irq_routes.iter_mut()) {
+            irq_route.gsi = route.gsi;
+            match route.source {
+                IrqSource::Irqchip { chip, pin } => {
+                    irq_route.type_ = KVM_IRQ_ROUTING_IRQCHIP;
+                    irq_route.u.irqchip = kvm_irq_routing_irqchip { irqchip: chip, pin }
+                }
+                IrqSource::Msi { address, data } => {
+                    irq_route.type_ = KVM_IRQ_ROUTING_MSI;
+                    irq_route.u.msi = kvm_irq_routing_msi {
+                        address_lo: address as u32,
+                        address_hi: (address >> 32) as u32,
+                        data,
+                        ..Default::default()
                     }
                 }
             }