about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-09-24 11:32:01 +1200
committerNick Cameron <ncameron@mozilla.com>2015-09-24 11:32:01 +1200
commit459f7720b99db16f3b9017820b1979698ba8c90b (patch)
tree808b4662d406074081db7e1f81f81a6677e8963f /src/liballoc
parent06812c29991d1b4bd43feef1deb4fb8ad0cf404f (diff)
Better function calls
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs10
-rw-r--r--src/liballoc/heap.rs8
-rw-r--r--src/liballoc/raw_vec.rs16
-rw-r--r--src/liballoc/rc.rs8
4 files changed, 32 insertions, 10 deletions
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<T: ?Sized> Arc<T> {
 
         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<T: ?Sized> Drop for Weak<T> {
         // 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<T> RawVec<T> {
             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<T> RawVec<T> {
             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<T> RawVec<T> {
         }
 
         // 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<T> Drop for RawVec<T> {
 #[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<T: ?Sized> Drop for Rc<T> {
                     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<T: ?Sized> Drop for Weak<T> {
                 // 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))
                 }
             }
         }