From 2ecfbaef0a68fe6fb3aa7758d9a1bad531490365 Mon Sep 17 00:00:00 2001 From: The Miri Cronjob Bot Date: Sun, 10 Mar 2024 05:05:28 +0000 Subject: [PATCH] fmt --- .../miri/tests/pass/box-custom-alloc-aliasing.rs | 16 ++++------------ 1 file 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 541e5f244db0..6daa033835ba 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::(); + let base_ptr = UnsafeCell::raw_get(unsafe { addr_of!((*bin).memory) }).cast::(); 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::() { - Some(&self.bins[0]) - } else { - None - } + if layout == Layout::new::() { Some(&self.bins[0]) } else { None } } }