about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs b/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs
index 541e5f244db..6daa033835b 100644
--- a/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs
+++ b/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs
@@ -10,9 +10,9 @@
 use std::{
     alloc::{AllocError, Allocator, Layout},
     cell::{Cell, UnsafeCell},
+    mem,
     ptr::{self, addr_of, NonNull},
     thread::{self, ThreadId},
-    mem,
 };
 
 const BIN_SIZE: usize = 8;
@@ -33,7 +33,7 @@ impl MyBin {
         }
         // Cast the *entire* thing to a raw pointer to not restrict its provenance.
         let bin = self as *const MyBin;
-        let base_ptr = UnsafeCell::raw_get(unsafe{ addr_of!((*bin).memory )}).cast::<usize>();
+        let base_ptr = UnsafeCell::raw_get(unsafe { addr_of!((*bin).memory) }).cast::<usize>();
         let ptr = unsafe { NonNull::new_unchecked(base_ptr.add(top)) };
         self.top.set(top + 1);
         Some(ptr.cast())
@@ -64,22 +64,14 @@ impl MyAllocator {
         MyAllocator {
             thread_id,
             bins: Box::new(
-                [MyBin {
-                    top: Cell::new(0),
-                    thread_id,
-                    memory: UnsafeCell::default(),
-                }; 1],
+                [MyBin { top: Cell::new(0), thread_id, memory: UnsafeCell::default() }; 1],
             ),
         }
     }
 
     // Pretends to be expensive finding a suitable bin for the layout.
     fn find_bin(&self, layout: Layout) -> Option<&MyBin> {
-        if layout == Layout::new::<usize>() {
-            Some(&self.bins[0])
-        } else {
-            None
-        }
+        if layout == Layout::new::<usize>() { Some(&self.bins[0]) } else { None }
     }
 }