diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index fa4a6060ad3..ceca44fc1ac 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -307,7 +307,9 @@ impl Arc { if self.inner().weak.fetch_sub(1, Release) == 1 { atomic::fence(Acquire); - deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr)) + deallocate(ptr as *mut u8, + size_of_val(&*ptr), + align_of_val(&*ptr)) } } } @@ -719,7 +721,11 @@ impl Drop for Weak { // ref, which can only happen after the lock is released. if self.inner().weak.fetch_sub(1, Release) == 1 { atomic::fence(Acquire); - unsafe { deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr)) } + unsafe { + deallocate(ptr as *mut u8, + size_of_val(&*ptr), + align_of_val(&*ptr)) + } } } } diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index de934807e18..6961702cbc0 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -34,8 +34,12 @@ extern { #[inline(always)] fn check_size_and_alignment(size: usize, align: usize) { debug_assert!(size != 0); - debug_assert!(size <= isize::MAX as usize, "Tried to allocate too much: {} bytes", size); - debug_assert!(usize::is_power_of_two(align), "Invalid alignment of allocation: {}", align); + debug_assert!(size <= isize::MAX as usize, + "Tried to allocate too much: {} bytes", + size); + debug_assert!(usize::is_power_of_two(align), + "Invalid alignment of allocation: {}", + align); } // FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 5c9ca63a109..dd2db6fab08 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -274,7 +274,10 @@ impl RawVec { let ptr = if self.cap == 0 { heap::allocate(new_alloc_size, align) } else { - heap::reallocate(self.ptr() as *mut _, self.cap * elem_size, new_alloc_size, align) + heap::reallocate(self.ptr() as *mut _, + self.cap * elem_size, + new_alloc_size, + align) }; // If allocate or reallocate fail, we'll get `null` back @@ -358,7 +361,10 @@ impl RawVec { let ptr = if self.cap == 0 { heap::allocate(new_alloc_size, align) } else { - heap::reallocate(self.ptr() as *mut _, self.cap * elem_size, new_alloc_size, align) + heap::reallocate(self.ptr() as *mut _, + self.cap * elem_size, + new_alloc_size, + align) }; // If allocate or reallocate fail, we'll get `null` back @@ -392,7 +398,8 @@ impl RawVec { } // This check is my waterloo; it's the only thing Vec wouldn't have to do. - assert!(self.cap >= amount, "Tried to shrink to a larger capacity"); + assert!(self.cap >= amount, + "Tried to shrink to a larger capacity"); if amount == 0 { mem::replace(self, RawVec::new()); @@ -466,6 +473,7 @@ impl Drop for RawVec { #[inline] fn alloc_guard(alloc_size: usize) { if core::usize::BITS < 64 { - assert!(alloc_size <= ::core::isize::MAX as usize, "capacity overflow"); + assert!(alloc_size <= ::core::isize::MAX as usize, + "capacity overflow"); } } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 47db2e48f2d..3507f123a6f 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -466,7 +466,9 @@ impl Drop for Rc { self.dec_weak(); if self.weak() == 0 { - deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr)) + deallocate(ptr as *mut u8, + size_of_val(&*ptr), + align_of_val(&*ptr)) } } } @@ -785,7 +787,9 @@ impl Drop for Weak { // the weak count starts at 1, and will only go to zero if all // the strong pointers have disappeared. if self.weak() == 0 { - deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr)) + deallocate(ptr as *mut u8, + size_of_val(&*ptr), + align_of_val(&*ptr)) } } }