summary refs log tree commit diff
path: root/x86_64
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 /x86_64
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 'x86_64')
-rw-r--r--x86_64/src/cpuid.rs35
1 files changed, 16 insertions, 19 deletions
diff --git a/x86_64/src/cpuid.rs b/x86_64/src/cpuid.rs
index 1446d79..0a70a21 100644
--- a/x86_64/src/cpuid.rs
+++ b/x86_64/src/cpuid.rs
@@ -129,25 +129,22 @@ mod tests {
     fn feature_and_vendor_name() {
         let mut cpuid = kvm::CpuId::new(2);
 
-        {
-            let entries = cpuid.mut_entries_slice();
-            entries[0].function = 0;
-            entries[1].function = 1;
-            entries[1].ecx = 0x10;
-            entries[1].edx = 0;
-        }
+        let entries = cpuid.mut_entries_slice();
+        entries[0].function = 0;
+        entries[1].function = 1;
+        entries[1].ecx = 0x10;
+        entries[1].edx = 0;
         assert_eq!(Ok(()), filter_cpuid(1, 2, &mut cpuid));
-        {
-            let entries = cpuid.mut_entries_slice();
-            assert_eq!(entries[0].function, 0);
-            assert_eq!(1, (entries[1].ebx >> EBX_CPUID_SHIFT) & 0x000000ff);
-            assert_eq!(2, (entries[1].ebx >> EBX_CPU_COUNT_SHIFT) & 0x000000ff);
-            assert_eq!(
-                EBX_CLFLUSH_CACHELINE,
-                (entries[1].ebx >> EBX_CLFLUSH_SIZE_SHIFT) & 0x000000ff
-            );
-            assert_ne!(0, entries[1].ecx & (1 << ECX_HYPERVISOR_SHIFT));
-            assert_ne!(0, entries[1].edx & (1 << EDX_HTT_SHIFT));
-        }
+
+        let entries = cpuid.mut_entries_slice();
+        assert_eq!(entries[0].function, 0);
+        assert_eq!(1, (entries[1].ebx >> EBX_CPUID_SHIFT) & 0x000000ff);
+        assert_eq!(2, (entries[1].ebx >> EBX_CPU_COUNT_SHIFT) & 0x000000ff);
+        assert_eq!(
+            EBX_CLFLUSH_CACHELINE,
+            (entries[1].ebx >> EBX_CLFLUSH_SIZE_SHIFT) & 0x000000ff
+        );
+        assert_ne!(0, entries[1].ecx & (1 << ECX_HYPERVISOR_SHIFT));
+        assert_ne!(0, entries[1].edx & (1 << EDX_HTT_SHIFT));
     }
 }